Home » Questions » Computers [ Ask a new question ]

Program to backup files without deleting

Program to backup files without deleting

I'm using a mac pro and have my OS/application files on one hard drive and other files on another internal hard drive. Before I got the latter drive, I cloned the drive with the OS to an external HD using SuperDuder!

Asked by: Guest | Views: 164
Total answers/comments: 1
Guest [Entry]

"Like SleighBoy said, rsync is definitively the tool you are looking for. Since it can be scary at first look, due to its many options, i'll suggest the most important to you, based on your needs. The basic syntax for local backups is:

rsync [OPTION..] SRC.. DST

Generally the --archive/-a option is used because it encloses some other common options like --recursive and options to preserve file permissions.

One option the you don't have to use is --delete because otherwise rsync will delete every file that is in the destination DST but is not in the sources SRT.

You probably want also the option --relative/-R. It enables the use of relative paths. From the man page:

...this means that the full path names specified on the command line are sent to the server rather than just the last parts of the filenames. This is particularly useful when you want to send several different directories at the same time. For example, if you used this command:

rsync -av /foo/bar/baz.c /tmp/

... this would create a file named baz.c in /tmp/ . If instead you used

rsync -avR /foo/bar/baz.c /tmp/

then a file named /tmp/foo/bar/baz.c would be created — the full path name is preserved. To limit the amount of path information that is sent you can insert a dot and a slash into the source path, like this:

rsync -avR /foo/./bar/baz.c remote:/tmp/

That would create /tmp/bar/baz.c on the remote machine.

You also need the option:

--exclude=PATTERN

One very handy option is --dry-run that just simulates the transfer. You can use it to test your rsync commands.

The following options can be used to make the backup process verbose:

--stats --verbose --human-readable --progress

Summarizing, if you need to backup the folder /home/user into the folder /media/backup excluding the folders /home/user/lib and /home/user/dir1/dir2 then you can use:

rsync -aRvh --exclude=/home/user/lib --exclude=/home/user/dir1/dir2 /home/user /media/backup

that will recreate the whole directory hierarchy of /home/user into /media/backup."