| | 24 | == snapshotting the filesystem to back up == |
| | 25 | |
| | 26 | we already have the `dm_snapshot` kernel module loaded. So now we can snapshot the volume that the target filesystem resides on: |
| | 27 | |
| | 28 | {{{ |
| | 29 | ## remember the date because it will be useful: |
| | 30 | TODAY=$(date +%Y%m%d) |
| | 31 | lvcreate --snapshot --size 100GB --name calhome.$TODAY /dev/vghome_jupiter/calhome |
| | 32 | }}} |
| | 33 | |
| | 34 | Note that if more than 100GB changes on `/dev/vghome_jupiter/calhome` while we have this snapshot in place, the original filesystem will choke! So we shouldn't keep this around for much longer than it takes to run a backup, probably (though it would be nice to save it as a `.yesterday` directory and make it accessible for the users or something... i'm not sure how to do that properly without risking breakage. Also, i'm not sure how you'd be able to properly unmount it across machines. |
| | 35 | |
| | 36 | Next we mount the snapshotted volume: |
| | 37 | |
| | 38 | {{{ |
| | 39 | mkdir -p /var/local/backups/calhome.$TODAY |
| | 40 | mount -o ro /dev/vghome_jupiter/calhome.$TODAY /var/local/backups/calhome.$TODAY |
| | 41 | }}} |
| | 42 | |
| | 43 | == running the backup == |
| | 44 | |
| | 45 | now that we have a snapshot, we can mount the removable LVM volume: |
| | 46 | |
| | 47 | {{{ |
| | 48 | mkdir -p /var/local/backups/calhome-target.$TODAY |
| | 49 | mount /dev/vgbackup0_jupiter/backup0 /var/local/backups/calhome-target.$TODAY |
| | 50 | mkdir -p /var/local/backups/calhome-target.$TODAY/srv/calfs/home |
| | 51 | }}} |
| | 52 | |
| | 53 | and then run the actual backup: |
| | 54 | |
| | 55 | {{{ |
| | 56 | rsync -a /var/local/backups/calhome.$TODAY/ /var/local/backups/calhome-target.$TODAY/srv/calfs/home/ |
| | 57 | }}} |