Discussion:
[linux-lvm] backup with snapshots - some principal questions
Lentes, Bernd
2015-12-07 15:20:57 UTC
Permalink
Hi,

i have several servers running different Linux distributions.
Our computing center provides a network-based backup solution
(Legato/EMC), which saves the disks every night. But when the servers run,
this backup is of course not consistent.
The servers are running a lvm configuration (/ on lv and /boot on a
physical partition).
My idea is to create a snapshot and mount it before the network backup
comes. When this is stored, my backup is consistent. I can configure the
networker client in such a manner that the "live" lv is not saved, just
the snapshot so that the server is not saved twice.
My questions:
Before I create a new snapshot, I'd like to remove the old one. Is there
something I have to take care of or can I just delete it using lvremove ?
No merging or s.th. like that before ?
What is if I'd like to apply the snapshot ? Which command do I have to use
for rolling back the system to a snapshot ?

Thanks.


Bernd

--
Bernd Lentes

Systemadministration
institute of developmental genetics
Gebäude 35.34 - Raum 208
HelmholtzZentrum München
***@helmholtz-muenchen.de
phone: +49 (0)89 3187 1241
fax: +49 (0)89 3187 2294

Wer Visionen hat soll zum Hausarzt gehen
Helmut Schmidt



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. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht Muenchen HRB 6466
USt-IdNr: DE 129521671
Lentes, Bernd
2015-12-07 20:05:03 UTC
Permalink
Post by Lentes, Bernd
Hi,
i have several servers running different Linux distributions.
Our computing center provides a network-based backup solution
(Legato/EMC), which saves the disks every night. But when the servers
run, this backup is of course not consistent.
The servers are running a lvm configuration (/ on lv and /boot on a
physical partition).
My idea is to create a snapshot and mount it before the network backup
comes. When this is stored, my backup is consistent. I can configure the
networker client in such a manner that the "live" lv is not saved, just
the
Post by Lentes, Bernd
snapshot so that the server is not saved twice.
Before I create a new snapshot, I'd like to remove the old one. Is there
something I have to take care of or can I just delete it using lvremove ?
No merging or s.th. like that before ?
What is if I'd like to apply the snapshot ? Which command do I have to
use for rolling back the system to a snapshot ?
Thanks.
Hi,

i'm testing currently. This is my script:

cd
logger Skript snapshot.sh starts
date > /var/log/snapshot.log
test -e /mnt/sn_root/etc && umount /mnt/sn_root >> /var/log/snapshot.log
2>&1
/sbin/lvremove -f /dev/vg1/sn_root >> /var/log/snapshot.log 2>&1
/sbin/lvcreate -L 9G -n sn_root -s /dev/vg1/lv_root >>
/var/log/snapshot.log 2>&1
test -e /mnt/sn_root && mount /dev/vg1/sn_root /mnt/sn_root >>
/var/log/snapshot.log 2>&1
logger < /var/log/snapshot.log
logger Skript snapshot.sh finished

I get this in /var/log/messages:

Dec 7 20:59:00 vm53200-12 root: Skript snapshot.sh starts
Dec 7 20:59:01 vm53200-12 /usr/sbin/cron[28428]: (root) CMD
(/usr/sbin/logwatch --service dmeventd)
Dec 7 20:59:01 vm53200-12 lvm[13903]: No longer monitoring snapshot
vg1-sn_root
Dec 7 20:59:05 vm53200-12 lvm[13903]: Monitoring snapshot vg1-sn_root
Dec 7 20:59:06 vm53200-12 kernel: [1043986.343038] kjournald starting.
Commit interval 15 seconds
Dec 7 20:59:06 vm53200-12 kernel: [1043986.343196] EXT3-fs (dm-1): using
internal journal
Dec 7 20:59:06 vm53200-12 kernel: [1043986.402634] ext3_orphan_cleanup:
deleting unreferenced inode 157171
Dec 7 20:59:06 vm53200-12 kernel: [1043986.435634] ext3_orphan_cleanup:
deleting unreferenced inode 156958
Dec 7 20:59:06 vm53200-12 kernel: [1043986.705218] ext3_orphan_cleanup:
deleting unreferenced inode 157169
Dec 7 20:59:06 vm53200-12 kernel: [1043986.744313] ext3_orphan_cleanup:
deleting unreferenced inode 157168
Dec 7 20:59:07 vm53200-12 kernel: [1043987.299663] ext3_orphan_cleanup:
deleting unreferenced inode 156949

...

Dec 7 20:59:07 vm53200-12 kernel: [1043987.956167] ext3_orphan_cleanup:
deleting unreferenced inode 157126
Dec 7 20:59:07 vm53200-12 kernel: [1043987.962637] ext3_orphan_cleanup:
deleting unreferenced inode 157125
Dec 7 20:59:07 vm53200-12 kernel: [1043987.969118] ext3_orphan_cleanup:
deleting unreferenced inode 157091
Dec 7 20:59:07 vm53200-12 kernel: [1043987.976513] ext3_orphan_cleanup:
deleting unreferenced inode 156520
Dec 7 20:59:07 vm53200-12 kernel: [1043987.976534] ext3_orphan_cleanup:
deleting unreferenced inode 156518
Dec 7 20:59:08 vm53200-12 kernel: [1043988.018951] ext3_orphan_cleanup:
deleting unreferenced inode 563237
Dec 7 20:59:08 vm53200-12 kernel: [1043988.040367] EXT3-fs (dm-1): 68
orphan inodes deleted
Dec 7 20:59:08 vm53200-12 kernel: [1043988.040369] EXT3-fs (dm-1):
recovery complete
Dec 7 20:59:08 vm53200-12 logger: Mon Dec 7 20:59:00 CET 2015
Dec 7 20:59:08 vm53200-12 logger: Logical volume "sn_root" successfully
removed
Dec 7 20:59:08 vm53200-12 logger: Logical volume "sn_root" created
Dec 7 20:59:08 vm53200-12 root: Skript snapshot.sh finished

What does the message " ext3_orphan_cleanup: deleting unreferenced inode
xxxxxx" means ?
And it appears always when the script runs.


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. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht Muenchen HRB 6466
USt-IdNr: DE 129521671
Stefan Ring
2015-12-09 17:52:45 UTC
Permalink
On Mon, Dec 7, 2015 at 9:05 PM, Lentes, Bernd
Post by Lentes, Bernd
What does the message " ext3_orphan_cleanup: deleting unreferenced inode
xxxxxx" means ?
And it appears always when the script runs.
I'm not entirely sure, but I would guess that these are deleted files
that were kept alive by some process holding them open at the time the
snapshot was taken. Since this unreferenced space would be leaked in
the event of a system crash – and snapshotting behaves essentially
like a crash –, the log recovery routine cleans them up during mount.
Zdenek Kabelac
2015-12-14 10:21:50 UTC
Permalink
Post by Stefan Ring
On Mon, Dec 7, 2015 at 9:05 PM, Lentes, Bernd
Post by Lentes, Bernd
What does the message " ext3_orphan_cleanup: deleting unreferenced inode
xxxxxx" means ?
And it appears always when the script runs.
I'm not entirely sure, but I would guess that these are deleted files
that were kept alive by some process holding them open at the time the
snapshot was taken. Since this unreferenced space would be leaked in
the event of a system crash – and snapshotting behaves essentially
like a crash –, the log recovery routine cleans them up during mount.
Hi

When lvm2 creates a volume snapshot - it does 2 things during needed suspend,
it's using 'fsfreeze' and it's flushing all bio in process,
so it's not comparable with just a plain crash.

Zdenek

Loading...