Migrating /home to ZFS [duplicate]











up vote
0
down vote

favorite













This question already has an answer here:




  • How do I move /home/user to a zfs pool?

    3 answers




I created a zpool, called zstorage, on two mirrored drives, on Ubuntu 18.04. The OS is installed on an SSD, with the /home directory on its own partition on that same SSD. I want to migrate /home to the ZFS pool. As you can see, the pool has been set up and ready - as far as I know. Where do I go from here?



enter image description here



Ordinarily, when moving /home to another drive, one can edit fstab, but ZFS doesn't use fstab. I'm rather stuck at knowing how to move my existing /home to /zstorage/home and how to mount /zstorage/home. The command



sudo zfs set mountpoint=/home zstorage/home



gives me the error



cannot mount '/home': directory is not empty
property may be set but unable to remount filesystem
.










share|improve this question















marked as duplicate by karel, muru, Eric Carvalho, Fabby, Charles Green yesterday


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Please don't use screenshots for terminal output. Instead paste the text into your question, select it with your mouse, and press the {} button in the editor to format it properly.
    – Chai T. Rex
    Oct 7 at 14:02















up vote
0
down vote

favorite













This question already has an answer here:




  • How do I move /home/user to a zfs pool?

    3 answers




I created a zpool, called zstorage, on two mirrored drives, on Ubuntu 18.04. The OS is installed on an SSD, with the /home directory on its own partition on that same SSD. I want to migrate /home to the ZFS pool. As you can see, the pool has been set up and ready - as far as I know. Where do I go from here?



enter image description here



Ordinarily, when moving /home to another drive, one can edit fstab, but ZFS doesn't use fstab. I'm rather stuck at knowing how to move my existing /home to /zstorage/home and how to mount /zstorage/home. The command



sudo zfs set mountpoint=/home zstorage/home



gives me the error



cannot mount '/home': directory is not empty
property may be set but unable to remount filesystem
.










share|improve this question















marked as duplicate by karel, muru, Eric Carvalho, Fabby, Charles Green yesterday


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Please don't use screenshots for terminal output. Instead paste the text into your question, select it with your mouse, and press the {} button in the editor to format it properly.
    – Chai T. Rex
    Oct 7 at 14:02













up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:




  • How do I move /home/user to a zfs pool?

    3 answers




I created a zpool, called zstorage, on two mirrored drives, on Ubuntu 18.04. The OS is installed on an SSD, with the /home directory on its own partition on that same SSD. I want to migrate /home to the ZFS pool. As you can see, the pool has been set up and ready - as far as I know. Where do I go from here?



enter image description here



Ordinarily, when moving /home to another drive, one can edit fstab, but ZFS doesn't use fstab. I'm rather stuck at knowing how to move my existing /home to /zstorage/home and how to mount /zstorage/home. The command



sudo zfs set mountpoint=/home zstorage/home



gives me the error



cannot mount '/home': directory is not empty
property may be set but unable to remount filesystem
.










share|improve this question
















This question already has an answer here:




  • How do I move /home/user to a zfs pool?

    3 answers




I created a zpool, called zstorage, on two mirrored drives, on Ubuntu 18.04. The OS is installed on an SSD, with the /home directory on its own partition on that same SSD. I want to migrate /home to the ZFS pool. As you can see, the pool has been set up and ready - as far as I know. Where do I go from here?



enter image description here



Ordinarily, when moving /home to another drive, one can edit fstab, but ZFS doesn't use fstab. I'm rather stuck at knowing how to move my existing /home to /zstorage/home and how to mount /zstorage/home. The command



sudo zfs set mountpoint=/home zstorage/home



gives me the error



cannot mount '/home': directory is not empty
property may be set but unable to remount filesystem
.





This question already has an answer here:




  • How do I move /home/user to a zfs pool?

    3 answers








zfs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 6 at 9:24

























asked Oct 5 at 17:21









