Move /home to another drive

I have a Hetzner VPS but need to buy a volume with more space to move the /home to it.

What I believe I have to do:

  • systemctl stop exim4
  • systemctl stop dovecot
  • mkdir /temp_home
  • mount the new volume on /temp_home
  • copy /home data to /temp_home with sudo rsync -aXS /home/ /temp_home
  • mv /home /old_home
  • mkdir /home
  • mount the new volume on /home and add it to fstab
  • umount /temp_home
  • rm /old_home
  • systemctl start exim4
  • systemctl start dovecot

Is this going to work properly or should I do anything else to make sure all the permissions, ACL and other possible stuff is preserved?

Do I need to execute v-rebuild-users?

Anyone can confirm if this is the correct procedure please?

I am just after a second opinion

You should stop all the services that could try to access /home/ so stop nginx and apache2 too (if you are using them of course).

You should also add option -A to preserve ACL permissions.

You should umount /temp_home first and then mount it again on /home

Before delete it, be sure you have a backup or at least double check that the new home is working fine and have all the data.

Also start nginx and apache2 :wink:

If you use rsync -aAXS all should be fine but you can rebuild all the users, it won’t hurt.

Note: I didn’t test it so if you finally do the move, let us know how well it worked.

Good luck :four_leaf_clover:

I have just gone through this process following this guide from another post I found.

I have done it, but having issues with backup, was going to create new post. But will post here since relevant.

As you can see I now have plent of space available:

image

But when I try to do a backup I get this error:

Not enough disk space available (179 mb) to perform the backup of mywebsite. ( 11686 mb * 2 = 23372 mb). https://hestiacp.com/docs/server-administration/backup-restore.html

I have restarted the server but no change, It’s like it’s still looking at wrong drive or something?

I have vda1 which it the OS root file system which was 25GB and vdb1 which is the new disk where I have moved and mounted the home directory to.

Keep in mind that Hestia will still use /backup dir for backups (even if you are using an external storage due Hestia must create the backup in that dir before sending it to external storage).

1 Like

Thanks a lot for your advice, I will follow your suggestions and let you know the result

1 Like

One of the reasons why I need to move /home to a volume is that I do not have space to do backups.

The backup is done on /backup which I intend to keep on the operating system drive. After moving the /home from the operating system to another volume and then delete the old /home data in the operating system drive I expect to stop having issues when doing backups but your reply concerned me about this.

Does this mean that when backup is performed the disk space available is calculated where the /home folder is instead of calculating where the /backup folder is or did you move the /backup to the new volume as well?

I believe the line 181 of v-backup-users with the code

let v_disk=$(echo "$(stat -f --format='%a*%S' $BACKUP) / 1024 / 1024" | bc)

calculates the available disk space on the drive where the /backup is located and not on the drive where the user folder is located

That’s in new Hestia version, in current Hestia version 1.8.11 it does this (in your case will obtain the same result):

let v_disk=$(($(stat -f --format="%a*%S" $BACKUP)))/1024/1024

But yes, below statement is true.

2 Likes