I’ve been looking around at ways to do online linux image backups. Not so easy to do a reliable backup while online (the system is running) because processes will have uncommitted data in memory and open files.
Avoiding Restore
Sysadmins swear by image backups, since they can blindly recover a system in one operation. If you control access to a server, in an ideal world you could probably log what is installed on a server, develop a build process, and just back up the data instead of doing image backups. Package managers, make, cf engine can help with that.
Large corporations reduce the need for backup-restore by using redundant systems: striped and mirrored disk arrays with redundant power sources and/or mainframes.
RAID1, RAID 0+1 and RAID6 can reduce the likelihood of needing a restore, but you still need backups in case of file deletes or corrupted controller cards.
SMART disk monitoring can often alert you when a disk is failing, but doesn’t always.
The Good Old Days: restore and fsck
In the old days, Unix sysadmins would just pick a quiet time at night for an online backup, run sync;sync;sync;dump, and if restored later run fsck and cross their fingers. Some file corruption was pretty likely at restore time.
Filesystem Snapshots
Snapshots are helpful for getting a consistent filesystem but do not capture pending transactions or calculations in memory that have not been written to the filesystem yet. Those will be lost or rolled back. So application support is still very helpful. With MySQL MyISAM tables one should do a shutdown, or at least lock all writable tables before snapshotting. Or just use database replication to another server.
Veritas made a fortune selling their VxFS filesystem and snapshot feature for $50,000/copy, which would allow saving a reliable copy of the filesystem. VxFS has come down in price now, and is available as a commercial binary module for linux.
LVM2 on linux accomplishes a similar thing to VxFS snapshots. Fortunately, most kernels include it now, making installation and upgrade much easier than patching it in each time.
Acronis claims to do online image backups, but I haven’t used it. They also have some support for LVM. Apparently their image backup works by installing a custom module called snapapi.
Single-User Mode
If you can’t use those, and you want to gamble with dump or tar on a running system, then you will want help. Booting into single-user mode on linux gains you a quieter filesystem, but no network support, so interactive use will require terminal access through a keyboard and monitor or serial port/terminal server.
Terminal servers are a good idea anyway in unattended data centers because you can see panic messages that are otherwise inaccessible.
dd for offline and read-only filesystems
I use dd successfully on small volumes (under 20 GB) for offline backups. You need to boot off a cd or usb drive, then dd any partition or drive to another one of same or bigger size. It’s slow but works fine. Usually faster to just to use tar or cpio unless you’re playing with the MBR. The dd command I use is dd if=/dev/hda of=/dev/hdb bs=1048576. dd is very useful to backup and restore the MBR.
Any other recommendations?
dd
GNU ddrescue
lvm2
Amanda Backup (BSD License)
Acronis Backup (Commercial license)
MondoRescue (GPL)
Right To Your Own Devices
Backup with dump and restore on Linux mini-HOWTO
comp.os.linux.misc: Live backup of Linux server
Easy Automated Snapshot-Style Backups with Linux and Rsync
Backup and Restore Linux Partitions Using Partimage
Zmanda Backup (BSD License, software based on Amanda)
Librenix: Linux Backup Tools
Bacula: Cross-Platform Client-Server Backups
O’Reilly “Backup & Recovery”, 2007