Kelley

19.2k21626




19.2k21626




marked as duplicate by karel, muru, Eric Carvalho, Fabby, Charles Green yesterday


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by karel, muru, Eric Carvalho, Fabby, Charles Green yesterday


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Please don't use screenshots for terminal output. Instead paste the text into your question, select it with your mouse, and press the {} button in the editor to format it properly.
    – Chai T. Rex
    Oct 7 at 14:02


















  • Please don't use screenshots for terminal output. Instead paste the text into your question, select it with your mouse, and press the {} button in the editor to format it properly.
    – Chai T. Rex
    Oct 7 at 14:02
















Please don't use screenshots for terminal output. Instead paste the text into your question, select it with your mouse, and press the {} button in the editor to format it properly.
– Chai T. Rex
Oct 7 at 14:02




Please don't use screenshots for terminal output. Instead paste the text into your question, select it with your mouse, and press the {} button in the editor to format it properly.
– Chai T. Rex
Oct 7 at 14:02










1 Answer
1






active

oldest

votes

















up vote
0
down vote













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.






share|improve this answer























  • You say that first I need to mount the filesystem to something like /zstorage/home, but that's exactly what I tried to do and it wouldn't let me. What am I missing?
    – Kelley
    Oct 8 at 19:50






  • 1




    From your df output, it is mounted top /zstorage/home.
    – Thomas
    Oct 9 at 4:07










  • Right! And that's what I thought, too, but then I got that error message: "cannot mount '/home': directory is not empty" and then "property may be set but unable to remount filesystem."
    – Kelley
    Oct 9 at 14:47










  • Just updated the answer and included the part to move the mountpoint to /home after the copy has been done.
    – Thomas
    Oct 9 at 14:59










  • Thanks for your help! I went ahead and made the attempt, but then was unable to login: it gets as far as having me click on my userid and enter my password, but doesn't accept it. I figure I'll need to wipe out my zpool and start over again. I must have made a mistake somewhere.
    – Kelley
    Oct 10 at 14:51


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













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.






share|improve this answer























  • You say that first I need to mount the filesystem to something like /zstorage/home, but that's exactly what I tried to do and it wouldn't let me. What am I missing?
    – Kelley
    Oct 8 at 19:50






  • 1




    From your df output, it is mounted top /zstorage/home.
    – Thomas
    Oct 9 at 4:07










  • Right! And that's what I thought, too, but then I got that error message: "cannot mount '/home': directory is not empty" and then "property may be set but unable to remount filesystem."
    – Kelley
    Oct 9 at 14:47










  • Just updated the answer and included the part to move the mountpoint to /home after the copy has been done.
    – Thomas
    Oct 9 at 14:59










  • Thanks for your help! I went ahead and made the attempt, but then was unable to login: it gets as far as having me click on my userid and enter my password, but doesn't accept it. I figure I'll need to wipe out my zpool and start over again. I must have made a mistake somewhere.
    – Kelley
    Oct 10 at 14:51















up vote
0
down vote













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.






share|improve this answer























  • You say that first I need to mount the filesystem to something like /zstorage/home, but that's exactly what I tried to do and it wouldn't let me. What am I missing?
    – Kelley
    Oct 8 at 19:50






  • 1




    From your df output, it is mounted top /zstorage/home.
    – Thomas
    Oct 9 at 4:07










  • Right! And that's what I thought, too, but then I got that error message: "cannot mount '/home': directory is not empty" and then "property may be set but unable to remount filesystem."
    – Kelley
    Oct 9 at 14:47










  • Just updated the answer and included the part to move the mountpoint to /home after the copy has been done.
    – Thomas
    Oct 9 at 14:59










  • Thanks for your help! I went ahead and made the attempt, but then was unable to login: it gets as far as having me click on my userid and enter my password, but doesn't accept it. I figure I'll need to wipe out my zpool and start over again. I must have made a mistake somewhere.
    – Kelley
    Oct 10 at 14:51













