Increase the Size of the Logical Volume
For Linux Cloud Servers and Linux Dedicated Servers.
Follow the steps below to increase the size of the logical volume and allocate additional space on one of your partitions.
Step 1
Step 2
Abbreviation | Explanation |
---|---|
df | The disk free command to show hard disk freespace |
Column 0 Value | Command option to display the output in human-readable format (KB, MB or GB) |
Step 3
Step 4
Type the pvs command and press Enter.
Note for Cloud Servers: The PSize value listed will often be bit smaller than the value listed by the fdisk command output. If the difference in size between the fdisk output and PSize is more than 100GB.
Further Explanation
Abbreviation | Explanation |
---|---|
pvs | Physical Volume Show command |
PV | Physical Volume path |
VG | Volume Group name |
Fmt | LVM Format |
Attr | Physical volume attributes. The a means that the physical volume is allocatable and not read-only. |
PSize | Physical Size of the physical volume |
PFree | Physical Free space left on the physical volume |
Step 5
As stated above, our scenario requires roughly 9GB of data to be uploaded to the /var folder. Since the logical volume assigned to /var is only 4GB, we will increase this to 10GB using the lvextend command. The command below is to be used as reference only as the parameters will be different depending on your scenario.
The format for the lvextend command is as follows:
lvextend -L +6G /dev/mapper/vg00-var
Further Explanation
Input | Explanation |
---|---|
lvextend | The logical volume extend command used to increase logical volumes |
-L +6G | Command option to increase a Logical volume by 6 Gigabytes |
/dev/mapper/vg00-var | The path for the logical volume to increase |
Step 6
Step 7
Step 8
Step 9
To increase the file system to match that of the logical volume, we will use the xfs_growfs command if the filesystem uses xfs or resize2fs if the filesystem is ext4.
Typing xfs_growfs /var or resize2fs /dev/mapper/vg00-var (depending on which filesystem is used on your system) will extend the file system to the 10 gigabyte limit of the logical volume.
Step 10
You Can Share this Post: https://ali.ms/increasesize