Little Cron difficulty I would like help with
I have a (daily) cron (actually its anacron - since this is my desktop 
and is powered down every night) job that attempts to take a snapshot of 
a logical volume (it happens to be the one where I store embedded 
virtual machines "disk" files on) to take a backup.
Almost every day, I get an error with it related to either not being 
able to unmount the snapshot, or the opposite - finding the snapshot is 
already mounted.
Given the size of the files (~100G) this backup takes quite a while, so 
it could be that I occasionally power off the machine in the middle of 
the process.
I have attempted to incorporate some advice given in debian bug #54961
I would like to get some advice on how to make my script more robust.
Here is the relevant part of the backup script
logger -t "Backup:" "Backing up Virtual Machine Images"
lvcreate -L 40G -n vm-backup -s /dev/raid/VBVM
mkdir -p /mnt/vm-backup
mount /dev/raid/vm-backup /mnt/vm-backup
rsync -aq --delete --inplace /mnt/vm-backup/ 
owl:/bak/alan/backup/"VirtualBox VM
s"/
umount /dev/raid/vm-backup
# All this to remove the snapshot - see Debian Bug #549691
sleep 10
sync
sleep 10
dmsetup remove /dev/mapper/raid-vm--backup
dmsetup remove /dev/mapper/raid-vm--backup-cow
lvremove -f /dev/raid/vm-backup
In writing this post I have been looking at the debian bug reports - 
starting with 549691 mentioned above.  There are several versions of the 
bug in lvm2 around, but I can't understand if there is any reaction from 
someone who is maintaining lvm2.  As far as I can tell there is one 
comment in #618016 saying this is not the latest version please upgrade, 
but then a slew of reports following that saying that they were at the 
latest version and its still reproduceable.
Does anyone else know about this problem and what should be done to get 
around it.
--
Alan Chandler
http://www.chandlerfamily.org.uk
Reply to: