Increase disk space when SSH using root.
STEP 1: Check the current partition size using df-h:
# df -h
STEP 2: 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.
STEP 3: 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
STEP 4: 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.
STEP 5: 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.
STEP 6: Check your new partition size:
# df -h
You should see the size of your partition and filesystem has been increased.