LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-15-2007, 02:44 AM   #1
antis
Member
 
Registered: Nov 2004
Location: sweden
Distribution: Arch
Posts: 67

Rep: Reputation: 15
Using rsync to backup system. Good or bad?


Hi,

Some background first maybe...
I'm running a small server at home for mainly media and entertaing purposes. The system runs off a microdrive of 4Gb but the data on the drive is rarely over 1Gb. I keep the rest on a separate drive.

I have run this set up successfully for 6-8 months now but I can't get over the fact that using a microdrive still feels a bit shaky. I'd hate to do the install all over again in case of a crash so therefore I've been thinking about setting up a cronjob that backs up the entire disk maybe every two days or so.

I could probably use a raid1 set up but it feels abit overkill so I've been looking at using rsync for this.

My idea is to use something as simple as:
Code:
rsync -u -a --delete --exclude "sdb1" / sdb1/
Would this be a good idea?
If the drive should crash, would I be able to just buy a new one, set up the partitions and rsync it back and have a working system? Of course I'll have to activate a swap partition and install a boot loader... but is this a good idea or should I just toss it in the bin and work something else out?

Last edited by antis; 09-15-2007 at 02:46 AM.
 
Old 09-15-2007, 04:15 AM   #2
lakris
Member
 
Registered: Sep 2004
Location: Stockholm, Sweden
Distribution: Ubuntu, RedHat, SuSe, Debian, Slax
Posts: 102

Rep: Reputation: 15
just thinking out loud here... if You get an identical disk You can first go with dd to make an identical copy, preferably by working from a live cd/floppy. Then You will get everything including partitions and grub.
Then run in normal mode and cron Your rsync, but also exclude /proc. Very important!
 
Old 09-15-2007, 04:18 AM   #3
serafean
Member
 
Registered: Mar 2006
Location: Czech Republic
Distribution: Gentoo, Chakra
Posts: 871
Blog Entries: 9

Rep: Reputation: 103Reputation: 103
Hi,

In my opinion, rsync is indeed the way to go in your case. I'd only suggest adding the -r option (recursive).

Seeing you want to rsync your / directory, in the case of a crash an rsync the opposite way would do the trick (actually, for this I suggest using the dd command).

Serafean
 
Old 09-15-2007, 06:54 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
I use rsync and it works great for backing up the system.
If you are running it from the OS that is live, then you need to exclude some things like /proc and /sys and any drives which are mounted in /mnt .
The x option does that nicely.
Code:
rsync -xav / /mnt/new_root_location
When you go to restore, a person would kind of assume that your system drive has died. In that case, you need to boot to a Linux live-cd and mount the backup location and the new drive partition before running rsync.
 
Old 09-15-2007, 07:18 AM   #5
antis
Member
 
Registered: Nov 2004
Location: sweden
Distribution: Arch
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks for the replies so far. Looks like rsync is the way to go then.

Just a few more questions though.
My backup location will be mounted on /mnt so have I understood things correctly if I say that using the x option would make the exclude option unnecessary?

Would something like this work?
Code:
rsync -uax --delete  / /mnt/sdb1/
 
Old 09-15-2007, 07:29 AM   #6
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Yes, the x causes it to skip mounted partitions. So, hopefully, sdb1 is actually mounted in /mnt .
If I use delete, I also use after so it's at the bottom of the list where I can easily see it.
Leave the last / off from the destination...
Code:
rsync -xav --delete-after  / /mnt/sdb1
 
Old 09-15-2007, 11:56 AM   #7
antis
Member
 
Registered: Nov 2004
Location: sweden
Distribution: Arch
Posts: 67

Original Poster
Rep: Reputation: 15
Alright, I've made a small script and took it for a test run and it worked beautifully. This will now run at 4am every Monday, Wednesday and Friday as a cron job.

But... what does it actually mean that I am not including /proc / and /sys in the backup? Will these directories be created automatically if I make a restore and boot the OS or do I have to take any extra steps?
 
Old 09-15-2007, 12:13 PM   #8
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
It will actually create the folder, just not the stuff inside it.
From the command: man rsync
Code:
...
it  includes  an empty  directory  at each mount-point it encounters
 (using the attributes of the mounted directory because  those  of
 the underlying mount-point directory are inaccessible)...
The system folders /proc and /sys are dynamically populated at bootup on the original or the restored system.

Glad it works for you! Hopefully, you will also test the restore part.
I would do that to another hard drive and make sure it boots and runs ok for you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync backup system baronsam Linux - Software 9 05-22-2010 10:57 AM
Using RSync to backup a secondary off-site backup server pezdspencer Linux - Software 4 06-29-2007 03:40 PM
Operating system on RAID - good idea or bad? BrianK Linux - General 4 05-07-2007 01:01 PM
Using rsync to backup data. Best way to backup folders? Micro420 Linux - General 2 11-23-2006 01:13 AM
Is there a good uninstall system when you install from source? My PATH is getting bad JoeLinux Linux - Software 3 05-08-2002 01:49 AM


All times are GMT -5. The time now is 01:25 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration