Monday, September 13, 2010

Backup with rsync

Millions of years after the last post I decided to make it come to live again, lets see for how long.

Simple, simple thing to start the new era, that's how I am usually making the backups from my work directory in my machine to the external disk:

rsync -av --link-dest=/Backups/2010-09-07/ ~/Work/ /Backups//2010-09-08/

This way everything that already exists in the previous backup (2010-09-10 directory) will be hard linked to the new backup, so my space is not all wasted and I can keep track of what was changed from backup to backup.

That's funny how the size is shown when you use those hard links:

$ mkdir 1 2
$ dd if=/dev/zero of=./1/somefile bs=1k count=5120
5120+0 records in
5120+0 records out
5242880 bytes (5.2 MB) copied, 0.0218812 s, 240 MB/s

$ ls -lrth *
2:
total 0

1:
total 5.0M
-rw-r--r-- 1 andre wheel 5.0M Sep 13 17:32 somefile

$ ln 1/somefile 2/somefile-hard-link
$ ls -lrth *
1:
total 5.0M
-rw-r--r-- 2 andre wheel 5.0M Sep 13 17:32 somefile

2:
total 5.0M
-rw-r--r-- 2 andre wheel 5.0M Sep 13 17:32 somefile-hard-link

$ du -ksh *
5.0M    1
0       2

$ rm 1/somefile

$ ls -lrth *
2:
total 5.0M
-rw-r--r-- 1 andre wheel 5.0M Sep 13 17:32 somefile-hard-link

1:
total 0

$ du -ksh *
0       1
5.0M    2

Nice, hm?

4 comments:

Anonymous said...

Excellent blog here! Also your web site loads up very fast!
What host are you using? Can I get your affiliate link to your host?
I wish my website loaded up as quickly as yours lol


how to build muscle

Anonymous said...

I'm really enjoying the design and layout of your blog. It's a very easy on
the eyes which makes it much more enjoyable for me to come here and visit more often.
Did you hire out a designer to create your theme?
Exceptional work!

home based mlm business opportunity

Anonymous said...

I think this is one of the most significant information for me.
And i'm glad reading your article. But wanna remark on some general things, The website style is great, the articles is really excellent : D. Good job, cheers

Here is my website; fast muscle building

Anonymous said...

Hello to every one, the contents existing at this web site are in fact remarkable for people knowledge,
well, keep up the nice work fellows.

My web blog - Levela And Auravie