Friday, April 8, 2011

rsync to NAS (Windows SMB)

Mount the shared folder:-
sudo mount -t cifs -o rw -o user=tom -o iocharset=utf8 //myNasServer/bak /mnt/mynas

Sync the home directory:-
sudo rsync -rvth --delete --exclude '.local/share/Trash' --exclude '.cache' ~/ /mnt/mynas/bak

or show more info while syncing:-
sudo rsync -rvth --delete --exclude '.local/share/Trash' --exclude '.cache' --stats --progress ~/ /mnt/mynas/bak

From mount command help:-
-o, --options
    rw (mount read-write)
    user=username
    iocharset=charset used to convert local path names to and from Unicode

-t, --types vfstype
    mount using the Common Internet File System (CIFS). The older type "smbfs" can also be used.

From rsync command help:-
    --delete           delete extraneous files from destination dirs
    --exclude=PATTERN  exclude files matching PATTERN
-h, --human-readable   output numbers in a human-readable format
    --progress         show progress during transfer
-r, --recursive        recurse into directories
    --stats            give some file-transfer stats
-t, --times            preserve modification times
-v, --verbose          increase verbosity

No comments:

Post a Comment