I have a VPS running on Centos 7 and I have upgraded my VPS account from one with 20 GB of disk space to another with 40 GB, but they don't support extending the partition to the current bigger one.

As you can see, the space in the 20 GB partition currently and is almost full, so I cannot make a backup easily.

I need to be sure that I can extend this partition to 40 GB safely.

I have read on Internet the following steps, and I would like to confirm with the community if I am right and the process is safe or not 100% or 95% (I understand that accidents could happen, but I mean in normal conditions)

The steps are ...

  1. SSH inside your VPS: sudo growpart /dev/sda 1
  2. Resize your file system: sudo resize2fs /dev/sda1
  3. Verify: df -h
  4. sudo reboot

What do you think? Is it safe to do it and the partition will extend to 40 GB rightly? in normal conditions of course.

Let me know if you want me to do more shell commands before.

I have attached an image describing the current status of my partition and hard disk.

Thank you very much in advance, indeed.


enter image description here


sudo growpart -N /dev/sda 1

I get this. Seems is OK to do the remaining tasks.

enter image description here

  • 2
    Make a snapshot, try it. You should be fine.
    – Panki
    Feb 4, 2022 at 12:46

1 Answer 1


Growpart and resize2fs can be done online, that is: without taking the filesystem offline (without unmounting). This allows for filesystem growing on the fly.

These steps will work:

# First, TEST what growpart is going to do (dry run)
# (the values are just examples -- check if the "size" and "end" change to what you'd expect)
» sudo growpart -N /dev/sda1 1
CHANGE: partition=1 start=4096 old: size=16773087 end=16777183 new: size=25161695 end=25165791

# If you're satisfied, apply
» sudo growpart /dev/sda1 1

# If you do lsblk, you should now see that the disk and partition sizes are both 40GB!

# Grow ext4 partition
» sudo resize2fs /dev/sda1

# Check with df -h if the free space increased

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .