How do I move /home/user to a zfs pool?
up vote
3
down vote
favorite
ubuntu 14.04 installed on 128Gb ssd
zfs pool ("zfshome") across 3x3TB disks, containing audio/video/tv etc.
I originally built this as a nas4free NAS serving my windows boxes around the house.I'm now tryin to turn it into a media server,and being always on,wanted the stabilty of ubuntu,(now that it's more user friendly, in terms of normal users...)
Tt seems to me that putting /home/user on the zpool made sense,(being a newby I do frequent reinstalls), but after a week I cannot find clear instructions how to achieve it, and after so many attempts am thoroughly confused.
Any help appreciated,
Ian
home-directory zfs
add a comment |
up vote
3
down vote
favorite
ubuntu 14.04 installed on 128Gb ssd
zfs pool ("zfshome") across 3x3TB disks, containing audio/video/tv etc.
I originally built this as a nas4free NAS serving my windows boxes around the house.I'm now tryin to turn it into a media server,and being always on,wanted the stabilty of ubuntu,(now that it's more user friendly, in terms of normal users...)
Tt seems to me that putting /home/user on the zpool made sense,(being a newby I do frequent reinstalls), but after a week I cannot find clear instructions how to achieve it, and after so many attempts am thoroughly confused.
Any help appreciated,
Ian
home-directory zfs
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
ubuntu 14.04 installed on 128Gb ssd
zfs pool ("zfshome") across 3x3TB disks, containing audio/video/tv etc.
I originally built this as a nas4free NAS serving my windows boxes around the house.I'm now tryin to turn it into a media server,and being always on,wanted the stabilty of ubuntu,(now that it's more user friendly, in terms of normal users...)
Tt seems to me that putting /home/user on the zpool made sense,(being a newby I do frequent reinstalls), but after a week I cannot find clear instructions how to achieve it, and after so many attempts am thoroughly confused.
Any help appreciated,
Ian
home-directory zfs
ubuntu 14.04 installed on 128Gb ssd
zfs pool ("zfshome") across 3x3TB disks, containing audio/video/tv etc.
I originally built this as a nas4free NAS serving my windows boxes around the house.I'm now tryin to turn it into a media server,and being always on,wanted the stabilty of ubuntu,(now that it's more user friendly, in terms of normal users...)
Tt seems to me that putting /home/user on the zpool made sense,(being a newby I do frequent reinstalls), but after a week I cannot find clear instructions how to achieve it, and after so many attempts am thoroughly confused.
Any help appreciated,
Ian
home-directory zfs
home-directory zfs
asked Oct 8 '15 at 3:29
nodsa
164
164
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
2
down vote
YMMV. Make sure anything said below makes sense to you.
Ensure that you can
login
, via at least one admin-enabled account (can manage ZFS), when the NAS is down.Copy, via
tar
orrsync
(notcp
) all of your oldHOME
directory (/home/you
) to the newHOME
directory, mounted some temporary place line/media/$USER/newhome
.Backup, then edit
/etc/fstab
toNFS
mount the appropriateNAS
directory as/home/you
. Seeman fstab
aboutNFS
mounts,man mount
, too. Use theauto
option. Do NOT mount it yet.Carefully delete most of the files/directories in your old
HOME
directory, just leaving enough of the structure so that you canlogin
with the files here, in case themount
fails.logout
andlogin
to verify what you did in step 4.
If all seems OK, mount the
NAS
HOME
directory via:
sudo mount /home/you
sudo shutdown -r now
to reboot your system, make all processes forget about your old$HOME
, and start over with/home/you
mounted.
thanks for responding , but I 'm confused,the zpool is on the same pc as the /home/user I want to move...and from all I've read zfs automounts on boot so fstab shouldnt be involved .I've been creating th new directory with.........sudo zfs create zfshome/newhomez.......and then,
– nodsa
Oct 8 '15 at 9:45
..and then,...sudo zfs setmountpoint=/home zfshome/newhomez ......and then............sudo usermod -m -d /zfshome/newhomez user
– nodsa
Oct 8 '15 at 9:54
add a comment |
up vote
1
down vote
How to move /home directory into a ZFS pool on Linux Mint 19XFCE-64bit
Reference: https://freedompenguin.com/articles/how-to/move-linux-home-zfs/
This procedure has been tested on a guest Linux Mint 19XFCE 64bit inside VirtualBox V5.2.22
Host system Linux Mint 18 KDE 64 bit
Anything described below refers to the guest OS.
Procedure is not 100% step by step. Some steps are described giving their gobal meaning, not
going in deep details.
Every time it will be mentioned the word “user” it means YOUR user directory name (for example instead of /home/user/Documents put /home/jonathan/Documents where jonathan is an example name)
Following procedure is valid for one single user.
Last, but not less important, forgive my english. I am italian.
Procedure
installation of zfs utils by terminal
sudo apt install zfsutils-linux
By using G-Parted:
Reduce the only available partition to a reasonable value (let’s say 20-25 Gbyte).
On free space created by previous step, create a new partition NOT formatted.
By file browser, go to /dev/disk/by-id/ and take note of second partition name. Such partition is that one just created (NOT formatted) that will host ZFS pool dedicated to /home directory.
In my case, second partition name was ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
You will see such name in the pool creation sintax here below.
Now we create the zhome pool using the partition 2 NOT formatted we just created.
By terminal
zp=zhome
sudo zpool create -o ashift=12 -o autoexpand=on -o autoreplace=on -O atime=off -O compression=lz4 $zp /dev/disk/by-id/ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
The detailed meaning of different parameters can be found in the reference article mentioned at the beginning.
Now we must backup directory /home/user/ into a temporary directory such as /tmp/user-bck/
By terminal
sudo rsync -avh /home/user/ /tmp/user-bck/
Now we must erase directory /home
I don’t know why, but command must be given twice to succeed (first time it warns "directory is not empty"...)
By terminal
sudo rm -r -f /home
sudo rm -r -f /home
SOME NOTES
1)
it is a good thing having ZFS Datasets instead of IMPORTANT directories.
That because it will allow to take selective snapshots SPECIFIC for each directory.
VERY useful, just to mention, in case of Each virtual machine directory...
2)
Each dataset is seen by file browser as a NORMAL directory.
So, inside of it, we can then create whatever subdirectories we want.
BUT IT IS FORBIDDEN to create a ZFS Dataset in this way: pool/dataset1/directory/dataset2
3) Snapshots apply to datasets only, NOT to directories…
Now let’s create EVERY ZFS Datasets with EXACTLY the same name as /home/user directories (Documents, Music, etc.) Be carefull: I translated the names of directories from italian to english. Please, make sure of the sintax (Documents, Pictures, Music, etc.)
By terminal
sudo zfs create -o sharesmb=off $zp/home
sudo zfs create $zp/home/user
sudo zfs create $zp/home/user/Documents
sudo zfs create $zp/home/user/Pictures
sudo zfs create $zp/home/user/Music
sudo zfs create $zp/home/user/Video
sudo zfs create $zp/home/user/Models
sudo zfs create $zp/home/user/Download
sudo zfs create $zp/home/user/Desktop
Now we give (immediate and permanent) instruction to ZFS about mount point of the pool zhome/home.
Mount is performed immediately and will be performed on every boot.
By terminal
sudo zfs set mountpoint=/home $zp/home
Now we must restore /home/user backup and place it into the new, EMPTY, just mounted, /home directory.
By terminal
sudo rsync -avh --ignore-existing /tmp/user-bck/ /home/user/
Option –ignore-existing is given to avoid overwriting of directories on the same-name ZFS Datasets (Documents, Music, etc.)
Now reboot system
By terminal
sudo reboot
Tested on 21 Novembre 2018 ore 22:30.
Regards
Michele
New contributor
add a comment |
up vote
0
down vote
zstore is pool, ian is user1
logged in as user1 do;
.....create user2 with admin priveliges
.....create new folder
sudo mkdir /temphome
....move user2's home.....
sudo usermod -m -d /temphome/user2 user2
..reboot...
....login as user2
....move user1's home
sudo usermod -m -d /temphome/user1 user1
...create empty dataset
sudo zfs create zstore/zhome
..as /home is now empty, mount new dataset in/home
sudo zfs set mountpoint=/home zstore/zhome
...move user1's home back to /home
sudo usermod -m -d /home/user1 user1
...reboot ..
login as user1
...move user2's home from temp back to /home
sudo usermod -m -d /home/user2 user2
...tidy up
sudo rmdir /tmphome
all done,
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
YMMV. Make sure anything said below makes sense to you.
Ensure that you can
login
, via at least one admin-enabled account (can manage ZFS), when the NAS is down.Copy, via
tar
orrsync
(notcp
) all of your oldHOME
directory (/home/you
) to the newHOME
directory, mounted some temporary place line/media/$USER/newhome
.Backup, then edit
/etc/fstab
toNFS
mount the appropriateNAS
directory as/home/you
. Seeman fstab
aboutNFS
mounts,man mount
, too. Use theauto
option. Do NOT mount it yet.Carefully delete most of the files/directories in your old
HOME
directory, just leaving enough of the structure so that you canlogin
with the files here, in case themount
fails.logout
andlogin
to verify what you did in step 4.
If all seems OK, mount the
NAS
HOME
directory via:
sudo mount /home/you
sudo shutdown -r now
to reboot your system, make all processes forget about your old$HOME
, and start over with/home/you
mounted.
thanks for responding , but I 'm confused,the zpool is on the same pc as the /home/user I want to move...and from all I've read zfs automounts on boot so fstab shouldnt be involved .I've been creating th new directory with.........sudo zfs create zfshome/newhomez.......and then,
– nodsa
Oct 8 '15 at 9:45
..and then,...sudo zfs setmountpoint=/home zfshome/newhomez ......and then............sudo usermod -m -d /zfshome/newhomez user
– nodsa
Oct 8 '15 at 9:54
add a comment |
up vote
2
down vote
YMMV. Make sure anything said below makes sense to you.
Ensure that you can
login
, via at least one admin-enabled account (can manage ZFS), when the NAS is down.Copy, via
tar
orrsync
(notcp
) all of your oldHOME
directory (/home/you
) to the newHOME
directory, mounted some temporary place line/media/$USER/newhome
.Backup, then edit
/etc/fstab
toNFS
mount the appropriateNAS
directory as/home/you
. Seeman fstab
aboutNFS
mounts,man mount
, too. Use theauto
option. Do NOT mount it yet.Carefully delete most of the files/directories in your old
HOME
directory, just leaving enough of the structure so that you canlogin
with the files here, in case themount
fails.logout
andlogin
to verify what you did in step 4.
If all seems OK, mount the
NAS
HOME
directory via:
sudo mount /home/you
sudo shutdown -r now
to reboot your system, make all processes forget about your old$HOME
, and start over with/home/you
mounted.
thanks for responding , but I 'm confused,the zpool is on the same pc as the /home/user I want to move...and from all I've read zfs automounts on boot so fstab shouldnt be involved .I've been creating th new directory with.........sudo zfs create zfshome/newhomez.......and then,
– nodsa
Oct 8 '15 at 9:45
..and then,...sudo zfs setmountpoint=/home zfshome/newhomez ......and then............sudo usermod -m -d /zfshome/newhomez user
– nodsa
Oct 8 '15 at 9:54
add a comment |
up vote
2
down vote
up vote
2
down vote
YMMV. Make sure anything said below makes sense to you.
Ensure that you can
login
, via at least one admin-enabled account (can manage ZFS), when the NAS is down.Copy, via
tar
orrsync
(notcp
) all of your oldHOME
directory (/home/you
) to the newHOME
directory, mounted some temporary place line/media/$USER/newhome
.Backup, then edit
/etc/fstab
toNFS
mount the appropriateNAS
directory as/home/you
. Seeman fstab
aboutNFS
mounts,man mount
, too. Use theauto
option. Do NOT mount it yet.Carefully delete most of the files/directories in your old
HOME
directory, just leaving enough of the structure so that you canlogin
with the files here, in case themount
fails.logout
andlogin
to verify what you did in step 4.
If all seems OK, mount the
NAS
HOME
directory via:
sudo mount /home/you
sudo shutdown -r now
to reboot your system, make all processes forget about your old$HOME
, and start over with/home/you
mounted.
YMMV. Make sure anything said below makes sense to you.
Ensure that you can
login
, via at least one admin-enabled account (can manage ZFS), when the NAS is down.Copy, via
tar
orrsync
(notcp
) all of your oldHOME
directory (/home/you
) to the newHOME
directory, mounted some temporary place line/media/$USER/newhome
.Backup, then edit
/etc/fstab
toNFS
mount the appropriateNAS
directory as/home/you
. Seeman fstab
aboutNFS
mounts,man mount
, too. Use theauto
option. Do NOT mount it yet.Carefully delete most of the files/directories in your old
HOME
directory, just leaving enough of the structure so that you canlogin
with the files here, in case themount
fails.logout
andlogin
to verify what you did in step 4.
If all seems OK, mount the
NAS
HOME
directory via:
sudo mount /home/you
sudo shutdown -r now
to reboot your system, make all processes forget about your old$HOME
, and start over with/home/you
mounted.
answered Oct 8 '15 at 7:24
waltinator
21.6k74169
21.6k74169
thanks for responding , but I 'm confused,the zpool is on the same pc as the /home/user I want to move...and from all I've read zfs automounts on boot so fstab shouldnt be involved .I've been creating th new directory with.........sudo zfs create zfshome/newhomez.......and then,
– nodsa
Oct 8 '15 at 9:45
..and then,...sudo zfs setmountpoint=/home zfshome/newhomez ......and then............sudo usermod -m -d /zfshome/newhomez user
– nodsa
Oct 8 '15 at 9:54
add a comment |
thanks for responding , but I 'm confused,the zpool is on the same pc as the /home/user I want to move...and from all I've read zfs automounts on boot so fstab shouldnt be involved .I've been creating th new directory with.........sudo zfs create zfshome/newhomez.......and then,
– nodsa
Oct 8 '15 at 9:45
..and then,...sudo zfs setmountpoint=/home zfshome/newhomez ......and then............sudo usermod -m -d /zfshome/newhomez user
– nodsa
Oct 8 '15 at 9:54
thanks for responding , but I 'm confused,the zpool is on the same pc as the /home/user I want to move...and from all I've read zfs automounts on boot so fstab shouldnt be involved .I've been creating th new directory with.........sudo zfs create zfshome/newhomez.......and then,
– nodsa
Oct 8 '15 at 9:45
thanks for responding , but I 'm confused,the zpool is on the same pc as the /home/user I want to move...and from all I've read zfs automounts on boot so fstab shouldnt be involved .I've been creating th new directory with.........sudo zfs create zfshome/newhomez.......and then,
– nodsa
Oct 8 '15 at 9:45
..and then,...sudo zfs setmountpoint=/home zfshome/newhomez ......and then............sudo usermod -m -d /zfshome/newhomez user
– nodsa
Oct 8 '15 at 9:54
..and then,...sudo zfs setmountpoint=/home zfshome/newhomez ......and then............sudo usermod -m -d /zfshome/newhomez user
– nodsa
Oct 8 '15 at 9:54
add a comment |
up vote
1
down vote
How to move /home directory into a ZFS pool on Linux Mint 19XFCE-64bit
Reference: https://freedompenguin.com/articles/how-to/move-linux-home-zfs/
This procedure has been tested on a guest Linux Mint 19XFCE 64bit inside VirtualBox V5.2.22
Host system Linux Mint 18 KDE 64 bit
Anything described below refers to the guest OS.
Procedure is not 100% step by step. Some steps are described giving their gobal meaning, not
going in deep details.
Every time it will be mentioned the word “user” it means YOUR user directory name (for example instead of /home/user/Documents put /home/jonathan/Documents where jonathan is an example name)
Following procedure is valid for one single user.
Last, but not less important, forgive my english. I am italian.
Procedure
installation of zfs utils by terminal
sudo apt install zfsutils-linux
By using G-Parted:
Reduce the only available partition to a reasonable value (let’s say 20-25 Gbyte).
On free space created by previous step, create a new partition NOT formatted.
By file browser, go to /dev/disk/by-id/ and take note of second partition name. Such partition is that one just created (NOT formatted) that will host ZFS pool dedicated to /home directory.
In my case, second partition name was ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
You will see such name in the pool creation sintax here below.
Now we create the zhome pool using the partition 2 NOT formatted we just created.
By terminal
zp=zhome
sudo zpool create -o ashift=12 -o autoexpand=on -o autoreplace=on -O atime=off -O compression=lz4 $zp /dev/disk/by-id/ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
The detailed meaning of different parameters can be found in the reference article mentioned at the beginning.
Now we must backup directory /home/user/ into a temporary directory such as /tmp/user-bck/
By terminal
sudo rsync -avh /home/user/ /tmp/user-bck/
Now we must erase directory /home
I don’t know why, but command must be given twice to succeed (first time it warns "directory is not empty"...)
By terminal
sudo rm -r -f /home
sudo rm -r -f /home
SOME NOTES
1)
it is a good thing having ZFS Datasets instead of IMPORTANT directories.
That because it will allow to take selective snapshots SPECIFIC for each directory.
VERY useful, just to mention, in case of Each virtual machine directory...
2)
Each dataset is seen by file browser as a NORMAL directory.
So, inside of it, we can then create whatever subdirectories we want.
BUT IT IS FORBIDDEN to create a ZFS Dataset in this way: pool/dataset1/directory/dataset2
3) Snapshots apply to datasets only, NOT to directories…
Now let’s create EVERY ZFS Datasets with EXACTLY the same name as /home/user directories (Documents, Music, etc.) Be carefull: I translated the names of directories from italian to english. Please, make sure of the sintax (Documents, Pictures, Music, etc.)
By terminal
sudo zfs create -o sharesmb=off $zp/home
sudo zfs create $zp/home/user
sudo zfs create $zp/home/user/Documents
sudo zfs create $zp/home/user/Pictures
sudo zfs create $zp/home/user/Music
sudo zfs create $zp/home/user/Video
sudo zfs create $zp/home/user/Models
sudo zfs create $zp/home/user/Download
sudo zfs create $zp/home/user/Desktop
Now we give (immediate and permanent) instruction to ZFS about mount point of the pool zhome/home.
Mount is performed immediately and will be performed on every boot.
By terminal
sudo zfs set mountpoint=/home $zp/home
Now we must restore /home/user backup and place it into the new, EMPTY, just mounted, /home directory.
By terminal
sudo rsync -avh --ignore-existing /tmp/user-bck/ /home/user/
Option –ignore-existing is given to avoid overwriting of directories on the same-name ZFS Datasets (Documents, Music, etc.)
Now reboot system
By terminal
sudo reboot
Tested on 21 Novembre 2018 ore 22:30.
Regards
Michele
New contributor
add a comment |
up vote
1
down vote
How to move /home directory into a ZFS pool on Linux Mint 19XFCE-64bit
Reference: https://freedompenguin.com/articles/how-to/move-linux-home-zfs/
This procedure has been tested on a guest Linux Mint 19XFCE 64bit inside VirtualBox V5.2.22
Host system Linux Mint 18 KDE 64 bit
Anything described below refers to the guest OS.
Procedure is not 100% step by step. Some steps are described giving their gobal meaning, not
going in deep details.
Every time it will be mentioned the word “user” it means YOUR user directory name (for example instead of /home/user/Documents put /home/jonathan/Documents where jonathan is an example name)
Following procedure is valid for one single user.
Last, but not less important, forgive my english. I am italian.
Procedure
installation of zfs utils by terminal
sudo apt install zfsutils-linux
By using G-Parted:
Reduce the only available partition to a reasonable value (let’s say 20-25 Gbyte).
On free space created by previous step, create a new partition NOT formatted.
By file browser, go to /dev/disk/by-id/ and take note of second partition name. Such partition is that one just created (NOT formatted) that will host ZFS pool dedicated to /home directory.
In my case, second partition name was ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
You will see such name in the pool creation sintax here below.
Now we create the zhome pool using the partition 2 NOT formatted we just created.
By terminal
zp=zhome
sudo zpool create -o ashift=12 -o autoexpand=on -o autoreplace=on -O atime=off -O compression=lz4 $zp /dev/disk/by-id/ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
The detailed meaning of different parameters can be found in the reference article mentioned at the beginning.
Now we must backup directory /home/user/ into a temporary directory such as /tmp/user-bck/
By terminal
sudo rsync -avh /home/user/ /tmp/user-bck/
Now we must erase directory /home
I don’t know why, but command must be given twice to succeed (first time it warns "directory is not empty"...)
By terminal
sudo rm -r -f /home
sudo rm -r -f /home
SOME NOTES
1)
it is a good thing having ZFS Datasets instead of IMPORTANT directories.
That because it will allow to take selective snapshots SPECIFIC for each directory.
VERY useful, just to mention, in case of Each virtual machine directory...
2)
Each dataset is seen by file browser as a NORMAL directory.
So, inside of it, we can then create whatever subdirectories we want.
BUT IT IS FORBIDDEN to create a ZFS Dataset in this way: pool/dataset1/directory/dataset2
3) Snapshots apply to datasets only, NOT to directories…
Now let’s create EVERY ZFS Datasets with EXACTLY the same name as /home/user directories (Documents, Music, etc.) Be carefull: I translated the names of directories from italian to english. Please, make sure of the sintax (Documents, Pictures, Music, etc.)
By terminal
sudo zfs create -o sharesmb=off $zp/home
sudo zfs create $zp/home/user
sudo zfs create $zp/home/user/Documents
sudo zfs create $zp/home/user/Pictures
sudo zfs create $zp/home/user/Music
sudo zfs create $zp/home/user/Video
sudo zfs create $zp/home/user/Models
sudo zfs create $zp/home/user/Download
sudo zfs create $zp/home/user/Desktop
Now we give (immediate and permanent) instruction to ZFS about mount point of the pool zhome/home.
Mount is performed immediately and will be performed on every boot.
By terminal
sudo zfs set mountpoint=/home $zp/home
Now we must restore /home/user backup and place it into the new, EMPTY, just mounted, /home directory.
By terminal
sudo rsync -avh --ignore-existing /tmp/user-bck/ /home/user/
Option –ignore-existing is given to avoid overwriting of directories on the same-name ZFS Datasets (Documents, Music, etc.)
Now reboot system
By terminal
sudo reboot
Tested on 21 Novembre 2018 ore 22:30.
Regards
Michele
New contributor
add a comment |
up vote
1
down vote
up vote
1
down vote
How to move /home directory into a ZFS pool on Linux Mint 19XFCE-64bit
Reference: https://freedompenguin.com/articles/how-to/move-linux-home-zfs/
This procedure has been tested on a guest Linux Mint 19XFCE 64bit inside VirtualBox V5.2.22
Host system Linux Mint 18 KDE 64 bit
Anything described below refers to the guest OS.
Procedure is not 100% step by step. Some steps are described giving their gobal meaning, not
going in deep details.
Every time it will be mentioned the word “user” it means YOUR user directory name (for example instead of /home/user/Documents put /home/jonathan/Documents where jonathan is an example name)
Following procedure is valid for one single user.
Last, but not less important, forgive my english. I am italian.
Procedure
installation of zfs utils by terminal
sudo apt install zfsutils-linux
By using G-Parted:
Reduce the only available partition to a reasonable value (let’s say 20-25 Gbyte).
On free space created by previous step, create a new partition NOT formatted.
By file browser, go to /dev/disk/by-id/ and take note of second partition name. Such partition is that one just created (NOT formatted) that will host ZFS pool dedicated to /home directory.
In my case, second partition name was ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
You will see such name in the pool creation sintax here below.
Now we create the zhome pool using the partition 2 NOT formatted we just created.
By terminal
zp=zhome
sudo zpool create -o ashift=12 -o autoexpand=on -o autoreplace=on -O atime=off -O compression=lz4 $zp /dev/disk/by-id/ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
The detailed meaning of different parameters can be found in the reference article mentioned at the beginning.
Now we must backup directory /home/user/ into a temporary directory such as /tmp/user-bck/
By terminal
sudo rsync -avh /home/user/ /tmp/user-bck/
Now we must erase directory /home
I don’t know why, but command must be given twice to succeed (first time it warns "directory is not empty"...)
By terminal
sudo rm -r -f /home
sudo rm -r -f /home
SOME NOTES
1)
it is a good thing having ZFS Datasets instead of IMPORTANT directories.
That because it will allow to take selective snapshots SPECIFIC for each directory.
VERY useful, just to mention, in case of Each virtual machine directory...
2)
Each dataset is seen by file browser as a NORMAL directory.
So, inside of it, we can then create whatever subdirectories we want.
BUT IT IS FORBIDDEN to create a ZFS Dataset in this way: pool/dataset1/directory/dataset2
3) Snapshots apply to datasets only, NOT to directories…
Now let’s create EVERY ZFS Datasets with EXACTLY the same name as /home/user directories (Documents, Music, etc.) Be carefull: I translated the names of directories from italian to english. Please, make sure of the sintax (Documents, Pictures, Music, etc.)
By terminal
sudo zfs create -o sharesmb=off $zp/home
sudo zfs create $zp/home/user
sudo zfs create $zp/home/user/Documents
sudo zfs create $zp/home/user/Pictures
sudo zfs create $zp/home/user/Music
sudo zfs create $zp/home/user/Video
sudo zfs create $zp/home/user/Models
sudo zfs create $zp/home/user/Download
sudo zfs create $zp/home/user/Desktop
Now we give (immediate and permanent) instruction to ZFS about mount point of the pool zhome/home.
Mount is performed immediately and will be performed on every boot.
By terminal
sudo zfs set mountpoint=/home $zp/home
Now we must restore /home/user backup and place it into the new, EMPTY, just mounted, /home directory.
By terminal
sudo rsync -avh --ignore-existing /tmp/user-bck/ /home/user/
Option –ignore-existing is given to avoid overwriting of directories on the same-name ZFS Datasets (Documents, Music, etc.)
Now reboot system
By terminal
sudo reboot
Tested on 21 Novembre 2018 ore 22:30.
Regards
Michele
New contributor
How to move /home directory into a ZFS pool on Linux Mint 19XFCE-64bit
Reference: https://freedompenguin.com/articles/how-to/move-linux-home-zfs/
This procedure has been tested on a guest Linux Mint 19XFCE 64bit inside VirtualBox V5.2.22
Host system Linux Mint 18 KDE 64 bit
Anything described below refers to the guest OS.
Procedure is not 100% step by step. Some steps are described giving their gobal meaning, not
going in deep details.
Every time it will be mentioned the word “user” it means YOUR user directory name (for example instead of /home/user/Documents put /home/jonathan/Documents where jonathan is an example name)
Following procedure is valid for one single user.
Last, but not less important, forgive my english. I am italian.
Procedure
installation of zfs utils by terminal
sudo apt install zfsutils-linux
By using G-Parted:
Reduce the only available partition to a reasonable value (let’s say 20-25 Gbyte).
On free space created by previous step, create a new partition NOT formatted.
By file browser, go to /dev/disk/by-id/ and take note of second partition name. Such partition is that one just created (NOT formatted) that will host ZFS pool dedicated to /home directory.
In my case, second partition name was ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
You will see such name in the pool creation sintax here below.
Now we create the zhome pool using the partition 2 NOT formatted we just created.
By terminal
zp=zhome
sudo zpool create -o ashift=12 -o autoexpand=on -o autoreplace=on -O atime=off -O compression=lz4 $zp /dev/disk/by-id/ata-VBOX_HARDDISK_VB49b2d698-41fa84b3-part2
The detailed meaning of different parameters can be found in the reference article mentioned at the beginning.
Now we must backup directory /home/user/ into a temporary directory such as /tmp/user-bck/
By terminal
sudo rsync -avh /home/user/ /tmp/user-bck/
Now we must erase directory /home
I don’t know why, but command must be given twice to succeed (first time it warns "directory is not empty"...)
By terminal
sudo rm -r -f /home
sudo rm -r -f /home
SOME NOTES
1)
it is a good thing having ZFS Datasets instead of IMPORTANT directories.
That because it will allow to take selective snapshots SPECIFIC for each directory.
VERY useful, just to mention, in case of Each virtual machine directory...
2)
Each dataset is seen by file browser as a NORMAL directory.
So, inside of it, we can then create whatever subdirectories we want.
BUT IT IS FORBIDDEN to create a ZFS Dataset in this way: pool/dataset1/directory/dataset2
3) Snapshots apply to datasets only, NOT to directories…
Now let’s create EVERY ZFS Datasets with EXACTLY the same name as /home/user directories (Documents, Music, etc.) Be carefull: I translated the names of directories from italian to english. Please, make sure of the sintax (Documents, Pictures, Music, etc.)
By terminal
sudo zfs create -o sharesmb=off $zp/home
sudo zfs create $zp/home/user
sudo zfs create $zp/home/user/Documents
sudo zfs create $zp/home/user/Pictures
sudo zfs create $zp/home/user/Music
sudo zfs create $zp/home/user/Video
sudo zfs create $zp/home/user/Models
sudo zfs create $zp/home/user/Download
sudo zfs create $zp/home/user/Desktop
Now we give (immediate and permanent) instruction to ZFS about mount point of the pool zhome/home.
Mount is performed immediately and will be performed on every boot.
By terminal
sudo zfs set mountpoint=/home $zp/home
Now we must restore /home/user backup and place it into the new, EMPTY, just mounted, /home directory.
By terminal
sudo rsync -avh --ignore-existing /tmp/user-bck/ /home/user/
Option –ignore-existing is given to avoid overwriting of directories on the same-name ZFS Datasets (Documents, Music, etc.)
Now reboot system
By terminal
sudo reboot
Tested on 21 Novembre 2018 ore 22:30.
Regards
Michele
New contributor
edited Nov 23 at 1:39
s1mmel
1,099515
1,099515
New contributor
answered Nov 22 at 19:44
Michele
113
113
New contributor
New contributor
add a comment |
add a comment |
up vote
0
down vote
zstore is pool, ian is user1
logged in as user1 do;
.....create user2 with admin priveliges
.....create new folder
sudo mkdir /temphome
....move user2's home.....
sudo usermod -m -d /temphome/user2 user2
..reboot...
....login as user2
....move user1's home
sudo usermod -m -d /temphome/user1 user1
...create empty dataset
sudo zfs create zstore/zhome
..as /home is now empty, mount new dataset in/home
sudo zfs set mountpoint=/home zstore/zhome
...move user1's home back to /home
sudo usermod -m -d /home/user1 user1
...reboot ..
login as user1
...move user2's home from temp back to /home
sudo usermod -m -d /home/user2 user2
...tidy up
sudo rmdir /tmphome
all done,
add a comment |
up vote
0
down vote
zstore is pool, ian is user1
logged in as user1 do;
.....create user2 with admin priveliges
.....create new folder
sudo mkdir /temphome
....move user2's home.....
sudo usermod -m -d /temphome/user2 user2
..reboot...
....login as user2
....move user1's home
sudo usermod -m -d /temphome/user1 user1
...create empty dataset
sudo zfs create zstore/zhome
..as /home is now empty, mount new dataset in/home
sudo zfs set mountpoint=/home zstore/zhome
...move user1's home back to /home
sudo usermod -m -d /home/user1 user1
...reboot ..
login as user1
...move user2's home from temp back to /home
sudo usermod -m -d /home/user2 user2
...tidy up
sudo rmdir /tmphome
all done,
add a comment |
up vote
0
down vote
up vote
0
down vote
zstore is pool, ian is user1
logged in as user1 do;
.....create user2 with admin priveliges
.....create new folder
sudo mkdir /temphome
....move user2's home.....
sudo usermod -m -d /temphome/user2 user2
..reboot...
....login as user2
....move user1's home
sudo usermod -m -d /temphome/user1 user1
...create empty dataset
sudo zfs create zstore/zhome
..as /home is now empty, mount new dataset in/home
sudo zfs set mountpoint=/home zstore/zhome
...move user1's home back to /home
sudo usermod -m -d /home/user1 user1
...reboot ..
login as user1
...move user2's home from temp back to /home
sudo usermod -m -d /home/user2 user2
...tidy up
sudo rmdir /tmphome
all done,
zstore is pool, ian is user1
logged in as user1 do;
.....create user2 with admin priveliges
.....create new folder
sudo mkdir /temphome
....move user2's home.....
sudo usermod -m -d /temphome/user2 user2
..reboot...
....login as user2
....move user1's home
sudo usermod -m -d /temphome/user1 user1
...create empty dataset
sudo zfs create zstore/zhome
..as /home is now empty, mount new dataset in/home
sudo zfs set mountpoint=/home zstore/zhome
...move user1's home back to /home
sudo usermod -m -d /home/user1 user1
...reboot ..
login as user1
...move user2's home from temp back to /home
sudo usermod -m -d /home/user2 user2
...tidy up
sudo rmdir /tmphome
all done,
answered Oct 19 '15 at 13:50
nodsa
164
164
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f682841%2fhow-do-i-move-home-user-to-a-zfs-pool%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown