Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've recently installed an SSD to my system and moved part of my Linux installation to it. To be on the safe side, I want to backup my whole root filesystem with rsync (just a clone, no versioning, no incremental backup or anything) but I've some problems in my mind.

  • My filesystem is distributed. /var and /tmp is on different disks.
  • I know some root directories are virtual but do I need to exclude them? (/proc, /dev, etc.)
    • If I exclude them, do I need to create dummy / blank versions on backup drive?
  • Or is there any simple tool to automate this process.

The question is, can I simply use rsync with a bunch of switches and excludes to backup a live linux system or should I use any other tools to do that?

Thanks in advance.

P.S: I'm fluent in Linux. Advanced / tricky methods are not a problem.

share|improve this question
    
DId you consider simply making an image of the partitions via dd? –  Bobby Apr 30 '12 at 13:19
    
dd is neither space, nor I/O efficient under a live running system. –  SilentStorm May 7 '12 at 13:01

2 Answers 2

up vote 0 down vote accepted

I know some root directories are virtual but do I need to exclude them? (/proc, /dev, etc.) If I exclude them, do I need to create dummy / blank versions on backup drive?

Yes, you'll need to exclude them.

In terms of whether there should be dummy versions - in order for your init scripts to mount them, those directories will need to exist as empty folders. So yes - you'll need to include stubs or empty directories.

The question is, can I simply use rsync with a bunch of switches and excludes to backup a live linux system or should I use any other tools to do that?

You can, for example, I'll often run a backup with rsync -av --delete /src /dst; however, be aware that rsync doesn't handle locking/concurrent access at all. You'll get all kinds of run if you write to files that are currently in use.

There is one way around that, of course. Assuming no writes are currently occuring, you could execute:

/bin/mount -no remount,ro /dev/rootdevice

before your rsync, then:

/bin/mount -no remount,rw /dev/rootdevice

afterwards (as root).

If you want to do backups of a truly live, write-supporting file system you need something that can do copy-on-write, e.g. Linux Volume Snapshots.

share|improve this answer
    
Linux Volume Snapshots looks like what I want, I'll look more into that, thanks. –  SilentStorm May 1 '12 at 9:33

I would say use cpio to create an archive, and copy that. I say cpio because its used for initial ramdisks so it understands virtual directories. Try

find / -depth -name | cpio -o >/path/archive.cpio

:)

share|improve this answer
    
Acrually, I'll not carry my system to anywhere. It'll be a daily cron job to keep my system safe. While cpio looks nice, I'd need to modify find heavily to exclude some folders since both some folders store ~1TB of data and my home is backed up with an rdiff based tool. I'd like to see other answers or alternatives before implementing your idea :) –  SilentStorm Apr 30 '12 at 6:04

Your Answer

 
discard

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.