Rsync: diferència entre les revisions

De WikiMar
Salta a la navegació Salta a la cerca
Línia 100: Línia 100:
  ENCFS6_CONFIG=/media/encfs6.xml encfs --reverse /media/TEST5000LUKSB_zfs/enc /media/enc1/
  ENCFS6_CONFIG=/media/encfs6.xml encfs --reverse /media/TEST5000LUKSB_zfs/enc /media/enc1/
  rsync -avi --stats --inplace --progress /media/enc1/ /media/TEST5000LUKSB_zfs/enc2/
  rsync -avi --stats --inplace --progress /media/enc1/ /media/TEST5000LUKSB_zfs/enc2/
===For files that grow/appended --append-verify===
--append-verify isn't dangerous: It will always read and compare the data on both ends and not just assume they're equal. It does this using checksums, so it's easy on the network, but it does require reading the shared amount of data on both ends of the wire before it can actually resume the transfer by appending to the target.
More info: https://unix.stackexchange.com/questions/48298/can-rsync-resume-after-being-interrupted

Revisió del 14:15, 15 juny 2018

To avoid copying owner/group and permissions from a NTFS

rsync -a --no-o --no-g --no-p --delete -v --log-file=/tmp/rsync2.txt --stats --modify-window=2 --exclude ".encfs6.xml" --exclude "/\$RECYCLE.BIN" --exclude "/System Volume Information" /media/marti/W2000/ /media/W3000LUKS_ENC/


To show stats at the end

--stats

Give a nice overall percentage

--info=progress2


Using paths that contain spaces

-s, --protect-args

This option sends all filenames and most options to the remote rsync without allowing the remote shell to interpret them. This means that spaces are not split in names, and any non-wildcard special characters are not translated (such as ~, $, ;, &, etc.). Wildcards are expanded on the remote host by rsync (instead of the shell doing it). [...]

The alternative is to escape twice (using ' and \ ) the parameters.

http://askubuntu.com/questions/597605/rsync-over-ssh-path-with-spaces-does-not-work-with-quotes

See if a file is tranferred what differs

 --itemize-changes (also in the -vvv)

YXcstpoguax  path/to/file
|||||||||||
||||||||||╰- x: The extended attribute information changed
|||||||||╰-- a: The ACL information changed
||||||||╰--- u: The u slot is reserved for future use
|||||||╰---- g: Group is different
||||||╰----- o: Owner is different
|||||╰------ p: Permission are different
||||╰------- t: Modification time is different
|||╰-------- s: Size is different
||╰--------- c: Different checksum (for regular files), or
||              changed value (for symlinks, devices, and special files)
|╰---------- the file type:
|            f: for a file,
|            d: for a directory,
|            L: for a symlink,
|            D: for a device,
|            S: for a special file (e.g. named sockets and fifos)
╰----------- the type of update being done::
             <: file is being transferred to the remote host (sent)
             >: file is being transferred to the local host (received)
             c: local change/creation for the item, such as:
                - the creation of a directory
                - the changing of a symlink,
                - etc.
             h: the item is a hard link to another item (requires 
                --hard-links).
             .: the item is not being updated (though it might have
                attributes that are being modified)
             *: means that the rest of the itemized-output area contains
                a message (e.g. "deleting")


>f+++++++++ some/dir/new-file.txt
.f....og..x some/dir/existing-file-with-changed-owner-and-group.txt
.f........x some/dir/existing-file-with-changed-unnamed-attribute.txt
>f...p....x some/dir/existing-file-with-changed-permissions.txt
>f..t..g..x some/dir/existing-file-with-changed-time-and-group.txt
>f.s......x some/dir/existing-file-with-changed-size.txt
>f.st.....x some/dir/existing-file-with-changed-size-and-time-stamp.txt 
cd+++++++++ some/dir/new-directory/
.d....og... some/dir/existing-directory-with-changed-owner-and-group/
.d..t...... some/dir/existing-directory-with-different-time-stamp/

http://stackoverflow.com/questions/4493525/rsync-what-means-the-f-on-rsync-logs



Compare files by content

-c

By default rsync compares only size and mtime of the file. -c is slow but it ensures that the content is correct


To copy only the timestamps

--size-only --existing

--size-only forces rsync to compare using only the size (not also the time)

Without the --size-only, rsync will detect them as diferent files and transfer the file

To copy only the timestamps (slow)

-c --existing

-c forces rsync to compare files using checksums


Rsync to an untrusted location - encfs reverse

in case you have an encrypted zfs unit import it with the -l to ask for the passphrase

zpool import Y5000LUKSB_zfs -l

mount reverse encfs:

ENCFS6_CONFIG=/media/encfs6.xml encfs --reverse /media/TEST5000LUKSB_zfs/enc /media/enc1/
rsync -avi --stats --inplace --progress /media/enc1/ /media/TEST5000LUKSB_zfs/enc2/


For files that grow/appended --append-verify

--append-verify isn't dangerous: It will always read and compare the data on both ends and not just assume they're equal. It does this using checksums, so it's easy on the network, but it does require reading the shared amount of data on both ends of the wire before it can actually resume the transfer by appending to the target.

More info: https://unix.stackexchange.com/questions/48298/can-rsync-resume-after-being-interrupted