From #myoss @ freenode.net
<kaeru> what do linux people do for full backups?
<kaeru> freebsd there is dump/restore
<kaeru> do people use that for ext3 still or is there a better way?
<sweemeng> kaeru rsync?
<kaeru> I mean disk level snapshots
FreeBSD ufs2, as what we use in Inigo's Gambit, can easily create snapshots of a live filesystem using dump. However, ext2/ext3 used widely in Linux does not have such feature (as far as I know). But for those who want such feature, fear not, there is a feature in LVM called snapshots which more or less provide a similar thing.
Fedora/RHEL/CentOS users might be familiar with the term LVM as the 3 distros uses LVM by default in their default installation partitioning scheme. Some people think LVM by default is a painful thing, but to me, its the opposite (until you need to get it to work with dualboot windows+linux env).
Back to the topic, here's a little guide for those who want to do a full disk image backup using LVM on a live system.
- A system that uses LVM as its partitioning scheme (obviously).
- The filesystem must be a LVM managed partition
- Some free unallocated space in the LVM VolumeGroup
This guide will take the assumption the partition you want to backup is `/dev/VolGroup/MyVolume`.
Creating a Snapshot
Creating a snapshot is pretty straightforward.
/usr/sbin/lvcreate -s -L512M -p r -n SnapshotVolume /dev/VolGroup/MyVolume
This will create a readonly snapshot of MyVolume as /dev/VolGroup/SnapshotVolume with 512MB extension.
Once a snapshot is created, you may do anything you wish with `/dev/VolGroup/SnapshotVolume`. eg: use dump or dd the snapshot, or simply mount the snapshot and tar its contents.
Once you've done doing your backup, you may remove the snapshot easily using.
Ok thats it. Have fun.
For more reading, I recommend the LVM-HOWTO at tldp.org