Manual install with ZFS root
From Void Linux Wiki
Rough notes on a manual installation, with ZFS for / and ext2 for /boot/grub
Also see the corresponding Ubuntu documentation
Not meant to be copy&pasted, please think for yourself.
- You need to install from a medium with zfs installed: xbps-install zfs
- Create a small ext2 partition (assumed sda1) for /boot/grub and an as big/many as you want for zfs (assumed sda2)
- Create the pool: zpool create rpool /dev/sda2
- Create a fs for the root file systems: zfs create rpool/ROOT
- Create a fs for the Void file system: zfs create rpool/ROOT/voidlinux_1
- DO NOT USE
-
IN FILESYSTEM NAMES, due to this "feature". - Unmount all ZFS filesystems: zfs umount -a
- zfs set mountpoint=/ rpool/ROOT/voidlinux_1
- zpool set bootfs=rpool/ROOT/voidlinux_1 rpool
- Export the pool: zpool export rpool
- Import the pool below /mnt: zpool import -R /mnt rpool
- Due to the mountpoint=/, the pool should now be mounted at /mnt directly. Verify with mount: rpool/ROOT/voidlinux_1 on /mnt type zfs (rw,relatime,xattr,noacl)
- Install Void
- mkdir -p /mnt/{boot/grub,dev,proc,run,sys}
- mount /dev/sda1 /mnt/boot/grub
- mount --rbind /dev /mnt/dev
- mount --rbind /proc /mnt/proc
- mount --rbind /run /mnt/run
- mount --rbind /sys /mnt/sys
- xbps-install -S -R http://alpha.de.repo.voidlinux.org/current -r /mnt base-system grub
- chroot /mnt /bin/bash
- passwd root
- chown root:root /
- chmod 755 /
- vi /etc/rc.conf
- echo void-zfs >/etc/hostname
- xbps-install zfs
- Check if grub-probe / outputs zfs, else hack /usr/sbin/grub-mkconfig and insert values of GRUB_DEVICE=/dev/sda2 and GRUB_DEVICE_BOOT=/dev/sda2 directly.
- grub-install /dev/sda
- uncomment hostonly=yes (important!): vi /etc/dracut.conf
- if /etc/zfs/zpool.cache does not exist, run: zpool set cachefile=/etc/zfs/zpool.cache rpool
- force update of dracut and grub: xbps-reconfigure -f linux3.14
- Sanity check: lsinitrd should show zfs.ko and zpool.cache, grub config should have line like "linux /ROOT/voidlinux_1@/boot/vmlinuz... root=ZFS=rpool/ROOT/voidlinux_1
- If you ever fail to import the pool at boot, reboot with zfs.force=y (but having an uptodate zpool.cache in the initrd should avoid that).
- Good luck!