Show HN: Zectl – ZFS Boot Environment Manager for Linux
ramsdenj.comFinally. I got used to this on solaris 10 and missed it until FreeBSD got it.. ZFS and beadm are the included in the reasons i continue to run FreeBSD as a workstation, but these days with k8s and such I do tend to run a lot of linux VMs to do my daily work (devops stuff)...
The work lappy runs ubuntu with zfs on root, and it's pretty seamless, I'm very much onboard with it having boot environments! (zsys)
Zfs on a laptop means you run zfs with a single disk?
This is not unheard of among FreeBSD users. Most of ZFS's features do not require (or even necessarily benefit from) multiple disks.
Yup checksumming and snapshots and compression and at rest encryption are amazing to name a few
They make adaptors that let you replace the optical drive with another SATA drive. But my FreeBSD laptop has one disk and it's fine. You don't have redundancy, but you still get all the other features (snapshots, clones, compression), and even if it can't correct errors it will still catch data errors which is more than most other filesystems will do.
I ran ZFS with a single disk on a laptop. What's wrong with that?
Not necessarily, my laptop has 2 M2 slots.
This looks nice. Going to have to give it a try.
I'd love to see automated ZFS-on-root setup, but suspect that'll have to come from Canonical if we ever get it.
In 20.04 they will have ZFS on root with BEs as an install option, looking forward to seeing the first major Linux distro making it available as a default.
Currently running that exact setup, it’s sweet
I'm surprised that they did not do that yet. While ZFS license status is questionable, Canonical seems to be sure that everything's OK, so they should embrace its technical superiority. Something like full system rollback after bad update is trivial with snapshots and it's extremely useful feature.
Looks to be that's what they have done. They've developed a new tool called `zsys` https://github.com/ubuntu/zsys which will help with system administration, rollbacks, auto snapshots before and after package changes. I believe it will also support boot environments.
I thought that Ubuntu was already capable of doing this in the latest release (19.10.)
There are third party scripts to accomplish this. I would look at https://github.com/saveriomiroddi/zfs-installer. The only reason I have not used it is that I had already written my own https://github.com/HankB/Linux_ZFS_Root. And in this case, better the devil I know. (I'm presently updating my script to follow the most recent instructions at https://github.com/openzfs/zfs/wiki/Debian-Buster-Root-on-ZF...)
ZFS-installer appears to be more mature and is seeing more effort than mine. Perhaps I should give it a try.
You can do automated ZFS-on-root installs through MAAS https://maas.io/
Oh, this is cool! We'll need to check out this plugin mechanism as a thought for bectl -- it's fairly inflexible at the moment.
libze_util_temporary_mount would be a good candidate for using (or being replaced by?) the recently-introduced zfs_mount_at in libzfs once that's widely available enough. That was a fairly trivial addition to libzfs that was initially made to support libbe's be_mount(), which previously used the effectively non-portable amount() [post-mortem: should read zmount, but autocorrect is alwayscorrect]
loader ZFS integration is really great on FreeBSD, do people occasionally want to use something else? Is that why you would consider looking to support other options? Really would be nice to see loader ported to Linux - I know it was recently brought over to Solaris. Maybe a project for another day...
Thanks for the tip, the temporary mounting seems a bit like a hack so that's good to know there's a better option.
I've seen the occasional rumbling about folks wanting to use grub for one reason or another- while not necessarily ideal (having the caveats of a non-loader environment), I can see the value in it if you really don't need the amenities loader offers (debugging support, kmods).
Big thanks to the developers/John for creating ZFS Linux boot manager!
Looks cool. Currently only one machine which I have with zfs is NixOS, which has it own mechanism to handle such versioning, or do you see some advantages of using zfs approach?
I used to use NixOS, and I do have some of the best ZFS support out of the box I've seen on Linux. I'm not sure if the approach of using zfs boot environments would play well with NixOS considering how they manage the configuration and rollbacks separately. They also manage the bootloader, so I don't know if the changes would survive. Something could probably be set up to work, but it would probably feel as though you were working against the intended way the system should work.
With encryption support?
I haven't tried it myself with encryption, but I can't see it making a difference. The bootloader, and initial ZFS setup will be what needs to be changed to facilitate encryption.
Hmm, how/when/where would the ‘zfs load-key’ happen?
I only know how to use the systemd-ask-password hack to decrypt non-root datasets, but can’t get my head around how that would work with fully encrypted root dataset.
Presumably it would be like FreeBSD's GELI, where early boot stuff would need to detect that it's looking at an encrypted root and know to prompt. In theory, this is relatively straightforward- with boot environments, the zpool bootfs property indicates the root dataset, so I wouldn't think you need to look too far.
[edit: this is done in our loader, so presumably you'd use grub?]
If you're using Arch, the zfs hook that comes with the archzfs package takes care of this:
https://github.com/archzfs/zfs-utils/blob/master/zfs-utils.i...