Adding pools and datasets to Ubuntu's default root on ZFS install

Greetings everyone!

I will try to map this out here and hope for some insight into some of these steps.
Dumping zpool history gives me this as a starting point:

History for ‘bpool’:
Not apropos…

History for ‘rpool’:
zpool create -f -o ashift=12 -o autotrim=on -O compression=lz4
-O acltype=posixacl -O xattr=sa -O relatime=on -O normalization=formD
-O mountpoint=/ -O canmount=off -O dnodesize=auto -O sync=disabled
-O mountpoint=/
-R /target rpool /dev/disk/by-partuuid/24c16689-fde2-a347-878c-3540f41b18bc

zfs create rpool/ROOT -o canmount=off -o mountpoint=none
zfs create rpool/ROOT/ubuntu_uy42fh -o mountpoint=/
zfs create rpool/ROOT/ubuntu_uy42fh/var -o canmount=off
zfs create rpool/ROOT/ubuntu_uy42fh/var/lib
zfs create rpool/ROOT/ubuntu_uy42fh/var/lib/AccountsService
zfs create rpool/ROOT/ubuntu_uy42fh/var/lib/apt
zfs create rpool/ROOT/ubuntu_uy42fh/var/lib/dpkg
zfs create rpool/ROOT/ubuntu_uy42fh/var/lib/NetworkManager
zfs create rpool/ROOT/ubuntu_uy42fh/srv
zfs create rpool/ROOT/ubuntu_uy42fh/usr -o canmount=off
zfs create rpool/ROOT/ubuntu_uy42fh/usr/local
zfs create rpool/ROOT/ubuntu_uy42fh/var/games
zfs create rpool/ROOT/ubuntu_uy42fh/var/log
zfs create rpool/ROOT/ubuntu_uy42fh/var/mail
zfs create rpool/ROOT/ubuntu_uy42fh/var/snap
zfs create rpool/ROOT/ubuntu_uy42fh/var/spool
zfs create rpool/ROOT/ubuntu_uy42fh/var/www

zfs create rpool/USERDATA -o canmount=off -o mountpoint=/
zfs set com.ubuntu.zsys:bootfs=yes rpool/ROOT/ubuntu_uy42fh
zfs set com.ubuntu.zsys:last-used=1694264557
rpool/ROOT/ubuntu_uy42fh
zfs set com.ubuntu.zsys:bootfs=no
rpool/ROOT/ubuntu_uy42fh/srv
zfs set com.ubuntu.zsys:bootfs=no
rpool/ROOT/ubuntu_uy42fh/usr
zfs set com.ubuntu.zsys:bootfs=no
rpool/ROOT/ubuntu_uy42fh/var

zfs create rpool/USERDATA/madmike_7ve3c1 -o canmount=on
-o mountpoint=/home/madmike

zfs
set com.ubuntu.zsys:bootfs-datasets=rpool/ROOT/ubuntu_uy42fh
rpool/USERDATA/madmike_7ve3c1
zfs create rpool/USERDATA/root_7ve3c1 -o canmount=on
-o mountpoint=/root
zfs
set com.ubuntu.zsys:bootfs-datasets=rpool/ROOT/ubuntu_uy42fh
rpool/USERDATA/root_7ve3c1
zfs set sync=standard rpool
zpool set cachefile= rpool
zpool export rpool
zpool import -N rpool

/* I fail to this as less work then fdisk and mkfs but lets assume it actually is in the long term… */

History for ‘nvme_pool’:

zpool create -f -o ashift=12 -o autotrim=on -O compression=lz4
-O acltype=posixacl -O xattr=sa -O relatime=on -O normalization=formD
-O mountpoint=/ -O canmount=off -O dnodesize=auto -O sync=disabled
-O mountpoint=/
-R /target nvme_pool /dev/disk/by-id/nvme-eui.0024cf0150005e44

Copy paste from bpool and edit name and disk.

zfs create nvme_pool/HOME -o canmount=off -o mountpoint=none

I think I should be able to just keep the same naming as we are on a different pool and the old one on rpool will be destroyed in the end.

zfs create nvme_pool/USERDATA -o canmount=off -o mountpoint=/

Same as last command line…

zfs create nvme_pool/USERDATA/madmike_7ve3c1 -o canmount=on
-o mountpoint=/home/madmike

Ouch, this may get ugly. Why did it add that random string to my username? I hope I can just leave off the mountpoint untill I can replicate my user data to the new pool.

zfs set com.ubuntu.zsys:bootfs-datasets=nvme_pool/HOME/ubuntu_uy42fh
nvme_pool/USERDATA/madmike_7ve3c1

I have no idea what this does.

zfs set sync=standard nvme_pool
zpool set cachefile= nvme_pool
zpool export nvme_pool
zpool import -N nvme_pool

This sounds like a very complete filesystem rethink and I feel it is a shame Ubuntu has such a limiting set of install options. /rant

Take care everyone, hope all your projects go well.

Edit to add : Sadly this machine died… We also have many more power outages these days so I am going to attempt to rebuild almost everything with a bunch of pi 5s seeing as my codebase compiles on that lil box in 26 seconds or 16 using distcc and 2 pi’s. I will no doubt revisit this filesystem but there is new stuff to learn first. All the best everyone, take care.

2 Likes

This topic was automatically closed 273 days after the last reply. New replies are no longer allowed.