how to replay a snapshot (btrfs) ?

Lentes, Bernd bernd.lentes at helmholtz-muenchen.de
Tue Jul 26 15:40:17 UTC 2016



----- On Jul 26, 2016, at 2:55 PM, Bernd Lentes bernd.lentes at helmholtz-muenchen.de wrote:

> Hi,
> 
> 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.
> 
> root at PC65472:~# mount|grep -iE 'btrfs|subvol'
> /dev/mapper/vg1-lv_root on / type btrfs
> (rw,relatime,ssd,space_cache,subvolid=257,subvol=/@)
> /dev/mapper/vg1-lv_root on /home type btrfs
> (rw,relatime,ssd,space_cache,subvolid=258,subvol=/@home)
> /dev/mapper/vg1-lv_root on /mnt/snap type btrfs
> (rw,relatime,ssd,space_cache,subvolid=285,subvol=/@/snapshots/root_190720162124)
> 
> I can mount my snapshot, which is fine and logical, but where is the benefit ?
> How can i set the snapshot to be my new live-system ?
> 
> System is Ubuntu 16.04 64 bit kernel 4.4.0-31.
> In the btrfs wiki i read:
> mount -o subvolid=0 <filesystem> <mount-point>
> 
> But that does not succeed:
> 
> root at PC65472:~# mount -o subvolid=0 /dev/mapper/vg1-lv_root /
> mount: /dev/mapper/vg1-lv_root is already mounted or / busy
>       /dev/mapper/vg1-lv_root is already mounted on /
>       /dev/mapper/vg1-lv_root is already mounted on /home
>       /dev/mapper/vg1-lv_root is already mounted on /mnt/snap
> 
> And umounting / of course also does not succeed.
> 
> Thanks for any help.
> 

Hi,

here (https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Snapshots) i found that:
"Once a [writable] snapshot is made, there is no difference in status between the original subvolume, and the new snapshot subvolume. 
To roll back to a snapshot, unmount the modified original subvolume, use mv to rename the old subvolume to a temporary location, 
and then again to rename the snapshot to the original name. You can then remount the subvolume."

I can't unmount / in a running system. I had to do that with s.th. like Knoppix, but that's inconvenient.
Isn't there a way without a live cd, using the running system ?
What is about modifying my fstab?
Here it is:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/vg1-lv_root /               btrfs   defaults,subvol=@ 0       1
# /boot was on /dev/sda1 during installation
UUID=290aabb0-cd7a-4094-bdb4-9b7ed3538f2b /boot           ext3    defaults        0       2
/dev/mapper/vg1-lv_root /home           btrfs   defaults,subvol=@home 0       2
# swap was on /dev/sda3 during installation
UUID=62189b48-ac0b-480e-a06a-7e602e27882c none            swap    sw              0       0


Can't i change the first line to 

"/dev/mapper/vg1-lv_root /               btrfs   defaults,subvol=snapshots/root_190720162124 0       1" ?


Can i delete the snapshot afterwards ?

Bernd
 

Helmholtz Zentrum Muenchen
Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH)
Ingolstaedter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrer: Prof. Dr. Guenther Wess, Dr. Alfons Enhsen, Renate Schlusen (komm.)
Registergericht: Amtsgericht Muenchen HRB 6466
USt-IdNr: DE 129521671




More information about the ubuntu-users mailing list