correct way to rollback a root filesystem?

Jim Salter
2014-01-06T19:31:18Z

Hi list -

I tried a kernel upgrade with moderately disastrous (non-btrfs-related)
results this morning; after the kernel upgrade Xorg was completely
borked beyond my ability to get it working properly again through any
normal means. I do have hourly snapshots being taken by cron, though, so
I'm successfully X'ing again on the machine in question right now.

It was quite a fight getting back to where I started even so, though -
I'm embarassed to admit I finally ended up just doing a cp --reflink=all
/mnt/@/.snapshots/snapshotname /mnt/@/ from the initramfs BusyBox
prompt. Which WORKED well enough, but obviously isn't ideal.

I tried the btrfs sub set-default command - again from BusyBox - and it
didn't seem to want to work for me; I got an inappropriate ioctl error
(which may be because I tried to use / instead of /mnt, where the root
volume was CURRENTLY mounted, as an argument?). Before that, I'd tried
setting subvol=@root (which is the writeable snapshot I created from the
original read-only hourly snapshot I had) in GRUB and in fstab... but
that's what landed me in BusyBox to begin with.

When I DID mount the filesystem in BusyBox on /mnt, I saw that @ and
@home were listed under /mnt, but no other "directories" were - which
explains why mounting -o subvol=@root didn't work. I guess the question
is, WHY couldn't I see @root in there, since I had a working, readable,
writeable snapshot which showed its own name as "root" when doing a
btrfs sub show /.snapshots/root ?

Thanks.