So far, everything parsed root= manually, which meant that while zfs-parse.sh was updated, and supposedly supported + -> ' ' conversion, it meant nothing Instead, centralise parsing, and allow: root= root=zfs root=zfs: root=zfs:AUTO root=ZFS=data/set root=zfs:data/set root=zfs:ZFS=data/set (as a side-effect; allowed but undocumented) rootfstype=zfs AND root=data/set <=> root=data/set rootfstype=zfs AND root= <=> root=zfs:AUTO So rootfstype=zfs /also/ behaves as expected, and + decoding works Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13291
2.7 KiB
Basic setup
- Install
zfs-dracut
- Set
mountpoint=/
for your root dataset (for compatibility,legacy
also works, but is not recommended for new installations):zfs set mountpoint=/ pool/dataset
- Either (a) set
bootfs=
on the pool to the dataset:zpool set bootfs=pool/dataset pool
- Or (b) append
root=zfs:pool/dataset
to your kernel cmdline. - Re-generate your initrd and update it in your boot bundle
Encrypted datasets have keys loaded automatically or prompted for.
If the root dataset contains children with mountpoint=
s of /etc
, /bin
, /lib*
, or /usr
, they're mounted too.
cmdline
-
root=
Root dataset is… (empty) the first bootfs=
afterzpool import -aN
zfs:AUTO
,zfs:
,zfs
(as above, but overriding other autoselection methods) ZFS=pool/dataset
pool/dataset
zfs:pool/dataset
(as above) All
+
es are replaced with spaces (i.e. to boot fromroot pool/data set
, passroot=zfs:root+pool/data+set
).The dataset can be at any depth, including being the pool's root dataset (i.e.
root=zfs:pool
).rootfstype=zfs
is equivalent toroot=zfs:AUTO
,rootfstype=zfs root=pool/dataset
is equivalent toroot=zfs:pool/dataset
. -
spl_hostid
: passed tozgenhostid -f
, useful to override the/etc/hostid
file baked into the initrd. -
bootfs.snapshot
,bootfs.snapshot=snapshot-name
: enableszfs-snapshot-bootfs.service
, which creates a snapshot$root_dataset@$(uname -r)
(or, in the second form,$root_dataset@snapshot-name
) after pool import but before the rootfs is mounted. Failure to create the snapshot is noted, but booting continues. -
bootfs.rollback
,bootfs.rollback=snapshot-name
: enableszfs-snapshot-bootfs.service
, which-Rf
rolls back to$root_dataset@$(uname -r)
(or, in the second form,$root_dataset@snapshot-name
) after pool import but before the rootfs is mounted. Failure to roll back will fall down to the rescue shell. This has obvious potential for data loss: make sure your persistent data is not below the rootfs and you don't care about any intermediate snapshots. -
If both
bootfs.snapshot
andbootfs.rollback
are set,bootfs.rollback
is ordered afterbootfs.snapshot
. -
zfs_force
,zfs.force
,zfsforce
: add-f
to allzpool import
invocations. May be useful. Use with caution.