up vote
0
down vote










up vote
0
down vote









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.






share|improve this answer














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.







share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 9 at 14:58

























answered Oct 7 at 12:14









Thomas

3,45081427




3,45081427












  • You say that first I need to mount the filesystem to something like /zstorage/home, but that's exactly what I tried to do and it wouldn't let me. What am I missing?
    – Kelley
    Oct 8 at 19:50






  • 1




    From your df output, it is mounted top /zstorage/home.
    – Thomas
    Oct 9 at 4:07










  • Right! And that's what I thought, too, but then I got that error message: "cannot mount '/home': directory is not empty" and then "property may be set but unable to remount filesystem."
    – Kelley
    Oct 9 at 14:47










  • Just updated the answer and included the part to move the mountpoint to /home after the copy has been done.
    – Thomas
    Oct 9 at 14:59










  • Thanks for your help! I went ahead and made the attempt, but then was unable to login: it gets as far as having me click on my userid and enter my password, but doesn't accept it. I figure I'll need to wipe out my zpool and start over again. I must have made a mistake somewhere.
    – Kelley
    Oct 10 at 14:51


















  • You say that first I need to mount the filesystem to something like /zstorage/home, but that's exactly what I tried to do and it wouldn't let me. What am I missing?
    – Kelley
    Oct 8 at 19:50






  • 1




    From your df output, it is mounted top /zstorage/home.
    – Thomas
    Oct 9 at 4:07










  • Right! And that's what I thought, too, but then I got that error message: "cannot mount '/home': directory is not empty" and then "property may be set but unable to remount filesystem."
    – Kelley
    Oct 9 at 14:47










  • Just updated the answer and included the part to move the mountpoint to /home after the copy has been done.
    – Thomas
    Oct 9 at 14:59










  • Thanks for your help! I went ahead and made the attempt, but then was unable to login: it gets as far as having me click on my userid and enter my password, but doesn't accept it. I figure I'll need to wipe out my zpool and start over again. I must have made a mistake somewhere.
    – Kelley
    Oct 10 at 14:51
















You say that first I need to mount the filesystem to something like /zstorage/home, but that's exactly what I tried to do and it wouldn't let me. What am I missing?
– Kelley
Oct 8 at 19:50




You say that first I need to mount the filesystem to something like /zstorage/home, but that's exactly what I tried to do and it wouldn't let me. What am I missing?
– Kelley
Oct 8 at 19:50




1




1




From your df output, it is mounted top /zstorage/home.
– Thomas
Oct 9 at 4:07




From your df output, it is mounted top /zstorage/home.
– Thomas
Oct 9 at 4:07












Right! And that's what I thought, too, but then I got that error message: "cannot mount '/home': directory is not empty" and then "property may be set but unable to remount filesystem."
– Kelley
Oct 9 at 14:47




Right! And that's what I thought, too, but then I got that error message: "cannot mount '/home': directory is not empty" and then "property may be set but unable to remount filesystem."
– Kelley
Oct 9 at 14:47












Just updated the answer and included the part to move the mountpoint to /home after the copy has been done.
– Thomas
Oct 9 at 14:59




Just updated the answer and included the part to move the mountpoint to /home after the copy has been done.
– Thomas
Oct 9 at 14:59












Thanks for your help! I went ahead and made the attempt, but then was unable to login: it gets as far as having me click on my userid and enter my password, but doesn't accept it. I figure I'll need to wipe out my zpool and start over again. I must have made a mistake somewhere.
– Kelley
Oct 10 at 14:51




Thanks for your help! I went ahead and made the attempt, but then was unable to login: it gets as far as having me click on my userid and enter my password, but doesn't accept it. I figure I'll need to wipe out my zpool and start over again. I must have made a mistake somewhere.
– Kelley
Oct 10 at 14:51



Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido