"Expand" home with new "disk"

Hey guys!
I know some of you use Webmin/Virtualmin in cloud providers, like Vultr, DigitalOcean, etc.

Those Cloud providers besides selling the VPS itself with pre-determined disk for each vps level, it also sells Block Storages / Volume, which is basically a new disk available to be mounted in your vps, pretty much like an external drive.

The problem with this type of disk expansion is that it doesn’t expand the root filesystem by itself, you need to mount this somewhere else. So probably the safest bet it to mount in /home, so every virtual domain will be alocated to this new disk.

My question is: What is the safest procedure to copy everything from the actual /home folder that is still in the local disk, to the new one (keeping all permissions and ownerships) and then mount the new disk into the /home?

Besides that, is it safe to after that, resize this new disk when I eventually need more space? For example, I’ll buy a 100GB disk, copy everything from the local one to this new block, and when this 100GB is not enough anymore, I will just go to the Cloud Control panel and ask for a resize in this block, for 100GB+ (of course, with the VPS off). Then I’d start the VPS and see if the new space is already recognized or if it would need to be resized in the webmin control panel.

Can you guys tell me a short and safe procedure to this happen?

Thanks!

Hi,

Shutdown any user-like services (like Apache), to avoid data change on synced device, then simply mount it to some temporary location, outside of /home, let’s say to /mnt/home and sync /home to /mnt/home, and then mount it to /home. The previous content of /home should be deleted or moved somewhere else safe.

rsync -arv -A -H --exclude=somefilestoexcludeifany /home /mnt/home

Besides that, is it safe to after that, resize this new disk when I eventually need more space?

Yes, of course, why not.

1 Like

Well, this kind worked. But not i’m locked out of the system.

It seems it copied the home folder to a new home folder in /mnt/home making /mnt/home/home.
Now I’ve mounted this volume in /home and I got /home/home/usershere.

My Webmin can’t load because it can’t find the /home/mydomain/sslfile.ssl

So I’m doind the reverse and next time I’ll try:
rsync -arv -A -H --exclude=somefilestoexcludeifany /home /mnt
So then I can mount the /mnt/home folder into /home without 2 home folders.

–Edit
After moving files back and forth I was able to get everything where it should be :slight_smile:
Your command worked great, thank you very much sir.
:slight_smile:

But when I resize the disk with the VPS off, do you know if webmin will automatically resize the volume on boot?

No, Webmin will not resize it for you and you would have to resize it manually.

Can you tell me what would be the procedure to resize it?
Thanks!

No. It’s something that you should figure out yourself. There are a lot of tutorials online, if you don’t know what to start with.

Eventually, it would depend on the setup. You may need to use xfs_growfs or lvextend and/or resize2fs commands or just parted/gparted tool.

Sure! Actually what I was looking for was what kind app to use. As you said, resize2fs and gparted would do the work. Now I’ll study a little more and see what I can do.

Thank you very much for your support :slight_smile: