wiki/Debian-Buster-Root-on-ZFS 2019.04.14 20:36 GMT
#
# zpool create -f -o ashift=12 \
-O relatime=on -O canmount=off -O compression=lz4 \
-O xattr=sa -O acltype=posixacl \
-O mountpoint=/ -R /mnt \
rpool raidz \
/dev/disk/by-id/ata-ST4000DM004-2CV104_WFN094MC \
/dev/disk/by-id/ata-ST4000DM004-2CV104_WFN095JH \
/dev/disk/by-id/ata-ST4000DM004-2CV104_WFN0HHES \
/dev/disk/by-id/ata-ST4000DM004-2CV104_WFN0FVT7
# WFN094MC -> ../../sda
# WFN095JH -> ../../sdb
# WFN0HHES -> ../../sdc
# WFN0FVT7 -> ../../sdd
# zfs create -o canmount=off -o mountpoint=none rpool/ROOT
On Solaris systems, the root filesystem is cloned and the suffix is incremented for major system changes through pkg image-update
or beadm
.
zfs create -o canmount=noauto -o mountpoint=/ rpool/ROOT/debian
zfs mount rpool/ROOT/debian
time debootstrap buster /mnt
# real 10m57s user 1m50s sys 0m42s
# zfs set devices=off rpool
echo HOSTNAME > /mnt/etc/hostname
cp /etc/network/interfaces /mnt/etc/network/
# vi /mnt/etc/apt/sources.list
deb http://deb.debian.org/debian buster main contrib non-free
deb-src http://deb.debian.org/debian buster main contrib
# mount --rbind /dev /mnt/dev
# mount --rbind /proc /mnt/proc
# mount --rbind /sys /mnt/sys
# chroot /mnt /bin/bash --login
ln -s /proc/self/mounts /etc/mtab
apt update
apt install -y locales
dpkg-reconfigure locales
dpkg-reconfigure tzdata
apt install --no-install-recommends firmware-linux-nonfree # for tg3 (Broadcom) HP Microserver
apt install -y dpkg-dev linux-headers-amd64 linux-image-amd64
apt install -y zfs-initramfs
apt install -y grub-pc
passwd
vi /etc/default/grub # -> GRUB_CMDLINE_LINUX="root=ZFS=rpool/ROOT/debian"
apt install -y sysvinit-core
#Setting up insserv (1.18.0-2) ...
#insserv: FATAL: service mountkernfs has to exists for service udev
#insserv: FATAL: service urandom has to exists for service networking
#insserv: FATAL: service mtab has to exists for service zfs-import
#insserv: FATAL: service mountdevsubfs has to exists for service hwclock
#insserv: exiting now!
#Setting up sysv-rc (2.93-8) ...
#Setting up initscripts (2.93-8) ...
#invoke-rc.d: could not determine current runlevel
#Setting up sysvinit-core (2.93-8) ...
#Not restarting sysvinit
grub-probe / # zfs
apt install -y popularity-contest
# https://postgres.men/os/linux/ubuntu-18-04-root-on-zfs/
# zpool create -o ashift=12 \
-O atime=off -O canmount=off -O compression=lz4 \
-O checksum=fletcher4 -O normalization=formD \
-m legacy -R /mnt \
-f \
tank mirror ..
# 8204 Debian/OpenRC problem & PR