28Feb/150
ZFS dataset hierarchy on a single user machine
# the pool zpool create -o ashift=12 -O mountpoint=none -O atime=off -O snapdir=visible rpool /dev/mapper/crypt_zfs # Create filesystems: rootfs, var and home # rootfs and home has 2 copy of each file as a mirror in single dev. zfs create -o copies=2 -o compress=lz4 -o mountpoint=/ rpool/rootfs zfs create -o copies=2 -o compress=lz4 -o mountpoint=/home rpool/home # var is not a child of rootfs and the zfs daemon will mount it # after systemd creates it, leading to a: cannot mount /var, # dir already exists error. see link[1] zfs create -o compress=lz4 -o quota=20G -o mountpoint=legacy rpool/var # on the second thought, copies=2 makes more sence than quota zfs create -o copies=2 -o compress=lz4 -o mountpoint=legacy rpool/var # /etc/fstab should be this line only: rpool/var /var zfs defaults 0 0 # var has 2 children with no compression zfs create -o compress=off -o mountpoint=/var/portage/distfiles rpool/var/portage_distfiles zfs create -o compress=off -o mountpoint=/var/portage/packeges rpool/var/portage_packages # swap check blocksize with: getconf PAGESIZE, default is 4K zfs create -V 4G -b 4K rpool/swap mkswap -f /dev/zvol/rpool/swap swapon /dev/zvol/rpool/swap # snapshot of rootfs before sysupdates # snapshot of home regularly # reset var to initial (right after bootstrap) snapshot when it's too big zfs umount -a zpool set bootfs=rpool/rootfs rpool zpool export rpool zpool import -R /mnt/rpool rpool chroot /mnt/rpool # install...
TODO: making rootfs readonly and mounting it readwrite only at system updatws.
Leave a comment