Applicable to:
- Plesk for Linux
Question
The free disk space is exceeded on the server.
Disk size for the server has been extended from the hardware node side of the virtualization, however these changes are not being reflected from the inside of the virtual machine.
Virtual hard disk was increased on the hypervisor, but this has not translated across to Plesk.
How to extend disk size inside of the virtual machine that uses LVM?
Answer
Warning: The following article is applicable only for the systems that use LVM. Before applying the steps below, create a backup of the virtual machine.
Note: All services will stay online during this procedure.
Note: This task is not related to Plesk and is not covered by Plesk Technical Support. If you are not familiar with Linux system administering and would like our professionals to handle this task on your behalf, contact Professional Services team at https://www.plesk.com/professional-services/.
-
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
Alternatively, it is possible to decrease the /home
partition and increase the /
partition using the utilities lvreduce
(https://linux.die.net/man/8/lvreduce) and lvextend
(https://linux.die.net/man/8/lvextend).
This may be required on a default CentOS installations where only 50 GB are allocated for the /
partition and all Plesk domains, mail, backups, and databases are stored in the /var
directory, which in this case is located inside the /
partition.
Comments
9 comments
Hello,
I followed the steps mentioned above, my server does not have Pool name such as Centos. so the command - vgextend centos /dev/sda4 Is not working please advice. Screesnhot below.
@Sivaji,
Hello!
This article is not applicable to your server as LVM is not used.
To learn more about LVM, check official CentOS article.
how about shrinking ?
Hi @Luis Zubeldia,
Reducing the size of LVM is potentially dangerous operation that can erase some data, therefore it is not recommenced.
You can do this on your own risk using any guide across the internet, for example the one below (there are no limitations on Plesk side regarding it):
https://www.rootusers.com/lvm-resize-how-to-decrease-an-lvm-partition/
Hola
tengo un gran problema con mi servidor. tengo varias particiones y mi pagina esta montada en Disk /dev/mapper/vg00-var hace un tiempo pude aumentar el tamaño
pero ahora no tengo que hacerlo y quedar sin espacio, pero en / home tengo mas de 800G,
Ya te he intentado todo pero no soy experto,
¿Cómo puedo aumentar / no puedo afectar mi página?
root@s21344409:~# fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x31dafc72
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 8390655 8388608 4G fd Linux raid autodetect
/dev/sda2 8390656 12584959 4194304 2G 82 Linux swap / Solaris
/dev/sda3 12584960 1953525167 1940940208 925.5G fd Linux raid autodetect
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3b4d5332
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 8390655 8388608 4G fd Linux raid autodetect
/dev/sdb2 8390656 12584959 4194304 2G 82 Linux swap / Solaris
/dev/sdb3 12584960 1953525167 1940940208 925.5G fd Linux raid autodetect
Disk /dev/md1: 4 GiB, 4294901760 bytes, 8388480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md3: 925.5 GiB, 993761296384 bytes, 1940940032 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg00-usr: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg00-var: 78 GiB, 83751862272 bytes, 163577856 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg00-home: 837.5 GiB, 899271360512 bytes, 1756389376 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/vg00-opt: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@s21344409:~#
estaria muy agradecido con su ayuda
saludos y gracias
Hi @luis serrano,
There are no guarantees that decreasing the space from /home won't cause data lost.
I recommend contacting our Professional Services Team which is dealing with such tasks and will be able to assist you on a paid basis.
My cfdisk screen only shows sda1 NC Primary GPT 480 GB size
No (New) Menu selection on bottom menu. Starts with (Bootable)...
Please advise.
Hello @Vistanetix Inc,
As I understand, cfdisk shows for you only allocated disk space.
The fact that free disk space is not displayed most probably means that new disk space is not detected by the OS. This needs to be checked by server administrator or with hosting provider in case virtual environment is used.
I don't have any free space to partition,. What do I do?
Please sign in to leave a comment.