how to replay a snapshot (btrfs) ?
ubuntu at tigershaunt.com
Tue Jul 26 15:59:53 UTC 2016
On 16-07-26 08:55 AM, Lentes, Bernd wrote:
> sorry for asking this simple question. But i'm new to btrfs. And all the guides i found in the internet are different and none of them succeeded.
> I made a snapshot form my / , did some changes in the configurtaion (which weren't successfull), now i want to get back to the snapshot.
> This is my system:
> root at PC65472:~# btrfs sub list -ap /
> ID 257 gen 38915 parent 5 top level 5 path <FS_TREE>/@
> ID 258 gen 38903 parent 5 top level 5 path <FS_TREE>/@home
> ID 285 gen 38828 parent 257 top level 257 path @/snapshots/root_190720162124
> ID 285 is my snapshot.
> root at PC65472:~# btrfs sub get-default /
> ID 285 gen 38828 top level 257 path snapshots/root_190720162124
> I changed the snapshot to the default but i still have the configuration changes i'd like to loose.
> Also after a restart still no replay of the snapshot.
I suggest not changing the default subvolume... That way lies madness
In the typical Ubuntu install, the default top level subvolume (5) is
the default, and subvolume "@" is mounted as root. (This is configured
in the Grub kernel parameters as well at /etc/fstab
Your situation is a bit complicacated because you have your snapshots
folder/subvolume as a subfolder of @. This is how snapper program
handles it by default, but unless your scripts need to be setup that
way, I would change it, for your own convienience. (If you were using
snapper, you would also use snapper to roll back changes. I'm not
covering that in this message, however.
You can do this by booting to a live CD, but I've successfully done this
on my live system as well, (ie, I changed root while booted to the
system, rebooted, and was successfully rolled back. If your doing this
live, you'll want to make sure your not running anything that needs to
preserve it's running state. To this right, you would usually boot into
some kind of single user mode. But I can be recklessly wild when I know
what my desktop is doing/not doing.
If your default subvolume is still 285, make sure to change it back to
5. I think there might be booting problems if you change the default
All commands are run as root, use sudo in front of everything, or sudo
-s to open a root shell. Whichever you like.
1. Mount the device that contains your snapshots. ex: mkdir /mnt/device
mount /dev/sda1 /mnt/device
ls /mnt/device should show sow a @ and @home directories.
2. optional: move your snapshot folder out of the root. mv
3. rename your old root: mv @ delete_me
4. create a new snapshot of your snapshot for use.
btrfs subvolume snapshot /mnt/device/snapshots/root_190720162124
You should now be rolled back. Now to clean up.
mount /dev/sda1 /mnt/device
btrfs subvolume delete /mnt/device/delete_me
Alternatively, you can save delete_me in your snapshots folder to
preserve it for a time:
mv /mnt/device/delete_me /mnt/device/snapshots/bad_root
More information about the ubuntu-users