Increase and expansion of CentOS filesystem

Increase and expansion of CentOS filesystem

Have you ever used LVM? It is one of the most recommended tools for a system admin who works on a web server.
Use the command for checking the filesystem size:

Code:
df –h
The below command is to check the presence of drives and it helps to increase the size of the filesystem:

Code:
fdisk –l
Perform disk size increase:

Go to the path /dev/sda4 (Linux LVM) for increasing the size up to 10GB.

Creation of partition:

Once if you increase the disk size and then perform the partition by using the command:

Code:
fdisk /dev/sda
Tap on the N for doing partition.

To select a type like primary or secondary click on the P command.

Set the default partition number as 3.

Set the sectors of start and end and check the hyphen is used to match their values. Still, you have space as unallocated:

Image

You can even change the type as the default one by Linux LVM. Use the command “T” for identifying the partition and then type hexadecimal number 8e.

Long press on the command “P”

By now, you have created the partition /dev/sda3. To save all your changes use the command “W”.

Extension of LVM:

Use the pvcreate command for creating the LVM volume:


Code:
pvcreate /dev/sda3
According to the partition you created you can add the volume. You can be trying using vgdisplay and so the default one is cl:

Image

To create the group, you can add partition:


Code:
vgextend cl /dev/sda3
Code:
To expand the path as well as the name you can use the command lvdisplay

Code:
Lvdisplay
To advise the logical volume, do path specification by using the command lvextend. For specifying the free space, parameters are recommended -l +100%FREE.

Code:
lvextend -l +100%FREE /dev/cl/root
Last is not least! Do expansion on the filesystem by using xfs command:

Code:
xfs_growfs /dev/mapper/cl-root
To use ext4, the below command will help you:

Code:
resize2fs -p /dev/mapper/cl-root
Now, you will see the result! Do check on the result whether it matches the created one or not.

Code:
df –h
That’s it! Follow all the commands as per the given structure! You will get the result as per your expectation.
Author
kumkumsharma
Views
2,003
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top