Ferguson, Michael wrote:
Justin W wrote:
> I just backed up my server using a combination of an LVM snapshot, dd to
> copy the partition initially, and now it'll be maintained with nightly
> rsyncs to a mounted image file. (Note: If anyone is interested, I can post
> some documentation describing how I set up the backup and the script which
> will keep my backup up-to-date).
Justin, Thanks for the offer. Please post, or send me the documentation on
how to.
'preciate it.
Ferg'
I'm currently in the process of rewriting the script and such so that
there is not so much manual input. If I succeed, the script should be
quite portable across similar setups, but for now, you're going to have
to change many of the path names to how they apply to you.
The documentation is in the file backup.html which I've attached, and
then the script which accompanies it is in the file backup-slash-fs.
If I get the new version completed in a reasonable amount of time, I'll
repost that one too, but I'm not making any promises.
Justin W
#!/bin/bash
# Overview of backup process
# 1) Create a FS snapshot using LVM
# 2) Mount the snapshot FS
# 3) Mount our backup file in a loop filesystem (we can guarantee the space
# will be present this way, and it allows selective recovery of files if
# need be)
# 4) rsync the differences between the snapshot FS and the backup FS
# 5) Unmount the backup FS
# 6) Unmount the snapshot FS
# 7) Delete the snapshot LVM (leaving it will degrade performance)
# Create the LVM snapshot
lvcreate -s -L40G -n FC6Backup /dev/System/fc6
# Mount our filesystems
mount /dev/System/FC6Backup /mnt/FC6-Snapshot
mount -o loop /mnt/smb/userdata/root/FC6-Backup-File /mnt/FC6-Backup
# Update the backup file system with files from the snapshot
rsync -aHEAXxv --stats --delete --ignore-errors /mnt/FC6-Snapshot/* /mnt/FC6-Backup
# Unmount the backups
umount /mnt/FC6-Backup
umount /mnt/FC6-Snapshot
# Delete the snapshot
lvremove -f /dev/System/FC6Backup
# Create a link to the backup file which (in the name) indicates the date of
# the backup
cd /mnt/smb/userdata/root
rm -f FC6-Backup_*
ln -s FC6-Backup-File FC6-Backup_$(date +%F)