0

So I'm very new to btrfs but have used zfs for more than a decade now...

Setup:

  1. I installed Manjaro on a btrfs partition without using subvolumes.
  2. After installation, I created a snapshot of / (called the snapshot fresh-install). The snapshot was created inside /snapshots folder
  3. I examined /snapshots/fresh-install (using du) and it seems it's a large folder of around 6GB. I've made zfs snapshots of newly installed freebsd before and they don't seemed as large.

Zfs has its own rollback command. So what's the equivalent in btrfs world? My first impression is that it's as simple as deleting the files and folders and restoring them from the /snapshots/fresh-install backup?

Is this correct? Thanks

1

Since you did not create subvolumes for your installation, that means Manjaro is installed in the top-level subvolume. To "rollback" you can simply change the default subvolume from the top-level subvolume, to the snapshot.

Assuming you want to retain the snapshot of the fresh install, I recommend making a read-only snapshot of it first:

cd /snapshots
btrfs subvol snapshot -r fresh-install fresh-install-ro

Then, change the default subvolume:

btrfs subvol set-default fresh-install /

After rebooting you'll effectively rollback the system. Note that once you do this you won't see /snapshots anymore. That's because /snapshots is in the top-level subvolume and you booted off a different subvolume. So gain access to /snapshots you need to mount the top-level subvolume, somewhere:

mount /dev/sd[whatever] /mnt -o subvolid=5
2
  • What's meant my subvolid=5? Thanks a lot
    – mrjayviper
    Dec 13 '20 at 4:53
  • 1
    Every subvolume has an ID. The top-level subvolume always has the ID 5. If you don't specify which subvolume to mount it will mount the default subvolume. Dec 13 '20 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.