Syncronizing /home folder and USB-disk with rsync

24 06 2009

Rethorical question: What happens if your harddrive fails … right now!?

I never came to experience this and there were few moments when this ‘Black Swan’ would have caught my off guard. Usually I use to work on plenty of platforms in different location and ‘my life’ is stored on a USB memory, which I never give away… wonder when there will be tranplants ]:)

Anyway. Then the rethorical question condenses to … if your USB disappears … or whatever… this said:
Backup is essential

After fidling a lot with copying files forth and back (I really did it all to long, before googling a solution) my tool of choice became rsync.

I mirrored my home folder /home/reinhard/ to a USB memory /media/USB/.

Now I do the following:

After I worked some time local on my laptop I do:
rsync -au --exclude '.*' /home/mylogin/ /media/USB/

When working on another machine using the USB disk I do:
rsync -au /media/USB/ /home/mylogin/

That’s it.

Now put everything into a little script:

#!/bin/bash
rsync -au --exclude '.*' /home/mylogin/ /media/USB/
rsync -au /media/USB/ /home/mylogin/
sync;sync;sync;
umount /dev/sdb1

and bind it to a keyboard shortcut (I like Super – z) and the USB memory gets updated and safely removed in an instant.

That’s not really advanced and there are a lot of great tutorials on this topic, but it is my workaround for now.


Actions

Information

One response

23 07 2009
cwRsync – Transparent Backups in Windows XP « Rforge

[...] cwRsync – Transparent Backups in Windows XP 23 07 2009 The Unix tool rsync turned out to be a fast and reliable way to backup my /home folder to an USB-disk. [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.