ubuntu / zsys

ZSys daemon and client for zfs systems
GNU General Public License v3.0
302 stars 43 forks source link

Migrate existing user dir to zsys #167

Open hcw70 opened 4 years ago

hcw70 commented 4 years ago

Describe the bug How can i migrate existing user dir to zsys?

I have a dpool/home/hcw home folder migrated into a fresh ubuntu 20.04 install by putting that data under rpool/USERDATA/home/hcw. However, userdata does not seem to work for that new dataset.

zsysctrl show does only show the ubuntu-created users (there i had created a user hcw, but renamed / moved the dataset).

To Reproduce Steps to reproduce the behavior:

  1. Install ubuntu 20.04 via "zfs root install" expert / experimental option
  2. Create a user "hcw" during install.
  3. After install move the rpool/USERDATA/hcw_9y5x50 away by changing the mountpoint.
  4. After install copy the other pools dpool/home/hcw to rpool/USERDATA/home/hcw (also create rpool/USERDATA/home).

Expected behavior A documentation should exist how zsys detects user data and how to set up to migrate existing user datasets.

didrocks commented 4 years ago

There is a series of blog post explaining the metadata needed on the user datasets in https://didrocks.fr/2020/06/19/zfs-focus-on-ubuntu-20.04-lts-zsys-properties-on-zfs-datasets/. If you want to write a documentation from that, I’m happy to publish it to the wiki. It can be an excellent first contribution!

hcw70 commented 4 years ago

Thanks for the link, this was something i was looking for. Maybe add the link to the doc?

What i did was:

hcw@nvidion:~$ sudo zfs set com.ubuntu.zsys:last-used=1601021912 rpool/USERDATA/home
hcw@nvidion:~$ sudo zfs set com.ubuntu.zsys:last-used=1601021912 rpool/USERDATA/home/hcw
hcw@nvidion:~$ sudo zfs set com.ubuntu.zsys:last-used=1601021912 rpool/USERDATA/home/hcw/.ccache
hcw@nvidion:~$ sudo zfs set com.ubuntu.zsys:bootfs-datasets=rpool/ROOT/ubuntu_nci4g3 rpool/USERDATA/home
hcw@nvidion:~$ sudo zfs set com.ubuntu.zsys:bootfs-datasets=rpool/ROOT/ubuntu_nci4g3 rpool/USERDATA/home/hcw
hcw@nvidion:~$ sudo zfs set com.ubuntu.zsys:bootfs-datasets=rpool/ROOT/ubuntu_nci4g3 rpool/USERDATA/home/hcw/.ccache 

And now the "rpool/USERDATA/home" shows up in the zsysctl show output, but not the other (child datasets)....


  – Name:    home
    Verlauf: 
     - rpool/USERDATA/home@--head-- (2019-12-09 10:36:37)

Any hints on this?

hcw70 commented 4 years ago

Is a hierarchy in such data sets supported by zsys for home folders?

The reason for this zfs layout is to be able to define zfs properties common for all homes, then define the user home folder as a child to inherit common home flags...

hcw70 commented 4 years ago

Hmm. although zsysctrl show does not list that, zsys has created some snaphots:


hcw@nvidion:~$ zfs get -t snapshot creation rpool/USERDATA/home/hcw
NAME                                     PROPERTY  VALUE                 SOURCE
rpool/USERDATA/home/hcw@autozsys_tcmyip  creation  Fr Sep 25 12:58 2020  -
rpool/USERDATA/home/hcw@autozsys_j64kmp  creation  Fr Sep 25 12:59 2020  -
rpool/USERDATA/home/hcw@autozsys_1v5sg0  creation  Fr Sep 25 13:02 2020  -
rpool/USERDATA/home/hcw@autozsys_n711of  creation  Fr Sep 25 13:03 2020  -
rpool/USERDATA/home/hcw@autozsys_4k3m7m  creation  Fr Sep 25 13:30 2020  -
rpool/USERDATA/home/hcw@autozsys_enz9pa  creation  Fr Sep 25 13:32 2020  -
rpool/USERDATA/home/hcw@autozsys_bomypv  creation  Fr Sep 25 13:43 2020  -