Skip to content

kardwen/zfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

ZFS

Notes

https://arstechnica.com/information-technology/2020/05/zfs-101-understanding-zfs-storage-and-performance/

Write image with ZFS support

https://github.com/leahneukirchen/hrmpf/releases

(use lsblk to list devices)

dd bs=4M if=path/to/my.iso of=/dev/disk/by-id/usb-drive conv=fsync oflag=direct status=progress

Install ZFSBootMenu

boot image, connect to network to download this document

sudo xbps-install -S wget
wget https://raw.githubusercontent.com/kardwen/zfs/refs/heads/main/README.md

https://docs.zfsbootmenu.org/en/v2.3.x/guides/void-linux/syslinux-mbr.html

sudo xbps-install -S zfsbootmenu

For Thinkpad x201s with BIOS:

Use distro ID as filesystem ID

Set a bunch of env variables:

source /etc/os-release
export ID

Set the hostid:

zgenhostid -f 0x00bab10c
export BOOT_DISK="/dev/sda"
export BOOT_PART="1"
export BOOT_DEVICE="${BOOT_DISK}${BOOT_PART}"
export POOL_DISK="/dev/sda"
export POOL_PART="2"
export POOL_DEVICE="${POOL_DISK}${POOL_PART}"

Partition disks (will erase data):

cat <<EOF | sudo sfdisk "${POOL_DISK}"
label: dos
start=1MiB, size=512MiB, type=83, bootable
start=513MiB, size=+, type=83
EOF

Create zpool

zpool create -f -o ashift=12 \
 -O compression=lz4 \
 -O acltype=posixacl \
 -O xattr=sa \
 -O relatime=on \
 -o autotrim=on \
 -o compatibility=openzfs-2.1-linux \
 -m none zroot "$POOL_DEVICE"

Create filesystems

zfs create -o mountpoint=none zroot/ROOT
zfs create -o mountpoint=/ -o canmount=noauto zroot/ROOT/${ID}
zfs create -o mountpoint=/home zroot/home

zpool set bootfs=zroot/ROOT/${ID} zroot
zpool export zroot
zpool import -N -R /mnt zroot
zfs mount zroot/ROOT/${ID}
zfs mount zroot/home
mount | grep mnt
udevadm trigger

Install void linux

XBPS_ARCH=x86_64 xbps-install \
  -S -R https://mirrors.servercentral.com/voidlinux/current \
  -r /mnt base-system
cp /etc/hostid /mnt/etc
cat << EOF >> /etc/rc.conf
KEYMAP="us"
HARDWARECLOCK="UTC"
EOF
ln -sf /usr/share/zoneinfo/<timezone> /etc/localtime
cat << EOF >> /etc/default/libc-locales
en_US.UTF-8 UTF-8
en_US ISO-8859-1
EOF
xbps-reconfigure -f glibc-locales
passwd
cat << EOF > /etc/dracut.conf.d/zol.conf
nofsck="yes"
add_dracutmodules+=" zfs "
omit_dracutmodules+=" btrfs "
EOF
xbps-install -S zfs
mkfs.ext4 -O '^64bit' "$BOOT_DEVICE"
cat << EOF >> /etc/fstab
$( blkid | grep "$BOOT_DEVICE" | cut -d ' ' -f 2 ) /boot/syslinux ext4 defaults 0 0
EOF

mkdir /boot/syslinux
mount /boot/syslinux
xbps-install -S syslinux
cp /usr/lib/syslinux/*.c32 /boot/syslinux
extlinux --install /boot/syslinux
dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/mbr.bin of="$BOOT_DISK"
zfs set org.zfsbootmenu:commandline="quiet" zroot/ROOT
xbps-install -S zfsbootmenu

Edit /etc/zfsbootmenu/config.yaml:

Global:
  ManageImages: true
  BootMountPoint: /boot/syslinux
Components:
  Enabled: true
  Versions: false
  ImageDir: /boot/syslinux/zfsbootmenu
cat > /boot/syslinux/syslinux.cfg <<EOF
UI menu.c32
PROMPT 0

MENU TITLE ZFSBootMenu
TIMEOUT 50

DEFAULT zfsbootmenu

LABEL zfsbootmenu
  MENU LABEL ZFSBootMenu
  KERNEL /zfsbootmenu/vmlinuz-bootmenu
  INITRD /zfsbootmenu/initramfs-bootmenu.img
  APPEND zfsbootmenu quiet

LABEL zfsbootmenu-backup
  MENU LABEL ZFSBootMenu (Backup)
  KERNEL /zfsbootmenu/vmlinuz-bootmenu-backup
  INITRD /zfsbootmenu/initramfs-bootmenu-backup.img
  APPEND zfsbootmenu quiet
EOF
xbps-reconfigure -f zfsbootmenu
exit
umount -n -R /mnt
zpool export zroot
reboot

About

zfs notes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published