Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

ZFS (notes)

stratus-ss edited this page Dec 6, 2015 · 10 revisions

Device Initialization

GPT

  • Clean partition table zap-all device

  • Clear all magic strings (mdadm, lvm, partition table, ...) dd if=/dev/zero of=device bs=512 count=2048

  • Create fresh GPT sgdisk clear device

  • Inform the kernel of the partition change partprobe device

MBR

  • Clear partition table dd if=/dev/zero of=device bs=512 count=2048

  • Create fresh MBR parted device mktable msdos

Create partitions

GPT but not UEFI (BIOS)

  • Create BIOS boot partition (EF02) 2MB
  • Create BOOT partition (8300) 512MB ext4

GPT and UEFI

GRUB Bootloader

  • Create EFI partition (EF00) 200MB fat32
  • Create BOOT partition (8300) 512MB ext4

systemd-boot (aka gummiboot), rEFInd Bootloaders

  • Create an unique EFI/BOOT partition (EF00) 512MB fat32

MBR

  • Create BOOT partition 512MB ext4

Create ZFS

  • Create a SOLARIS type partition with the rest of the disk

  • Create zfs pool named antergos

modprobe zfs

zpool create -f -m /install antergos device

  • Set the mount point of the root filesystem

zfs set mountpoint=legacy antergos

  • Create zfs vol swap

zfs create -V size -b sc_page_size -o primarycache=metadata -o checksum=off -o com.sun:auto-snapshot=false antergos/swap

Example: zfs create -V 524288 -b 4096 -o primarycache=metadata -o checksum=off -o com.sun:auto-snapshot=false antergos/swap

  • Set the bootfs property on the descendant root filesystem so the boot loader knows where to find the operating system.

zpool set bootfs=antergos antergos

  • Export the pool

zpool export antergos

Does not work (if I wait some time it does, maybe zfs is still working on something at this point?)

zpool export -f antergos

With force always works

  • Reimport the pool

zpool import -d /dev/disk/by-id -R /install antergos

  • Set the mount point of the filesystem

zfs set mountpoint=/ antergos

  • Create zpool.cache file

zpool set cachefile=/etc/zfs/zpool.cache antergos

  • Copy created cache file to destination cp /etc/zfs/zpool.cache /install/etc/zfs/zpool.cache