2

Windows restore points...

How to have the same functionality in Ubuntu ? With existing tools like Deja-Dup

I have tried to set up snapshots and got trouble following the instructions.

Is there a sane way to do manual snapshot with BTRFS in Ubuntu 16.04 ?

  • @TonyLancer un-mark this please. The question you are pointing to is questioning the existence, while pragmatically they seem the same semantically they aren't. Is totally different "Is there a Gawd"? to "How to talk to Gawd?" or Unicorns... wtv... – userDepth May 8 '16 at 13:12
  • You might find an answer here? – Zanna May 8 '16 at 14:04
  • @Zanna For the Bubbling Zeus Thunders!!!! That's a really awesome link. – userDepth May 8 '16 at 14:46
  • 1
    :-D hope you find exactly what you want, then you can post your own answer – Zanna May 8 '16 at 15:47
  • Can't do that while dup... :/ Anyways this is very useful, I'll write a blog post. – userDepth May 8 '16 at 15:52
3

Yes, there is a very good way to make restore points using btrfs in Ubuntu.

Standard Ubuntu installation with btrfs uses subvolumes @ for / and @home for /home.

If you have installed Ubuntu in the default way with these subvolumes, then you can easily make restore points for / and /home separately.

You can check if you have these subvolumes by running

sudo btrfs list /

Let's assume that the partition with Ubuntu is /dev/sda1.

Make a snapshot of your / by running.

sudo mount /dev/sda1 /mnt
sudo btrfs sub snap /mnt/@ /mnt/@_backup
sudo umount /mnt

Now you can safely amend your data on / (not including /home). You can install or delete any packages, or do whatever you want.

To restore to the previous state you will need to boot from a LiveUSB and rename subvolumes.

sudo mount /dev/sda1 /mnt
sudo mv /mnt/@ /mnt/@_broken
sudo mv /mnt/@_backup /mnt/@
sudo umount /mnt

Now you can boot into the original system state.

If you are sure that you do not need the "broken" subvolume any more, you can delete it this way:

sudo mount /dev/sda1 /mnt
sudo btrfs sub del /mnt/@_broken
sudo umount /mnt

The same way you can make restore points for /home.

You can have some other subvolumes if you installed not a default way. But you can always make snapshots of any subvolumes the same way.

A useful example:

Before you upgrade Ubuntu to a newer release, make snapshots of / and probably /home. The latter is not very important in most cases.

If something goes wrong during or after the upgrade you can always return to the old release.

You can keep old snapshots for any time if you have enough disk space.

I upgraded this way some computers from 14.04 to 16.04 and keep the 14.04 snapshots in case there are some problems with 16.04. It takes a minute to boot into 14.04 this way.

You can also setup grub a way that you can boot into one or another snapshot using grub menu. But it is probably a topic for another question.

  • It is just showing the help , guess there's no sub-volumes installed the default way. I can change the question to "How to make an installation for use with snapshots" so I can do it when I reinstall. I want to use a BTRFS partition since it has support snapshots for the root "/" and a separate disk for home using XFS for the user files "/home", and just make snapshots of the system "Linux( / )". – userDepth May 9 '16 at 22:04
  • You can do snapshots without the default @ and @home. It is a bit more handy whe the default subvolume is not the root of the partition, but you can fix it very easily too. – Pilot6 May 10 '16 at 7:45

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.