Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 1TB external hard drive and would like to take a snapshot of the entire server periodically (maybe once a week). For cronjob part, I plan on pointing to a bash script in:

$ sudo crontab -e

but have no idea what tool I could use to make a disk image of the server while it's running. Would it have to be down while creating the image? I was looking at Clonezilla but it looks like I have to first set up a DRBL server which seems like something I don't want.

I also don't know how long it might take to run a backup or if there's any way to only do incremental changes. I plan on storing ~500GB of data there.

Do I need to format the external hard drive any particular way? Does anyone know of good tutorials/starting points?

Thanks in advance.

share|improve this question
up vote 1 down vote accepted

You can use rsync to make a copy of the entire system. It won't be an "image" per se, but it will contain a copy of all files on the system. For example, you could do:

rsync -aHAXxv / /mnt/backup/

This would copy everything in the root filesystem to /mnt/backup. (Note, it only copies one filesystem due to -x, so if you have multiple filesystems, you'd need to do multiple commands, or omit -x and use --exclude to exclude the backup path.)

share|improve this answer
thanks! I'm also looking into using tar:tar -cpzf /mnt/ServerBackups/MyDatestampedBackup.tar.gz --one-file-system --exclude=/proc --exclude=/sys --exclude=/mnt – tarabyte Oct 21 '12 at 1:29

Try fsarchiver It allows you to create live backup from partition, and multithreaded image compression. Unfortunately incremental backups are somewhat difficult with that. Maybe using rsync on dd image of partition? Consider making compressed partition image, and rsync/bacula incremental backup of some folders maybe.

share|improve this answer

It may be better to think about what you're backing up - taking a disk image would necessitate some form of trickery so as not to get it corrupt due to the running system - two ways I can think of:

  • some sort of pre-mount black magic that does an image on boot (sounds difficult) and then cron in a reboot
  • run the server under some sort of hypervisor and use snapshots controlled by the host

The other options are to backup your created data and configs, and leave the "OS bits" to be recreated by a new install - maybe you could even script the install for super-fast DR. It will save you many gigs of backup space too - meaning you can back up more frequently, and hold longer retention.

share|improve this answer

As mentioned by @yesterday you could use rsync like this:

rsync -aHAXxv / /mnt/backup/

This would create a backup auf / but not of other mounted partitions like /var So you should do this for every partition you need to backup.

But to make sure, that you have a consistent backup, you should use LVM Snapshots if available. For example:

# create snapshots
lvcreate -s vg0/root -n root_snapshot -L2G
lvcreate -s vg0/var  -n var_snapshot  -L2G
# mount snapshots to make a copy
mount /dev/vg0/root_snapshot /mnt/snapshot
mount /dev/vg0/var_snapshot  /mnt/snapshot/var
# backup all files (no need for -x here)
rsync -aHAXv /mnt/snapshot/  /mnt/backup/
# unmount the snapshots
umount /mnt/snapshot/var /mnt/snapshot
# remove the snapshots
lvremove vg0/root_snapshot
lvremove vg0/var_snapshot
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.