My google-fu must be sucking. i havent been able to find a good solution for the following:

  • numerous Linux server on commodity hardware
  • Trying to do a recovery mirror copy to external harddrives
  • External harddrives are smaller than source harddrives, but larger than data
  • External drives are connected via usb2 (slow)
  • Servers range from 20GB of data to 400GB of data
  • Servers are remote, so hands on access is a pain
  • need to copy boot files.
  • empty external drives currently

Basicly, looking for a way to do use a ghosting solution from INSIDE a running linux server to an external harddrive, without booting a cd etc. the rsync/cpio solutions i've looked at dont work great with grub/dev/proc etc.

I understand that since the system isnt offline, it wont be a "mirror" image as files change, but thats ok.

Are there any free/commercial products that would work?


Try fsarchiver:



  • That looks to be EXACTLY what i was searching for, thank you! – DuPie Feb 2 '11 at 23:19
  • Glad I could help. I almost mentioned it in my first answer but for some reason I thought you needed to back them up remotely. – Antonius Bloch Feb 2 '11 at 23:56

To do this yourself you'd be looking at a 2 step process after an initial setup.

This initial setup is to create a filesystem on the target disk. You cant copy the filesystem itself because its formatted for the size of the disk, and plus you would have to copy the entire partition, including space containing deleted files.

So do something like

mkfs.ext3 /dev/sdb1

Now, each time you want to back up the drive, just do the following

  1. copy the bootloader

    dd if=/dev/sda of=/dev/sdb bs=446 count=1

  2. copy the filesystem

    mount /dev/sdb1 /mnt/backup; rsync -HaxX --delete / /mnt/backup/; umount /dev/sdb1

This method will involve the least amount of IO, yet will give you a bootable drive.

  • That sounds definitely doable, was concerned about the proc & dev directories, last time i tried with rsync big issues. With look at the command switches. – DuPie Feb 2 '11 at 23:18
  • 1
    "bs=446"? Bootloader? What? You're just copying the first 446 bytes of the disk, not the "bootloader". The Right Way(tm) to deal with the bootstrap environment (like, say, GRUB) would be to just install it onto the destination disk. – Evan Anderson Feb 2 '11 at 23:23
  • @DuPie - The proc and dev directories get created on boot, you do not need to back them up. @evan - you are partially correct. Depending on the bootloader there may be more of it around elsewhere. Grub however does store the entire stage 1 in the first 446 bytes of the drive. Though yes, reinstalling the bootloader is safer, especially if it doesnt reside in the MBR, but on a partition. – Patrick Feb 3 '11 at 2:54

You want to create a backup image of an online linux server?

My suggest is to use dd tunneled over ssh or netcat:

How to set up disk cloning with dd, netcat and ssh tunnel?

You may have disk consistency issues so I suggest trying to rysnc the data afterwords.

  • dd doesnt work to smaller harddrives, and there's USB harddrives attached the to machine, dont need to stream over a network. – DuPie Feb 2 '11 at 20:37
  • Have you looked at fsarchiver? fsarchiver.org/Main_Page – Antonius Bloch Feb 2 '11 at 21:38


I think I just figured out that when you say "Servers are remote, so hands on access is a pain" you're also saying that the external hard disk is attached to the remote server, not a computer local to you. I'm changing my answer to reflect my new understanding.

I'd partition the external drive to match the partition structure of the source disk closely (bearing in mind that the partition holding the majority of the data will need to be smaller since the destination disk is smaller), mark the appropriate partition active, format the partitions (make swap, etc), and use rsync to synchronize the contents of each of the source server's filesystems into each of the partitions. Using the "archive" mode argument on rsync will insure that symlinks, devices, ownership, permissions,etc , are preserved.

Once that's done install the bootloader onto the external disk. For GRUB, you're talking about getting the appropriate "hd" number and partition number for the external drive and partition, running grub, and doing a root (hdX,Y) and `setup (hdX)' (substituting in the drive and partition numbers for X and Y).

Actually test-booting it remotely is going to be a pain unless you have remote console access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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