0

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.

2
  • DId you consider simply making an image of the partitions via dd?
    – Bobby
    Commented Apr 30, 2012 at 13:19
  • dd is neither space, nor I/O efficient under a live running system.
    – bayindirh
    Commented May 7, 2012 at 13:01

2 Answers 2

1

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.

1
  • Linux Volume Snapshots looks like what I want, I'll look more into that, thanks.
    – bayindirh
    Commented May 1, 2012 at 9:33
0

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

:)

1
  • 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 :)
    – bayindirh
    Commented Apr 30, 2012 at 6:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .