Jump to content

rsync help [solved]


Recommended Posts

Im trying to set up a simple rsync script to copy from one hard drive to another local backup hard drive. The drives are as follows:

 

\media\storage1

\media\storage1b

 

where storage1 is the main HD and storage1b is the backup. I want this to do the backup whenever I tell it to and I want it set so that what ends up being on storage1b is the exact same as storage1. I dont want the backup drive to keep files that Ive deleted on the primary drive.

 

At the moment Ive just run

rsync -av \media\storage1\ \media\storage1b\

and its building the file list, so I dont know what itll do at the end.

 

By the way, anyone know why everytime I press the apostrophy and the backslash key while using the writer on this board that the QuickFind keeps popping up? My arrow keys and Home\End keys dont work either.

 

 

[moved from Software by spinynorman]

Edited by Scythe
Link to comment
Share on other sites

I dont want the backup drive to keep files that Ive deleted on the primary drive.

 

You may need to add the --delete option to the rsync command.

 

What I did when I started using rsync was to run grsync. This is a gui which let's you select some of the most common options. Importantly, it displays the command line that it creates for you. You can then look up the options that are being used, in the man page, to better understand them. (The man file for rsync is, I found, rather daunting to read through, unless you know what you're looking for.)

 

It's probably also a good idea to set up a test folder, and run the command on that first. rsync also has the -n parameter which will cause rsync to do a "dry run". It will report what it would do without actually doing anything.

 

Jim

Edited by jkerr82508
Link to comment
Share on other sites

You may need to add the --delete option to the rsync command.

 

What I did when I started using rsync was to run grsync. This is a gui which let's you select some of the most common options. Importantly, it displays the command line that it creates for you. You can then look up the options that are being used, in the man page, to better understand them. (The man file for rsync is, I found, rather daunting to read through, unless you know what you're looking for.)

 

It's probably also a good idea to set up a test folder, and run the command on that first. rsync also has the -n parameter which will cause rsync to do a "dry run". It will report what it would do without actually doing anything.

 

Jim

Yeah, I was trying to read the rsync man page and just got more confused. I'm trying to install grsync, but compiling it from the tarball says I need GTK+-2.0, which I could swear is already installed. And I can't find a Fedora RPM for it just yet, but I'm still looking.

 

 

You may want to look at this post and the following posts too, related to rsync backups and backup in general:

https://mandrivausers.org/index.php?s=&...st&p=315575

 

Yves.

I was reading this earlier but I can't decipher the scripting. Scripting isn't my forte, that's for sure.

Link to comment
Share on other sites

You don't have to understand the script (although you can if you want) ;)

Just save the script, run it with the -h parameter (help), and if you see any use to it, configure CRON or ANACRON to execute it when you want (Mandriva has a GUI for cron in the MCC).

 

I wanted to upload the script, but it seems I'm "not permitted to upload this type of file"...

 

Yves.

Link to comment
Share on other sites

There's a program called mirdir that is perfect for what you want. It's very easy to use and it compares your backups to the original and makes an exact duplicate. I don't know if it's available in easy-urpmi or not but here's a rpm for it. http://sourceforge.net/project/showfiles.p...ckage_id=146026 I just set it up as a cron job on my gentoo box and don't have to worry about backups.

Link to comment
Share on other sites

Here's a recent article on rsync usage:

 

http://www.linux.com/feature/117236

 

You should also not that if you are backing up a linux filesystem to a FAT32 filesystem you can run into problems since FAT32 does not support owners, groups, symbolic links, etc. To get around these problems and not get a ton of error messages use this:

 

rsync -rvt --modify-window=1 --delete

 

instead of:

 

rsync -av --delete

 

when backing up a linux filesystem to a FAT32 fielsystem with rsync.

Link to comment
Share on other sites

  • 3 weeks later...

I found that mirdir works like a charm for what I need. Is there any way to get it to something like a program shortcut so that I don't have to type it in the command line each time? All I need it to do is run the command:

 

mirdir -e none /media/storage1 /media/storage1b

 

And the way I have my hardware set up I can't run it as a cron job.

Edited by Scythe
Link to comment
Share on other sites

So if I do a "Link to Application...", set the work path to where I saved the script, and set the command as "sh script.sh" it should run the script?

 

Will it open up a terminal to do this? I like the verbose mode when backing my stuff up. It's nice to know what's going on ;-)

Link to comment
Share on other sites

I keep my scripts in a folder (aptly named) scripts in my home directory and then I just open a terminal and cd into it and then just run sh script.sh and you can watch it do it's work. Sorry if I wasn't clear before. :)

Link to comment
Share on other sites

So if I do a "Link to Application...", set the work path to where I saved the script, and set the command as "sh script.sh" it should run the script?

You should be able to create a shortcut without using the script. Just put the mirdir command in the command line.

 

Will it open up a terminal to do this?

I think there's an option to open a terminal when you create the shortcut - not in Linux at the moment...

Link to comment
Share on other sites

You should be able to create a shortcut without using the script. Just put the mirdir command in the command line.

 

 

I think there's an option to open a terminal when you create the shortcut - not in Linux at the moment...

 

I thought I tried that and it didn't work...obviously not. I just tried it and it worked great. The option is under "Advanced Options."

 

Thanks everyone for the help. Case closed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...