3 posts tagged “backup”
Okay, so now let's dig into that big heap of options:
-v / --verbose = very detailed output
-r = recursive (dig into subdirs)
-l = follow symlinks
-p = preserve rights
-t = preserve timestamps
-g = preserve group
-o = preserver owner
-D = do devicefiles to (only root can do that)
-a / --archive = (very common option, means:) -r, -l, -p, -t, -g, -o, -D
basically, try to keep everything as is, very common for backup purposes. Esp. if you are backing up stuff that belongs to more than one user.
-u / --update = Just do updates
Only newer Files (than the ones that are already at the Destination) are included in the run.
-n / --dry-run = Just show what you would be doing
--existing = Just update files that already are at destination. Do not
--delete = Delete everything on Dest that is not in SRC
If you have Box1 and Box2 and you are rsyncing from Box1 to Box2 then:
Box1:
File1
File2
File3
Box:
File1
File2
File4
File4 will get deleted, Files1 and 2 will be updated (if necessary) and file3 will be created)
-P (partial + progress)
--partial = Keep Partial Files
--progress = Show Progress...(d'uh)
--include=PATTERN = Copy only these files
--include-from=FILE = Same as above, but the list is stored in a file
--exclude=PATTERN = Exclude all these kinds of files
--exclude-from=FILE = Read the exclude list from file
-e [ssh] actually this means: choose an alternative over rsh if you do not use anything like this it might actually try to connect to a rsh daemon or something.
Oh and we're gonna get into the "how to configure a ssh connection" later.
But since rsh is usually not encrypted and most boxes don't even run it
since perhaps 1998 using ssh is generally a splendid idea ,)
Okay so, what does this bring us?
rsync -avz --include=*.c --include=*.h --exclude=default* /src/ sourcehost:/backup/
This will backup all the .c and .h files, except those starting off with default.
It will use Encryption for the Transfer and give you verbose output while doing it.
rsync -e ssh -avzn /home/mexiemum/ Fileserver:/backup/mexiemum/
This will just make a dry run (the -n), test if my box can save my homedir to my Fileserver
Okay, so the next part will try to bring it all together.
I don't know yet if i will really try to get into SSH(D) configuration
Okay, so you want to do backup , you're using ;)
You may want to give rsync a try.
If you do not know what rsync is i suggest you might read:
I'm not gonna go into the details of installing. Use your package management system. Compile and Install it from Source. The Homepage tells you how to do it.
So let's get to the basics.
rsync { Options } { USER@HOST:SOURCEPATH } { DESTINATIONPATH }
This will copy the stuff from user@host:/sourcepath to the DESTINATIONPATH
This basically means you can copy remote files to the local disk.
You grab your daily copy of whatever. Basically: You are PULLING a backup.
rsync { Options } { SOURCEPATH } { USER@HOST:DESTINATIONPATH }
This will copy the contents of the local directory to the given path at the given host, using the given username.
So you are PUSHING your backup.
examples would be:
(I will leave the options out for now)
rsync { Options } /var/www/mywebsite1 backup@www.my-backuphost.com:/home/backup/daily.backup
rsync { Options } backup@my-database-server.org:/root/databasedumps /root/backups/my-database-server.org/database-dumps
I've trying to devise a clever plan for backing my stuff up and for a while it even worked. I had just gotten a new 1GB USB-Stick. It was quite a cool stick back then, even though it wasn't expensive or anything.
So i devised the following scheme. Whenever i plugged my stick into my pc or laptop a Backup Program should run and sync a certain directory on the PC with a certain directory on the Stick. It was a good plan ;)
If i just kept my working directories on the Computers inside the Sync Dir they would be in sync between the PCs i would be working on. When i was working on that i turned the Internet upside down for Backup Solutions. Some of the Links i stumbled upon can be found here: Backup in my del.icio.us (or if you have some problems with yahoo owning delicious and censoring china, photos in germany) backup in my ma.gnolia.
What did i need? I needed a portable solution for MS-Windows PCs as well as my Linux Laptops and Desktops. A graphical user interface was not really necessary. I just needed it to work not to display fancy, schmancy stuff. It should be free as in free software. Free as in ... and not as in. (Quoting RMS, yay)
First thing most of you familiar with the subject now probably have on their minds is also the first one i'm going to mention:
RSync (website HERE):
- A sneaky tool, using sneaky Algorithms
- very very Portable indeed. So running on all the required platforms would work just nicely
- been around quite a while
- lots and lots of nice options
- unfortunately the one i would need i missing: 2 way Sync
Unison (website HERE)
- neither as sneaky nor as portable as rsync, yet it does still work on all the platforms i need
- i managed to get it to work quite easily (for those of you who like GUIs there is even one of those)
- it is awfully slow, when i plugged in my stick i couldn't do anything because it took a long time comparing
- even though it should be easy to resolve conflicts his behavious sometimes was weird when trying to solve conflicts (just exiting, using neither file)
So where does that leave me. Do i keep looking or perhaps is the scenario too tough for a computer? Backing up 200 megs of data (most of that in pretty large files). Should that really take long? Be inconvenient? Well, looks like i had more research to do...