Creating Portable DiskSafes With LoopbackFS And LVM Snapshots
Creating Portable DiskSafes With LoopbackFS And LVM SnapshotsThis is the "DiskSafe" idea used to store backups of server data. This could be used to replace physical tape volume and still provide portablility. I have found pieces of this information around the Internet but nothing putting it all together. Requirements:
How it works: 1. Create a file based block device. This file will appear to Linux as a physical device. This test has a capcity of 2GB. sudo dd if=/dev/zero of=/tmp/diskfile.bak bs=1M count=2000 2. Now we turn on LVM on this file based block device. sudo pvcreate /dev/loop0 3. And create an LVM Group. sudo vgcreate DiskBackup1 /dev/loop0 4. Display the LVM Group just to see that it worked. sudo vgdisplay 5. Now create a 1GB storage volume for testing. sudo lvcreate -L1G -nlvm1 DiskBackup1 6. Format it with your favorite filesystem. I like ext4. sudo mkfs.ext4 /dev/DiskBackup1/lvm1 7. And mount it. sudo mount /dev/DiskBackup1/lvm1 /mnt/backuptest 8. Check it out with df. Up to this point this would only need to be done once to create the disk safe. df -h 9. Create a snapshot volume. The would happen every time a new backup was run. sudo lvcreate -L500M -s -n snap /dev/DiskBackup1/lvm1 10. Dislay volumes just to see if it is working. sudo lvdisplay 11. Let mount the snapshot just to test. sudo mount /dev/DiskBackup1/snap /mnt/backupsnap At this point there is a volume we can write to and the snapshot should remain unchanged. /mnt/backuptest should be writable and /mnt/backupsnap should not be touched. These snapshots are all stored within the file /tmp/backupdisk.bak so they can be unmounted moved/backedup and remounted later. There are also some option in LVM2 to mirror volumes. Or there are tons of other possibilities. The data is stored in ext4 so you can still run fsck against it. When finished with backup export LVM group for safe keeping. sudo vgchange -an DiskBackup1 Now I just have to figure out how to get the data into the lvm. Rsync would work great for Linux. Maybe a Windows version of dd, rsync and ssh....
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning







Recent comments
5 hours 56 min ago
7 hours 57 min ago
11 hours 8 min ago
13 hours 27 min ago
14 hours 38 min ago
15 hours 56 min ago
20 hours 17 sec ago
23 hours 33 min ago
23 hours 45 min ago
1 day 14 hours ago