Step 1:
First, log into the server via SSH.
Step 2:
df -h
Step 3:
Next, type fdisk -l to view the total hard disk(s) size and partitions on the disk. It can also be noticed here that the physical partition /dev/sda3 is using Linux LVM.
fdisk -l
Step 4:
Type the pvs command and press Enter.
Note: If 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, please reference What if my physical volume size has not changed after increasing disk space? before continuing.
Further Explanation:
pvs arrow image Physical Volume Show command.
PV arrow image Physical Volume path
VG arrow image Volume Group name.
Fmt arrow image LVM Format
Attr arrow image Physical volume attributes. The a attribute means that the physical volume is allocatable and not read-only.
PSize arrow image Physical Size of the physical volume.
PFree arrow image 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 Explaination:
lvextend arrow image This is the logical volume extend command used to make a logical volume larger.
-L +6G arrow image It is specified using the Logical volume size option, how much larger to make the volume. In this scenario, 6 gigabytes is added to the current 4 gigabyte volume to result in a 10 gigabyte volume.
/dev/mapper/vg00-var arrow image The path to the logical volume is specified last. The path to the volume to be extended was taken from the output from the second step in this guide.
Step 6:
Type df -h to display the disk free space once again. The lvextend operation finished successfully in the last step however the /dev/mapper/vg00-var size is still only showing 4.0G. This is because while the logical volume was increased successfully, the file system needs to be extended to take advantage of the full space of the logical volume.
Step 7:
Type lvs to show the logical volume information once again. Here, we can confirm that the logical volume has successfully been extended to 10 gigabytes. In the next steps, we will increase the file system to match the logical volume size.
Step 8:
Type mount and press ENTER to display the mounted file systems. From the output, we find that the /dev/mapper/vg00-var logical volume is using xfs.
Step 9:
To increase the file system to match that of the logical volume, we will use the xfs_growfs command.
Typing xfs_growfs /var will extend the file system to the 10 gigabyte limit of the logical volume.
Step 10:
Type df -h to display the disk free space to confirm that the file system has been extended.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment