Beadm and proper ZFS structure

Hello

I want to try the sysutils/beadm tool but found that my ZFS structure is far from ideal.
Code:
NAME  USED  AVAIL  REFER  MOUNTPOINT
zdata/home  943G  765G  943G  /home
zroot  14.1G  68.1G  144K  none
zroot/ROOT  2.10G  68.1G  144K  none
zroot/ROOT/default  2.10G  68.1G  1.18G  /
zroot/tmp  47.4M  68.1G  312K  /tmp
zroot/usr  11.6G  68.1G  380M  /usr
zroot/usr/local  2.93G  68.1G  2.77G  /usr/local
zroot/usr/obj  4.13G  68.1G  4.13G  /usr/obj
zroot/usr/ports  3.65G  68.1G  909M  /usr/ports
zroot/usr/ports/distfiles  2.75G  68.1G  2.73G  /usr/ports/distfiles
zroot/usr/ports/packages  432K  68.1G  144K  /usr/ports/packages
zroot/usr/src  547M  68.1G  545M  /usr/src
zroot/var  314M  68.1G  26.7M  /var
zroot/var/crash  156K  68.1G  148K  /var/crash
zroot/var/db  284M  68.1G  235M  /var/db
zroot/var/db/pkg  47.5M  68.1G  39.0M  /var/db/pkg
zroot/var/empty  144K  68.1G  144K  /var/empty
zroot/var/log  1012K  68.1G  452K  /var/log
zroot/var/mail  320K  68.1G  144K  /var/mail
zroot/var/run  1.04M  68.1G  348K  /var/run
zroot/var/tmp  472K  68.1G  156K  /var/tmp

sysutils/beadm will work, but some critical directories will be out of scope as it expects everything not shared between BE be under zroot/ROOT.

I'm scared to break my desktop, so I'd like to ask more experienced users about my next steps.

  1. Should I flatten my ZFS dataset structure?
  2. Am I right that technically I need to create recursive snapshots of zroot/var and zroot/usr and send them on top of zroot/ROOT/default? Something like
    zfs snapshot zroot/usr@migr
    zfs send -R zroot/usr@migr | zfs recv zroot/ROOT/default/usr
    Then, check the new mountpoint to be correct, drop zroot/usr and reboot?
 
Well, there's no "the right answer" as it depends what you want to achieve. I use the following setup:

zfs list -r rpool
Code:
NAME  USED  AVAIL  REFER  MOUNTPOINT
rpool  58.4G  122G  31K  none
rpool/ROOT  3.31G  122G  31K  none
rpool/ROOT/10g  188K  122G  855M  /
rpool/ROOT/10g/usr  48K  122G  921M  /usr
rpool/ROOT/10g/usr/src  1K  122G  359M  /usr/src
rpool/ROOT/10g/var  140K  122G  490M  /var
rpool/ROOT/10gu1  3.31G  122G  586M  /
rpool/ROOT/10gu1/usr  1.69G  122G  612M  /usr
rpool/ROOT/10gu1/usr/src  361M  122G  359M  /usr/src
rpool/ROOT/10gu1/var  749M  122G  643M  /var
rpool/empty  31K  122G  31K  /var/empty
rpool/home  3.90G  122G  3.90G  /home
rpool/hq  46K  122G  46K  /hq
rpool/local  5.44M  122G  5.44M  /local
rpool/ports  1.61G  122G  1.61G  /usr/ports
rpool/swap  49.5G  157G  14.2G  -
rpool/tmp  14.4M  122G  14.4M  /tmp
I want to keep / /usr /usr/src /var related to each boot environment. Others are considered (in my standards) as not system dependent.

Yes, you can use the send/receive to copy the filesets. Remove the old filesets after you have successfully migrated to new setup, not before.
 
You can also use zfs rename to move the datasets around but it's best to do that in single user mode with only the root dataset (zroot/ROOT/default in your case) mounted. Something like:

zfs rename zroot/usr zroot/ROOT/default/usr
 
Oh, zfs rename is definitely the best solution, but I just booted up after the zfs send/zfs recv scenario. It worked for me as well.
 
Back
Top