0

I have a home file server in the following configuration:

  • 4 HDDs of 2TB each
  • 1 USB flash drive running the Debian OS of 8GB

I would like to make a full disk backup of the OS flash drive to another (non-identical) 8GB+ flash drive mounted in the OS. I'd like to do this without having to physically or manually access the server by just setting up a scheduled automated task to perform the backup.

What I've found while searching for a solution is that the main issue with this relates to not being able to prevent writes to the file system for the duration of the backup; which can then potentially corrupt the backup.

One possible solution would be to boot into single user mode and then use the dd utility but I don't know how feasible that would be to wholly automate. My thought would be:

  1. Cron job initiates backup, starting by rebooting into single user (runlevel 1)
  2. Somehow get to a state to be able to mount the backup drive and run the dd command?
  3. Reboot back into the normal usage mode (runlevel 2 for my system)

Then if the system fails I'd like to just remove the failed drive, plug in the backup, and replace the backup with a fresh USB drive since the backup system will also have the backup script running on it.

Does this plan seem feasible or will it not work at all? Is there some other utility out there that can provide me with a similar solution?

  • I'd probably suggest making an initial image, then keeping the systems synced over rsync. Depending on your needs, rather than a full system image, you could probably 'just' backup a few key aspects of your system this is an approach that has served me well. In the past I'd have suggested remastersys, but the current state of it is a mess - current dev ragequit, and the active fork is fairly expensive, for an unknown project. – Journeyman Geek Sep 30 '14 at 6:34
  • This seems like a decent solution. I've used Clonezilla before for system images, but then you just get an image file that you can't mount and incrementally update; as far as I'm aware. Is Clonezilla (or some other tool) able to image a disk onto another disk in a usable state? – Alex Sep 30 '14 at 14:21
1

Since you are using Linux, why wouldn't you use LVM? You just need two (or more) identical hard disks then create a mirrored copy of your volume groups. Then if one disk fails, split the mirror, pop another disk in and you're good.

Doing a dd copy is one of the worst ways of doing a backup. First, it'll likely copy any corruption it comes across, second, it copies the whole disk, including any blank sectors taking up a lot time, 3rd, if you have a disk failure on the primary while creating a backup, your backup is toast.

I use a free backup client/server called burp which has a lot of really nice features. You can run the client and server on the same box and have your destination to be an external disk.

I have a VPS in the US and the UK. Every night I export my MySQL databases, then I backup all the important files such as /etc, /home, /var/www, /var/named, and a few other places.

burp also handles deduplication for you, so if your files don't change, you don't need to do a complete backup.

So, in summary, LVM mirroring provides a level of redundancy, followed up by remote incremental backups for the odd deleted file or a need to recover from failure.

0

You won't be able to switch to single user and make a backup on the same cron job. But you switch manually to single user and make a cron job that checks if you are in single user, make the backup and then switch to level 2 again.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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