First you need to the zstorage/home
filesystem to a different mountpoint like /zstorage/home to transfer the files from /home to /zstorage/home.
To transfer the data, best would be to do this while no user is logged in and you are logged in as root directly to not have any operations in the home directory. To copy the data, use either of the two commands as follows, whereas rsync
is better if the copy process is interrupted and has to be rerun.
cp -a /home/* /zstorage/home/
rsync -axHAX --delete /home/ /zstorage/home/
After the copy process, you can mount the ZFS filesystem to /home, but as you already mentioned ZFS by default rejects mount points that contain something. You can alter that with the command as follows.
zfs set overlay=on zstorage
The property is normally inherited to child filesystems, but you can check it with zfs get overlay zstorage
. Now you should be able to mount the ZFS filesystem on /home
.
To do that, you may want to change the mount point in ZFS as follows.
zfs set mountpoint=/home zstorage/home
It also might be that /home
is a separate mount point, in that case you need to remove, comment or alter the corresponding entry in /etc/fstab.
You also might want to keep the original data and overmount /home while testing your new setup and delete it later when everything is as expected. Just in case something goes wrong or you want to go back.
During boot, the ZFS filesystems should be mounted automatically without the need to configure /etc/fstab.
{}
button in the editor to format it properly. – Chai T. Rex Oct 07 '18 at 14:02