How to Increase Disk Space?
Increase disk space when SSH using root.
- Check the current partition size using
df -h
- Check the actual physical disk size and available partition using the following command:
fdisk -l
Example of output:
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 30G 3.2G 2.5G 12% /
The example above shows the disk is /dev/vda and the partition is 1.
- Install using cloud-utils-growpart command and press y to continue the installation. You should see Complete! At the end of the installation process.
yum install cloud-utils-growpart
- Use the following command to grow the logical partition to extend to all available space:
growpart /dev/vda 1
Example of output:
CHANGED:partition=1 start=2048 old:size=41938688 end=41940736 new:size=62912479,end=62914527
The output might be different based on your disk space.
- Run resize2fs command to extend filesystem:
resize2fs /dev/vda1
Example of output:
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/vda1 is now 7864059 blocks long.
The output might be different based on your disk space.
- Check your new partition size:
df -h
You should see the size of your partition and filesystem has been increased.
Updated on: 21/06/2022
Thank you!