9

I rsync my disk live, I mean I'm making a rsync backup of the machine I'm using.

Is it ok, safe, wise ? or very not ? Is it risky, if I want to use this backup for restoring or cloning then ?

14

rsync does not maintain file consistency like e.g. a database does; a file is copied as it is at the time rsync opens it, and as rsync can run for very long times, the file may have been changed since the time you started rsync. Whether this is "risky" is up to your assessment.

One of the ways to mitigate this risk is to run the same rsync command twice (or more) in a row, to keep track of any changes that were made since the start of the command. But if you absolutely need to maintain file consistency, you should mount the disk read-only for the duration of the rsync process.

  • Thanks @Jos I simply need a static daily/weekly backup, it seems rsync is ok to me. – 3pic Jul 13 '15 at 10:15
  • @3pic: Ubuntu may have set up LVM for you. If so, you can do LVM snapshots and back up from those... If not, it's possible (though non-trivial) to convert to LVM in place. This superuser question talks about it. – T.J. Crowder Jul 13 '15 at 15:12
  • @3pic I wouldn't assume it's safe for backup. If half of your folder is archived before some change, and the other half after it, you may end up with projects impossible to open due to broken links (like SVG file with linked bitmap, but no bitmap present, or some header included in .c file, but header file not there, or binary that expects library in another version than one you grabbed, and so on). – Mołot Jul 13 '15 at 20:28
  • That's what live CDs (or a simple version of Linux installed on another partition) are for. You reboot from the live CD/partition, run the backup (using any tool you prefer) on your main partition and then reboot as normal. This way, your source partition is static and everything is in sync. If you use separate partitions for things like /home and other data, then your backup of / will take very little time. You can do /home the same way although that may take a bit longer. I use an additional separate data partition to make /home easier to manage as well. – Joe Jul 15 '15 at 21:39
8

Slightly different opinion to Jos... I'd say that if you need an active backup, use a filesystem that allows snapshots, like BTRFS. Its copy-on-write behaviour allows for instant snapshots of a system, which you can then create a remote backup with.

That still has the same problems as other active backup strategies though: if it isn't on the disk, it's not going to get backed up. Some applications buffer their work in memory before writing to disk (and need poking to write). Which of these really apply to you is debatable.

But there isn't anything inherently unsafe about copying files off a rw-mounted partition. Even one with a clunky old format.

  • 1
    thanks. Actually by system is already based on existing FS for months... I wont change it, but it is of interest. – 3pic Jul 13 '15 at 12:50

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.