Since COVID-19 finally tuned down in my part of Europe concerts finally started to be a thing again! How is this connected to resizing your partition? Well, my customer rockline.si has had a busy few months and filled up their WHM/cPanel hosted server to the point where backups could no longer be made. After contacting the VPS provider, they added 1,2TB more space to the VPS, but now it was time to join these drives together.

The process is easy and not terrifying as memories you might have with Partition Magic on your Windows XP machines back in the day. The server is running CentOS 7.9 KVM. P.S. I was so lazy doing this I did not even connect to the server via SSH but just used the terminal option in WHM so some screenshots might appear a bit nonstandard :).

 

 

So starting off, when your provider adds you extra drive space (it can be regular HDD (but it’s 2022 so I’d expect it not to be), SSD, or the new and fast crazy NVMe), you need to check how your disk is “called”. To find this out simply type;

df -h

You will see something like the image above. You are looking for the “/dev/SOMETHING” in my case it’s sda. So then you type:

 

echo "- - -" > /sys/block/sda/device/rescan

Don’t worry if nothing is displayed here and if it just goes to the next line. And then type (replace the sda part with the one you see):

fdisk /dev/sda

And you will see something like this;

Now without complicating this further, push the following:

d
2
n
p
2
Enter (twice)
w

That’s it, the fdisk should automatically detect the news storage and append it to the current partition. Now you will get a “sort of” error when you press “W” (for write) that looks like this:

 

Which is totally fine. Linux is just telling you it needs a bit of help with the final steps. So let’s help it out with:

partx -u /dev/sda2
resize2fs /dev/sda2

And you shall be rewarded for your efforts with;


And that’s it. No need to reboot or anything like that, just enjoy your new space.

 

P.S. Please don’t get confused with the different numbers of hard disk space in the screenshots. I had to resize the disk twice in 2 months so, the size may vary in some cases.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.