Quantcast
Channel: Brain Book
Viewing all articles
Browse latest Browse all 195

RSYNC BACKUP LOCAL AND NETWORK

$
0
0
RSYNC
1.     --dry-run This tells rsync to not actually do anything. It will just write a log of what it would do to the screen. Once you've made sure everything will work as you expect, you have to remove this option, and run the command again to perform the actual backup.
2.     --delete deletes files that don't exist on the system being backed up.(Optional)
3.     -a preserves the date and times, and permissions of the files (same as -rlptgoD).
4.   --exclude To exclude a directory from backing up

With this option rsync will:
1.     Descend recursively into all directories (-r),
2.     copy symlinks as symlinks (-l),
3.     preserve file permissions (-p),
4.     preserve modification times (-t),
5.     preserve groups (-g),
6.     preserve file ownership (-o), and
7.     preserve devices as devices (-D).
5.     -z compresses the data
6.     -vv increases the verbosity of the reporting process
7.     -e specifies remote shell to use
8.     /folder1 and folder2 In the examples above, folder1 and 2 are placeholders for the directories to be synchronized. Folder1 is the original folder, and 2 is the new folder, or existing one to be brought in sync with the first. Replace them with the folders you'd like. A / was added after folder1 so that only the contents, rather than whole folder, would be moved into the second.

LOCAL BACKUP
rsync -azvv /home/user/testsync/  /home/user/testsync

rsync -azvvrlptgo /home/user/testsync/  /home/user/testsync

Becareful with --delete and use --dry-run first to test
rsync --dry-run -azvv --delete /home/user/testsync/  /home/user/testsync

To Exclude a Directory
rsync -azvv --exclude 'dir1' /home/path/folderA/ /home/path/folderB

NETWORK BACKUP
rsync -azvv -e ssh /home/user/testsync/ user@192.168.1.10:/home/user/testsync

rsync -azvrlptgo --delete -e ssh /home/user/testsync/ user@192.168.1.10:/home/user/testsync

Viewing all articles
Browse latest Browse all 195

Trending Articles