Articles on: Linux

How to resize partition in Linux

  1. SSH to your server as root user


  1. Run df -Th | grep "^/dev" to get the device name & also the filesystem type (ext4,XFS,etc)





  1. Grow the partition by running growpart /dev/sda X (where X is the device name and with space)


  1. Once done, use the following command according to your filesystem type to enlarge the partition


EXT4
resize2fs /dev/sdaX


XFS
xfs_growfs /dev/sdaX


  1. Run df -h to determine if the resize is succesful

Updated on: 25/01/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!