how to replay a snapshot (btrfs) ?

Lentes, Bernd bernd.lentes at helmholtz-muenchen.de
Wed Jul 27 16:47:29 UTC 2016


----- On Jul 27, 2016, at 1:20 PM, Bernd Lentes bernd.lentes at helmholtz-muenchen.de wrote:
>> 
>> root at ubuntu:/mnt/root# ll
>> total 16
>> drwxr-xr-x 1 root root  16 Jul 27 07:34 ./
>> drwxr-xr-x 1 root root  60 Jul 26 20:01 ../
>> drwxr-xr-x 1 root root  26 Jul 19 17:51 @home/
>> drwxr-xr-x 1 root root 252 Jul 26 18:12 old/
>> 
>> root at ubuntu:/mnt/root# btrfs sub snap old/old/snapshots/root_190720162124/ @
>> Create a snapshot of 'old/old/snapshots/root_190720162124/' in './@'
>> 
>> root at ubuntu:/mnt/root# btrfs sub list .
>> ID 257 gen 39434 top level 5 path old
>> ID 258 gen 39390 top level 5 path @home
>> ID 285 gen 39435 top level 257 path old/old/snapshots/root_190720162124
>> ID 300 gen 39222 top level 257 path old/@
>> ID 301 gen 39435 top level 5 path @
>> 
>> question:
>> in /mnt/root i see the snapshots which are located under the default volume (5)
>> ?
>> But i just see them if my default volume is 5 ?
>> 
> 
> now, what is general the best way to create and restore snapshots ?
> I'd like to create manually snapshots from / before changing the configuration.
> Would it be a good idea to create a subvolume for the snapshots directly under the default
> subvolume (ID 5) ?
> How can i achieve that ?

I succeeded. I mounted the default volume from BTRFS (ID 5) again and created
there a subvolume for the snapshots:

root at PC65472:/# btrfs sub create /mnt/root/snapshot
Create subvolume '/mnt/root/snapshot'

root at PC65472:/# btrfs sub list /
ID 257 gen 39434 top level 5 path old
ID 258 gen 39390 top level 5 path @home
ID 285 gen 39435 top level 257 path old/old/snapshots/root_190720162124
ID 300 gen 39222 top level 257 path old/@
ID 301 gen 39772 top level 5 path @
ID 305 gen 39772 top level 5 path snapshot

Fine. How to continue now with a snapshot ?

Mounting the snapshot subvolume:
root at PC65472:/# mount /dev/vg1/lv_root /snap -o subvol=snapshot

Create a snapshot:
root at PC65472:/# btrfs sub snap / /snap/root270720161800
Create a snapshot of '/' in '/snap/root270720161800'

Fiddeling around.

Decide to use the snapshot.

Rename @:
root at PC65472:/mnt/root# mv @ @_old

Create a snapshot from the snapshot:

root at PC65472:/mnt/root# btrfs sub snap /snap/root270720161800/ @
Create a snapshot of '/snap/root270720161800/' in './@'

Reboot.

Fine. Succeeded. Is that an appropriate way ?
I think it's ok. No live cd, just one reboot necessary.

> Suse creates additionally subvolumes for some directories like /var/lib,
> /var/log.
> That means that the content of these subvolumes is not included if i make a
> snapshot of / ?
> That would be a good idea, because you don't want to restore the log files or
> the databases from
> some days ago.
What do you think ?

I tried it with /home. I deleted some folders in /home, and they still are vanished
after the replay of the snapshot, because the snapshot of / does not include the subvolume @home. Right ?


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