Use RSYNC to copy changes in sda to sdb -- [*SOLVED*]

You have a problem with Salix? Post here and we'll do what we can to help.
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]

Post by Dennola4 »

Got it.

So to finally conclude this thread, the two rsync commands I will be using (if I understood correctly) are:

Code: Select all

# rsync -avx --exclude=/dev --exclude=/proc --exclude=/media / /media/disk
to back up changes to my system as a whole, and:

Code: Select all

# rsync -avx --exclude=/home/dennis/.gvfs --exclude=/home/dennis/.gnupg /home/dennis/ /media/disk-1/dennis
to back up changes to my home directory.


8-)
Last edited by Dennola4 on 15. Sep 2010, 03:10, edited 2 times in total.
There are no stupid questions.
User avatar
Akuna
Salix Wizard
Posts: 1038
Joined: 14. Jun 2009, 12:25

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]

Post by Akuna »

Dennola4 wrote:So to finally conclude this thread, the two rsync commands I will be using...
Hmm... You may still want to let us know how it went after you actually try it out. ;)
Image
What really matters is where you are going, not where you come from.
User avatar
thenktor
Salix Wizard
Posts: 2426
Joined: 6. Jun 2009, 14:47
Location: Franconia
Contact:

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]

Post by thenktor »

If you sync home in an own rsync run you have to exclude it in the first one.
Image
burnCDDA (burns audio CDs)
geBIERt (German beer blog)
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]

Post by Shador »

No, not if it is on a separate partition an he specified -x. ;) With that filesystem even excluding /media is not that crucial.
Image
User avatar
thenktor
Salix Wizard
Posts: 2426
Joined: 6. Jun 2009, 14:47
Location: Franconia
Contact:

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]

Post by thenktor »

Hmm, proc and dev are mounted, too. Perhaps you don't have to exclude them.
Image
burnCDDA (burns audio CDs)
geBIERt (German beer blog)
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]

Post by Dennola4 »

Akuna wrote:
Dennola4 wrote:So to finally conclude this thread, the two rsync commands I will be using...
Hmm... You may still want to let us know how it went after you actually try it out. ;)
Well actually I had already tried it. I made a directory called /etc/rtest containing a file called "blah". I made a second directory called /home/dennis/rtest2 containing a file called "blah2". I ran the command:

Code: Select all

# rsync -avx --exclude=/dev --exclude=/proc --exclude=/media / /media/disk
What happened was that /etc/rtest was successfully copied as /media/disk/etc/rtest (containing file "blah") but the directory /home/dennis/rtest2 was not copied. I assumed this was because it was on a separate partition and I had invoked <-x> as per Shador's suggestion.

So I did a dry-run of:

Code: Select all

#rsync -n -avx /home/dennis/ /media/disk-1/dennis
and it showed me that directory /home/dennis/rtest2 (and file "blah2") would have copied along with all other changes, but I got an error 23 on two directories: /home/dennis/.gvfs and /home/dennis/.gnupg, which failed to copy due to permissions conflicts.

I Googled and discovered that the .gvfs is a known issue and that a work-around is just to exclude it when doing back-ups, and since .gnupg handles keyring info which I won't be changing anyway I figured I'd just exclude it as well.

Now that I'm reading your comments, I'm getting the feeling that the <-x> argument makes the exclusion of /dev /proc and /media redundant, so if I've got this right, the new commands should be:

1) For changes to the filesystem on the root partition:

Code: Select all

# rsync -avx / /media/disk
and....

2) For changes to the filesystem on the home partition:

Code: Select all

# rsync -avx --exclude=/home/dennis/.gvfs --exclude=/home/dennis/.gnupg /home/dennis/ /media/disk-1/dennis
I will go back tonight, try them, report my findings and hopefully put this thread to rest.

:-)
There are no stupid questions.
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Use RSYNC to copy changes in sda to sdb -- [almost solve

Post by Dennola4 »

SOLVED.

Given this information:

Code: Select all

dennis[~]$ cd /
dennis[/]$ ls
bin   dev  home  lost+found  mnt  proc	sbin  sys  usr
boot  etc  lib	 media	     opt  root	srv   tmp  var
dennis[/]$ cd /home/dennis
dennis[~]$ ls
Desktop  Documents  Downloads  FrostWire  Music  Pictures  SGF	Scripts  Videos
dennis[~]$ cd /media/disk-1
dennis[disk-1]$ ls
bin   dev  home  lost+found  mnt  proc	sbin  sys  usr
boot  etc  lib	 media	     opt  root	srv   tmp  var
dennis[disk-1]$ cd /media/disk/dennis
dennis[dennis]$ ls
Desktop  Documents  Downloads  FrostWire  Music  Pictures  SGF	Scripts  Videos
dennis[dennis]$ 
I was able to successfully back-up changes between the source HDD and the destination HDD (with no error messages) using the following commands:

Code: Select all

# rsync -avx --delete / /media/disk-1
and....

Code: Select all

# rsync -avx --delete --exclude=.gvfs --exclude=.gnupg /home/dennis/ /media/disk/dennis
WHEW. Well that was fun. Thanks guys.

:mrgreen: :lol: :mrgreen:

IMPORTANT EDIT on 7/4/12: the above command does NOT delete files from the destination drive which have been removed from the source drive. The updated command is here: http://www.salixos.org/forum/viewtopic.php?f=16&t=3160
There are no stupid questions.
Post Reply