After system didaster how to prepare / save most important data ?

Mike Bird mgb-ubuntu at yosemite.net
Mon May 19 16:43:25 UTC 2008


On Mon May 19 2008 09:20:55 Nils Kassube wrote:
> I would just copy the entire /home directory to the external drive. To do
> that, mount a partition of the external drive to /mnt. Then use the
> command:
>
> sudo cp -a /home /mnt

That works in most cases but the following works in more cases:

  sudo rsync -a -SHAX --delete /home/ /mnt/

Omit the "--delete" if you want to keep old files in /mnt
which no longer exist in /home.

You can omit the "AX" part if, like me, you don't use acls
or xattrs.  If in doubt, keep the "AX".

The trailing slashes are important!

If you want to see what rsync is planning to do before it
does it, insert "-v" and "--dry-run".  If the plan looks OK,
run rsync again without the "--dry-run".

And don't forget to umount the external drive BEFORE
disconnecting it!

You can use a slight variant of the above to efficiently
and securely backup over a network or even over the
internet.  Example follows, be sure that you adapt it to
use the correct IP address (or hostname) and target path
for your situation:

  sudo rsync -a -SHAX --delete /home/ 192.168.1.2:/target/

--Mike Bird




More information about the ubuntu-users mailing list