Profile cover photo
Profile photo
Damian Wojsław
illumos enthusiast, ZFS storage engineer, OpenSource evangelist, Amiga For 4er!
illumos enthusiast, ZFS storage engineer, OpenSource evangelist, Amiga For 4er!

Damian's posts

So turns out boot environments in Linux are not as easy as I have thought them to be. What got me is, in illumos ( kernel file is always the same, thus, no matter system revision, your GRUB will always point to the same file. While in Linux, and here I mean Kubuntu specifically, your kernel like is based on the actual kernel and related initrd.img version.
Why is that important?
If you'd remember, boot environments offer an easy and storage cheap option of having snapshot of root filesystem (/). I created two, so far.
First is called clean and it's operating system right after finishing this howto:
Second was created few weeks ago when Kubuntu team updated their plasma backcport PPA ( and I called it ubuntub4plasma.
My deafult filesystem is called simply ubuntu and is my day to day working operating environment.
The short picture:

rpool/ROOT/ubuntu 11.9G 324G 10.7G /
rpool/ROOT/ubuntub4plasma 836K 324G 10.0G /
rpool/ROOT/ubuntuclean 8K 324G 417M none

Just today I have broken my Kubuntu beyond hope of quick fix. My first thought was to boot back to ubuntub4plasma and to that end I edited GRUB linux line to use rpool/ROOT/ubuntub4plasma and rebooted. It did not end well. Linux spilled spaghetti of booting errors. Short look at grub config file explained it to me. I never ever paid attention to the kernel file and path.

linux /ROOT/ubuntu@/boot/vmlinuz-4.4.0-31-generic root=ZFS=rpool/ROOT/ubuntu ro text quiet splash $vt_handoff
initrd /ROOT/ubuntu@/boot/initrd.img-4.4.0-31-generic

I was booting kernel living in rpool/ROOT/ubuntu filesystem, but using rpool/ROOT/ubuntub4plasma.
The kernel did not exist at the moment of creating the clone, thus system got confused. I'm not sure booting this way is impossible, but I did not want to investigate, I wanted to get my system up and running.

What I had to do, I had to edit grub.cfg and replace kernel name and path. Thankfully, vmlinux and initrd.img points to latest installed (default?) kernel and initrd.img in given zfs filesystem, simplifying my task:

linux /ROOT/ubuntub4plasma/@/boot/vmlinuz root=ZFS=rpool/ROOT/ubuntub4plasma ro text quiet splash $vt_handoff
initrd /ROOT/ubuntub4plasma/@/boot/initrd.img

That got my system up.

From now on I only had to several simple steps that posed no problem:

sudo zfs promote rpool/ROOT/ubuntub4plasma
sudo zfs destroy rpool/ROOT/ubuntu
sudo zfs snapshot rpool/ROOT/ubuntub4plasma@clean
sudo zfs clone rpool/ROOT/ubuntub4plasma@clean rpool/ROOT/ubuntu
sudo zfs promote rpool/ROOT/ubuntu

I turned the emergency clone into full filesystem That allowed me to destroy broken filesystem and recreate based on the working ubuntub4plasma. First snapshot, then turn snapshot into clone, then promote to filesystem. One reboot, add the Kubuntu PPA and voila! 

It's a short piece to demonstrate coolnes of ZFS on / on Linux. I have set up my system following this tutorial:

Today I've read about PPA alllwing me to test new KDE Plasma. While I'd like to test them, I'm not really up to eventual mess, when/if I'll want to come back to original KDE packages.

ZFS on / (and btrfs on / too, I believe) lest create snapshots and clones of current operating system, allowing to later on boot into freezed in time root partition.

My ZFS filesystems layout:
root filesystem lives on:

Home directories live on rpool/home/

I've snapshotted original working ubuntu root:

zfs snapshot rpool/ROOT/ubuntu@2016-07-12

and cloned it:

zfs clone rpool/ROOT/ubuntu@2016-07-12 rpool/ROOT/ubuntub4plasma

output of zfs list:

zfs list
rpool 117G 313G 96K /
rpool/ROOT 10.3G 313G 96K none
rpool/ROOT/ubuntu 10.3G 313G 10.0G /
rpool/ROOT/ubuntub4plasma 8K 313G 10.0G none
rpool/ROOT/ubuntuclean 8K 313G 417M none
rpool/home 88.8G 313G 96K /home
rpool/home/root 144K 313G 144K /root
rpool/home/trochej 88.8G 313G 88.8G /home/trochej
rpool/swap 17.0G 329G 1.14G -
rpool/var 660M 313G 96K /var
rpool/var/cache 650M 313G 650M /var/cache
rpool/var/log 8.44M 313G 8.44M /var/log
rpool/var/tmp 996K 313G 996K /var/tmp

Only missing piece is adding proper entry to /boot/grub/grub.cfg. Add a new entry with this line:
linux /ROOT/ubuntu@/boot/vmlinuz-4.4.0-28-generic root=ZFS=rpool/ROOT/ubuntu ro text quiet splash $vt_handoff

edited to read:

linux /ROOT/ubuntu@/boot/vmlinuz-4.4.0-28-generic root=ZFS=rpool/ROOT/ubuntub4plasma ro text quiet splash $vt_handoff

Next boot you should have a new entry in GRUB menu.

I have one slight problem with this one, though. Every new kernel install, grub menu is regenerated and my entries are removed. Slight annoyance, possibly to be worked out once ZFS becomes more mainstream in Linux distributions.

Post has attachment

Post has attachment
Worth a read. I trust this guy

Post has attachment
I don't really understand the fight against ZFS, but I hope this is going to find peaceful resolution.
I really hope for ZFS to be included. I've seen really big arrays built on this filesystem. It would be a shame to loose that technology due to licensing issues.

Post has attachment
Being back to Linux after three years exclusively in illumos-land, I am trying to get zfs work on Fedora. So far:

Post has attachment

Post has attachment

Post has attachment

Post has attachment
Wait while more posts are being loaded