-
Connect to the server using SSH.
-
Make sure that the server uses LVM:
-
The similar output will be returned if LVM is present:
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- <8.00g
swap centos -wi-ao---- 1.00gNote: centos here is the name of the logical group. It will be used in the further steps
-
The similar output will be returned if LVM is not present:
# lvs
-bash: lvs: command not found# lvdisplay -v
No volume groups found.Warning: In this case, solution from the article cannot be applied, as the server does not use LVM.
-
-
Start
cfdisk
to get information about current partition schema:# cfdisk
Note: Unallocated disk space will have Free Space FS Type. This space can be used for creation of a partition and for further LVM extension
-
Select unallocated disk space using arrow buttons and create a new partition by clicking on the
[ New ]
button: -
Follow the wizard to create a Primary partition and its size. Primary type is selected by default, and the default size corresponds to the free disk space size
-
Click on
[ Write ]
and then[ Quit ]
to confirm create and apply changes to the hard drive partition table:Note: The name of the new partition may vary, in this case it is sda3. It will be used in the further steps
-
Run
partprobe
to load partition changes in userspace:# partprobe
-
Once new partition table is loaded, it is possible to add a new volume to the logical group using its name:
# vgextend centos /dev/sda3
Physical volume "/dev/sda3" successfully created
Volume group "centos" successfully extendedNote: Volume and logical group names may vary, in this case it is centos and sda3. Refer to step 6 and command
cfdisk
to get volume name and to step 2 and commandvgdisplay
to get volume group name -
Then it is possible to extend logical volume of root directory to add all unused space available in the volume group:
# lvdisplay | grep 'LV Path'
LV Path /dev/centos/root
LV Path /dev/centos/swap# ls -la /dev/centos/root
lrwxrwxrwx. 1 root root 7 Aug 28 21:14 /dev/centos/root -> ../dm-0# lsblk /dev/dm-0
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
centos-root 253:0 0 23G 0 lvm /Note: Since
/dev/centos/root
is mounted on the/
, as displayed above, it should be resized. Logical volume name may vary# lvresize -l +100%FREE /dev/centos/root
-
Extend the partition located on the logical volume:
Note: To determine file system, run
file -sL /dev/centos/root
For XFS:-
Install required packages:
-
For .rpm-based OS (RHEL, CentOS, CloudLinux)
# yum install -y xfsprogs
-
For .deb-based OS (Debian, Ubuntu)
# apt install -y xfsprogs
-
-
Grow partition:
# xfs_growfs -d /dev/centos/root
For ext2/ext3/ext4-
Install required packages:
-
For .rpm-based OS (RHEL, CentOS, CloudLinux)
# yum install -y e2fsprogs
-
For .deb-based OS (Debian, Ubuntu)
# apt install -y e2fsprogs
-
-
Grow partition:
# resize2fs /dev/centos/root
-
-
Check that the disk space has been extended:
# df -h
- LVM, Centos, plesk
- 6 Users Found This Useful