Moving Home directories

Hello, I want to increase the size of the disk but my hosting provider doesn’t easily let me do that. Instead I want to deploy a new disk /dev/vdc1

So I can move SOME of the clients to that new disk

I would mount /disk2/home/

Will it work if i just? :
service exim stop
service dovecot stop
cp -a $origin $destination
rm -Rf $origin
ln -s $destination $origin
service exim start
service dovecot start

maybe, never tested :slight_smile:, let us know how it went.

I am not sure i give the solution

How about you stop the hestia services
And you make symlink the home directory
You adding or mount new disk
Letsay the new disk is put on

/mnt/[newdisk]

The symlink

/home -> /mnt/[newdisk]/home

Let me know if it works :grin:

@jtdoank thank you very much for your reply. I am pretty sure your trick will work with ALL the domains.

But I need to move half of the domains or duplicate disk costs and do not use the main drive.

Could cause issues with adding new users / deleting older users… As it still tries to delete them from the old /home/ folder…

aaa, okay…the best way is move all isn’t?

Probaly best solution would be to expand the filesystem with lvm or a similar filebased system. So you would have one partition which can be expanded over multiple files.

1 Like

Or move the whole home folder to the new added drive.

1 Like

So I would have to delete users via command line or make a wipe script if they have moved:

  • from /home/user/
  • to /disk2/user
    Or maybe “undo changes” before deleting an user.

Excellent and elegant solution. Widely documented for debian. I am seriously considering this approach if the symlink approach fails.

Don’t use symlink, there are to much potential issues. Filesystembased will or should always work.

hehe, just try it got operation not permited

Summary
Summary

so what i do is
mounting new disk/volume
then
create new directory such as “newhome”
and i rsync home folder with newhome
the last one is
mounting folder “newhome” inside newdisk/volume as home folder
set the /etc/fstab
so when the rebooting the mount newhome will stay :grin: not lose

and it works
but cannot some clients it move all the clients

in return i got new space and big storage for home folder :grin::v:

wait…it seems got problem…hehehehe
let me tested again

so the step above is not completely wrong
but must be carefull and recheck one by one
but should stop all services before continue

the most better way is before you set up hestia better you mount it first
and it works :grin::v:

Thank you very much guys for your input.

I finally found the time to do it.

Although @ScIT had a wonderful idea, I took my risks with a variant of @jtdoank because lvm does not allow to downsize easily.

#I ommited the test parts that check if origin is a symlink and if destination has not been previously created.
#set origin and destination
origen="/home/$1"
destino="/home2/$1"
origenb="$origen/"
destinob="$destino/"
#stop all services
#/usr/local/hestia/bin/v-list-sys-services | grep running |  cut -d" " -f1 | xargs -I {} sh -c "echo 'Parando {}'; service {} stop; echo 'Fin.'"
#stop some services (I tried with all and took very long) I am also not hosting websites in that server.
service bind9 stop
service dovecot stop
service exim4 stop
#copy files to destination
mkdir $destino
rsync -alH $origenb $destino
#remove files on origin
chattr -i $origen/conf
rm -Rf $origen
#create link
ln -s $destino $origen
#start all stopped services
/usr/local/hestia/bin/v-list-sys-services | grep stopped |  cut -d" " -f1 | xargs -I {} sh -c "echo 'Iniciando {}'; service {} start; echo 'Fin.'"

For now, all my tests seem to work.

___ EDIT ____

Problem1:
Okay. Had trouble with permissions and bind.
Very subtle stuff. Migrated DNS zones didn’t load correctly.

Fix:

  • EDIT /etc/apparmor.d/local/usr.sbin.named
  • ADD LINE: /home2/** rwm,

Problem2: Maybe unrelated
rc-local.service didn’t load upon restart.

Fix:

  • EDIT: /etc/systemd/system/rc-local.service

  • ADD:

    [Unit]
    Description=/etc/rc.local Compatibility
    ConditionPathExists=/etc/rc.local
    [Service]
    Type=forking
    ExecStart=/etc/rc.local start
    TimeoutSec=0
    StandardOutput=tty
    RemainAfterExit=yes
    SysVStartPriority=99
    [Install]
    WantedBy=multi-user.target

systemctl start rc-local.service
systemctl status rc-local.service

Look for green line saying: Active: active (running)

This is my approach in note form

  • Add new volume. Mount in temporary directory eg /home2/
  • rsync home to home2
  • Check things. Permissions, file counts, etc.
  • Add new volume to /etc/fstab so it mounts as /home/ on reboot.
  • Final rsync and immediate reboot.
  • Check where volumes are mounted with mount, df, du.
2 Likes

mount volume
mkdir home2
rsync home to home2
etc fstab
delete home
symlinks