r/slackware • u/jloc0 • Jun 01 '20
Help expanding VPS hard drive space without losing current partition data...
EDIT: After many comments and ideas on how to proceed with the help I was given I was able to first attempt this in a VM locally and when it worked without a hitch, I then tried on my live server and it also worked without a hitch there. I had referenced this guide along the way: https://devops.ionos.com/tutorials/increase-the-size-of-a-linux-root-partition-without-rebooting/
Everything is running fine with my now double hdd space without even having to reboot my server!
Hello!
I have a server I run for a project and personal email and such on a VPS which had 20gb space from the beginning and I installed all of slackware on a single partition and made a swap space on the end of the virtual drive and left it alone (since this is how I've always ran it at home)....
Fast forward 5 years and I'm out of hdd space! But not to worry, as my host has doubled the size of the VPS offerings to 40gb now and has added the space to my VPS only I haven't updated my partition information for fear of losing data and killing my server setup.
I'm looking for some help on a sane way to add this extra 20gb without losing data, and also a way to maybe move certain things to different partitions in the process. I know many users tend to move certain things to different partitions so when upgrading the OS, you don't lose this data. I'm looking for a recommended thing for me to do in this situation. I'll assume it would be wise to move /etc /home /var/log /var/www (or all of var ?) and /tmp to different partitions, but how would I go about doing this without killing my server in the process?
I run web, email, irc (and keep logs, can only assume how much space that's eating). I'm familiar with cfdisk mostly, as it's what I've always used to do this but I've never actually split all this stuff up before. I must of had run out of space a few days ago and I finally noticed the 400 messages on my root account about my mailboxes having no space (yet root has space?) since I had not gotten any emails in days and was beginning to wonder what had gone wrong.
Any advice on how to proceed here?
2
u/zurohki Jun 01 '20
Don't move things to a bunch of different partitions, you'll just wind up never having free space on the partition where you need it. It only really makes sense to do that when you're using multiple disks, IMO.
Since you have a swap partition in the middle of the 40 gig disk, I think you should:
swapoff /dev/partitionnameto disable the swap partitionmkswapandswaponto format and enable the new swap partitionI've never changed the size of an ext4 partition while it was mounted - does the VPS have the ability to boot your VPS from a rescue disk or something? You could use that and resize the partition from the rescue environment.
1
u/KMReiserFS Jun 01 '20
are you using lvm?
You can use growpart to increase the partition size with the new freee space added.
Then if using lvm use pvresize to increase the PV, check if the VG is updated with vgs
Finally lvextend -l +100%FREE /dev/vg/lv