LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-14-2008, 07:03 AM   #1
moob8
Member
 
Registered: Sep 2006
Distribution: slackware
Posts: 132

Rep: Reputation: 15
thoughts on restore from an rsync "image"


Note:

In this post I'll be using the term "attributes" to refer to the various properties of files. Files can include files, directories, nodes, fifos, whatever linux thinks a file is. By "attributes" I mean the read/write/etc flags, as well as ownership, group, file date, suid, and whatever other flags/stuff linux has on each file.

Background:

In the past I've used tar (booted off a livecd) to to do a complete and total backup of my linux. I've had hard drive failures and/or data migrations that caused me to restore from the tar backups (thus testing/verifying this method). They worked fine. All file attributes were correctly preserved. Whew: it worked!

Complete and total tar of a linux system is a bit of a PITA so I decided to use rsync to make a quicker weekly (or so) backup of the running system to an external drive. benefits: (1) only the files changed are written to (or deleted from) the external disk, saving a lot of time and (2) I can run it within the running linux.

I then had a hardware problem which necesitated a wipe and restore. From a livecd I copied the files from the external drive onto the new HD. To insure a proper copy (IE, to preserve ALL file attributes) I piped two tar processes instead of using cp.

In the new restored system, I've been having problems which I have been fixing, one at at time. First, there was no dev and no proc directory. I'd told rsycn to skip them for reasons that made sense at the time. Making a dev and proc allowed the kernel to boot without panic. Xorg refused to run and it turned out (from a google search) that I needed to perform a chmod for "u+s" on the actual Xorg program itself. su doesn't work for non-root and I don't have the ability to access the sound device. My guess is that some sort of protection/attribute thing was lost to some files during the rsync and that I will stumble onto additional problems.

So ... to the actual specific questions
  • Can rsync be used to do a total backup (ie, all files, and all flags/attributes) that can later be used to do an total restore to a blank partition?
  • If the answer to above is a "yes", what command line arguments did you pass to rsync? How did you run rsync?
  • Based on all I have written, what files/dirs in my system need their attributes/protection changed? And in what way?
Thank you in advance.
 
Old 10-14-2008, 07:42 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Quote:
From a livecd I copied the files from the external drive onto the new HD.
I don't think you're supposed to do that. You're supposed to use the 'Install to HDD' option if there is one.
/proc is a window into the kernel, you shouldn't try to copy it, its pointless. /dev is the device drivers.
The install will create those 2 dirs (and others eg /var /home etc) for you.

Basically you install the OS, then restore your personal progs/data and any customised configs etc.

Last edited by chrism01; 10-16-2008 at 07:26 PM.
 
Old 10-14-2008, 10:19 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 151Reputation: 151
What command did you use to rsync the data to the external drive? I use something like this:
Code:
/usr/bin/rsync --archive --delete --progress /[a-o]* /zzz/20081015
/usr/bin/rsync --archive --delete --progress /[q-r]* /zzz/20081015
/usr/bin/rsync --archive --delete --progress /sbin /zzz/20081015
/usr/bin/rsync --archive --delete --progress /[t-y]* /zzz/20081015
mkdir -pv /zzz/20081015/{proc,sys}
chmod 0555 /zzz/20081015/proc
chmod 0755 /zzz/20081015/sys
--archive means it preserves permissions and file-types, it's the same as -rlptgoD according to the man page. To copy them back you could either use rsync again or cp -a
 
Old 10-15-2008, 09:15 AM   #4
sfxpt
Member
 
Registered: Feb 2008
Distribution: Debian Testing
Posts: 99
Blog Entries: 3

Rep: Reputation: 16
Quote:
Originally Posted by moob8 View Post
  • Can rsync be used to do a total backup (ie, all files, and all flags/attributes) that can later be used to do an total restore to a blank partition?
  • If the answer to above is a "yes", what command line arguments did you pass to rsync? How did you run rsync?
  • Based on all I have written, what files/dirs in my system need their attributes/protection changed? And in what way?
1 - Yes, absolutely.

2 - rsyn -vuaCH --delete --delete-excluded

Note -H is *very* important! and you might want to omit the -v.

3 - Nothing, if the above rsyn cmdl is used. Just make sure your backup disk is of Linux format, not brain-deaded Windoze fat ones.

Also, FYI, rsyn can allows you to do incremental backups as well. So you can restore to any backup time, without taking too much of the backup space. Check rdiff-backup.

Last edited by sfxpt; 10-15-2008 at 09:17 AM.
 
Old 10-16-2008, 09:18 AM   #5
moob8
Member
 
Registered: Sep 2006
Distribution: slackware
Posts: 132

Original Poster
Rep: Reputation: 15
Thanks for the replies. I'm still digesting them (must consult man pages to see what the rsync switches mean in your replies, etc.).

I'd still like to get this to wok for future restores. The tried and true method of taring the liinux (while booted off a live cd) just takes so long and it ties the machine up.

p.s. the rsync command from my backup script was ....
Quote:
rsync \
--exclude-from=/root/pcc_rsync_skip_dirs.txt \
--delete --specials --devices --progress -rlHptgo \
. $USE_DIR/nix_backup 2>> /root/pcc_backup_log.txt && \
where use dir is the name of the mounted direcotry of the external HD to backup to (which is ext3, btw, so that all permissions and stuff can (in theory) be retained correctly).
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restore files from "dd" image MaaSTaaR Linux - General 19 07-01-2011 12:42 AM
Trying to convert VMWare image to raw using Qemu: error - "image open" JamesHall Linux - Software 1 07-22-2008 04:59 AM
Any thoughts on minimum requirements to successfully execute an "openvt"? lumix Linux - General 1 05-01-2008 09:51 PM
How might I restore kmail folders/mail/settings from a "badly" saved "home"? deh6 Linux - Software 5 03-08-2008 09:25 PM
[SOLVED] Security and "sudo" -- n00b wants your thoughts MBA Whore Ubuntu 31 10-17-2006 07:58 PM


All times are GMT -5. The time now is 11:47 PM.

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