
Use RSYNC to copy changes in sda to sdb -- [*SOLVED*]
Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
And of course you have to exclude /media, too 

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
Oh yeah, good point.
Thanks!

Code: Select all
rsync -avx --exclude=/dev --exclude=/proc --exclude=/media / /media/disk

Last edited by Dennola4 on 15. Sep 2010, 02:58, edited 2 times in total.
There are no stupid questions.
Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
As an addition to this thread, I can also advice the use of the alternate software: backintime
As also an alternate method, why not using software RAID in mirror?
As also an alternate method, why not using software RAID in mirror?

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
Because RAID is not a backupJRD wrote:why not using software RAID in mirror?

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
you're right. I just don't know the reason of the poster whereas he searched for a backup solution or a redondance solution.

Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
I looked at backintime, but since Slackware already comes with rsync, and since rsync is capable of doing what I need, the only obstacle would be my own ignorance. Therefore, time to learn rsync. 
I actually have two more questions. Sorry, but I really want to understand what I'm doing rather than just copying and pasting code.
1) I notice that in the rsync line you offered....
..../media/disk doesn't end with a trailing backslash, like this: /media/disk/ and I am wondering why not.
2) As you know, /home/dennis is on a separate partition. So when I mirror that sda partition to the corresponding sdb partition , do I use the same type of rsync line? In other words, would I run:
....OR:
...OR none of the above?? Thanks for your patience in answering these questions.


I actually have two more questions. Sorry, but I really want to understand what I'm doing rather than just copying and pasting code.
1) I notice that in the rsync line you offered....
Code: Select all
rsync -avx --exclude=/dev --exclude=/proc / /media/disk
2) As you know, /home/dennis is on a separate partition. So when I mirror that sda partition to the corresponding sdb partition , do I use the same type of rsync line? In other words, would I run:
Code: Select all
rsync -avx /home/dennis /media/disk-1/dennis
Code: Select all
rsync -avx /home/dennis/ /media/disk-1/dennis/



Last edited by Dennola4 on 15. Sep 2010, 03:00, edited 2 times in total.
There are no stupid questions.
Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
It doesn't matter, unless for some very poorly written programs scripts maybe. But then they usually do something like this "/some/path" + "file" = "/some/pathfile" instead of doing "/some/path" + "/file".
In the first form /some/path may be a directory or a file.
In the second form /some/path/ must be a file.
Try this (best run it in a separate, empty directory):
So for directories it doesn't matter whether there's a leading slash or not but for files it does and for symlinks/soft links too.
I can even build crazy paths like that last ls command and can use as many slashes as I want.
In the first form /some/path may be a directory or a file.
In the second form /some/path/ must be a file.
Try this (best run it in a separate, empty directory):
Code: Select all
set -x
echo "blob" > blub
cat blub
cat blub/
rm blub
mkdir blub
touch blub/dennola
ln -s blub blob
ls -l blob
ls -l blob/
ls -l ./blob/../blub/..////blob
rm blob
rm -r blub
set +x
I can even build crazy paths like that last ls command and can use as many slashes as I want.
Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
Shador: I have to correct you here
For rsync the trailing slashes are very important on the source dir.
rsync -av /home /backup creates a folder home inside of /backup.
rsync -av /home/ /backup syncs the content of home directly to /backup.
These 2 commands do the same:
rsync -av /src/foo /dest
rsync -av /src/foo/ /dest/foo
EDIT:
rsync -avx /home/dennis /media/disk-1/dennis would result in a dir structure /media/disk-1/dennis/dennis
rsync -avx /home/dennis/ /media/disk-1/dennis/ is OK. The trailing slash on the destination directory is not needed but does not harm.

rsync -av /home /backup creates a folder home inside of /backup.
rsync -av /home/ /backup syncs the content of home directly to /backup.
These 2 commands do the same:
rsync -av /src/foo /dest
rsync -av /src/foo/ /dest/foo
EDIT:
rsync -avx /home/dennis /media/disk-1/dennis would result in a dir structure /media/disk-1/dennis/dennis
rsync -avx /home/dennis/ /media/disk-1/dennis/ is OK. The trailing slash on the destination directory is not needed but does not harm.
Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
Ok thenktor. I think I've got it.
There's still one thing hurting my brain. In the command:
the source actually IS a leading slash (being the character representation of the root directory). So are we to just understand that a trailing slash is implied?
I hope I don't seem obtuse, I just can't seem to get rsync syntax clear in my mind and I would rather not bork my back-up HDD because I was too timid to ask specific questions..
Thanks again.

There's still one thing hurting my brain. In the command:
Code: Select all
rsync -avx --exclude=/dev --exclude=/proc --exclude=/media / /media/disk
I hope I don't seem obtuse, I just can't seem to get rsync syntax clear in my mind and I would rather not bork my back-up HDD because I was too timid to ask specific questions..
Thanks again.

Last edited by Dennola4 on 15. Sep 2010, 03:06, edited 3 times in total.
There are no stupid questions.
Re: Use RSYNC to copy changes in sda to sdb -- [SOLVED]
It's a leading and a trailing slash 
