Yes, you can back up the whole hard disk, and there are many ways of doing this. What media are you backing up to? How often are you doing backups? How fast do you need recovery to be?
–
GillesApr 10 '11 at 18:56

5 Answers
5

As already noted, there are a lot of options and which one is the best depends on your requirements.

Since your systems is on RAID1, you can simply replace one disk and let your mirror rebuild itself. The removed disk can be used as a backup copy.

In the past, for full system backups, I have used Ghost4Linux (aka G4L) and Mondo/Mindi. The former can save a partition image locally or remotely and the later can create bootable restore (+rescue) CDs or DVDs. Both have a ncurses gui, no need for command line usage.

But many times, I just copy the whole system. I mostly use rsync but here are some options that I think it's what you're looking for.

Let's assume you have two partitions, / and /var and you want a complete backup. All commands require root privileges.

This will create a new mount point for rootfs that you can now copy without worrying for other mounted filesystems like /proc or /sys or network shares.

Let's assume you have a second disk formatted with an appropriate filesystem and mounted under /mnt/backup (or an NFS on the same mountpoint). It is advised that some services should stop running, for example the mysql service or mail server, to ensure integrity of the replicated data.

The last one is kind of overkill though. tar and rsync provide a --exclude parameter for skipping files based on pattern matching, e.g. --exclude=\*.log --exclude=var/tmp. The above commands do not use compression and you will have an exact replica of your system. You can also install grub and make the backup disk bootable.

If you have limited space on your backup device or a not compatible filesystem (NTFS) or it is a CIFS mounted share, you can create a compressed tar archive.

tar -C /mnt/orig -zcf /mnt/backup/mybackup_$(date -I).tar.gz ./

or create a squashfs image which you can later loop mount and browse its contents like a normal filesystem.

Also, getting a remote backup with ssh and tar or rsync. rsync requires root access to the remote server in order to preserve ownerships, permissions, device files etc. --numeric-ids is necessary for not mixing ownerships with the remote system's users.

In most cases, a full restore will require booting with another system, preferably a Live CD, then creating/rearranging your partition scheme, coping/extracting your data back and at the installing the boot loader again.

The native way of doing this is to create an LVM layer between your partitions and the disk. LVM has the capability to create snapshots which are basically instant point-in-time instances of the disk.
The reason for this instead of just dd'ing the disk directly is that the contents of the disk may change while the dd is in progress. An LVM snapshot will not change once its created. Then after your backup is complete, destroy the snapshot.