I assume that you intend to script this and run it via cron? Running a series of commands without testing their return values and intelligently parsing stdout/stderr is a formula for disaster.
I would run rsync a second time and parse the messages returned to be 100% certain of success. rsync is the tool for validating rsync. You should do a simple test to make certain that the mount succeeded so that the sync goes to the mount and NOT to /mnt/src on the root filesystem. I would say that >90% of the snapshot/backup scripts that I see have fatal flaws. The result is usually either a failure to snapshot/backup, or filling up of the wrong filesystem. Raphael Bauduin wrote: > Hi, > > I found out qem-nbd can mount a snapshot, but this feature is not much > documented or discussed (or I didn't find the good resources), so I'd like > to have some confirmation before I use it for my backups. > Here is the sequence of actions I would take: > stop domain > qemu-nbd --connect /dev/nbd0 --read-only --snapshot /path/to/file.qcow2 > start domain > mount /dev/nbd0p1 /mnt/src > rsync -a /mnt/src /mnt/dest > umount /mnt/src > qemu-nbd --disconnect /dev/nbd0 > > With these actions, can I be sure that > - my backup of the filesystem is correct and coherent ? > - the domain can continue to work normally despite the nbd snapshot ? > - when the nbd is disconnected, its snapshot is removed ? > > Thanks > > Raphaƫl -- Phil Ehrens <[email protected]> | mm The LIGO Laboratory, MS 100-36 | /^( )^\ California Institute of Technology | \,(..),/ 1200 East California Blvd. | V~~V Pasadena, CA 91125 USA | My gpg public key: Phone:(626)395-8518 | http://www.imbe.net/peligo.asc
