tech:notes_rsync
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_rsync [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_rsync [2025/10/17 16:26] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| {{tag> | {{tag> | ||
| - | = Notes rsync | + | # Notes rsync |
| Voir aussi | Voir aussi | ||
| Ligne 11: | Ligne 12: | ||
| * [[reseau_linux_pile_tcp_ip_rto_min_scripts|Mesures - rsync]] | * [[reseau_linux_pile_tcp_ip_rto_min_scripts|Mesures - rsync]] | ||
| - | === CD / ISO | + | ### CD / ISO |
| Source https:// | Source https:// | ||
| - | <code -> | + | ~~~ |
| Veuillez utiliser au moins les options --times --links --hard-links --partial --block-size=8192. | Veuillez utiliser au moins les options --times --links --hard-links --partial --block-size=8192. | ||
| Cela conservera la date de dernière modification, | Cela conservera la date de dernière modification, | ||
| Ligne 21: | Ligne 22: | ||
| Lorsque la date de dernière modification et la taille d'un fichier n'ont pas été modifiées, | Lorsque la date de dernière modification et la taille d'un fichier n'ont pas été modifiées, | ||
| rsync ignore le fichier, aussi --times est réellement nécessaire | rsync ignore le fichier, aussi --times est réellement nécessaire | ||
| - | </ | + | ~~~ |
| - | === Machine distante vers machine distante | + | ### Machine distante vers machine distante |
| - | < | + | ~~~bash |
| rsync -ax backup:/ | rsync -ax backup:/ | ||
| - | </ | + | ~~~ |
| - | <code -> | + | ~~~ |
| The source and destination cannot both be remote. | The source and destination cannot both be remote. | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| ssh -A remotehostA rsync / | ssh -A remotehostA rsync / | ||
| - | </ | + | ~~~ |
| Une autre solution consiste à utiliser SSHFS **Mais les UID/GID ne sont pas préservés** | Une autre solution consiste à utiliser SSHFS **Mais les UID/GID ne sont pas préservés** | ||
| - | ==== Pb SSHFS Transport endpoint is not connected | + | #### Pb SSHFS Transport endpoint is not connected |
| - | < | + | ~~~bash |
| fusermount -uz /data | fusermount -uz /data | ||
| - | </ | + | ~~~ |
| - | <code - / | + | '' |
| + | ~~~ | ||
| user_allow_other | user_allow_other | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| - | sudo sshfs -d -o allow_other -o reconnect -o ServerAliveInterval=15 root@192.168.2.12:/ | + | sshfs -o allow_other,ro -o reconnect -o ServerAliveInterval=15 root@192.168.2.12:/ |
| - | </ | + | ~~~ |
| - | sshfs -o ro server:/ ~/mnt/plop | + | Pour debug ajouter l' |
| + | ~~~bash | ||
| + | sshfs -d -o allow_other, | ||
| + | ~~~ | ||
| - | === Gros fichiers avec plein de zéros, iso... | + | ### Gros fichiers avec plein de zéros, iso... |
| Voir l' | Voir l' | ||
| - | <code -> | + | ~~~ |
| -S, --sparse | -S, --sparse | ||
| - | </ | + | ~~~ |
| - | <code -> | + | ~~~ |
| $ ls -lsh | $ ls -lsh | ||
| total 22G | total 22G | ||
| Ligne 68: | Ligne 73: | ||
| 7,7G -rw-r--r-- 1 jibe jibe 120G août 9 11:18 VM152-SUPPMSM-V-clone.img | 7,7G -rw-r--r-- 1 jibe jibe 120G août 9 11:18 VM152-SUPPMSM-V-clone.img | ||
| 14G -rw-r--r-- 1 jibe jibe 14G févr. 24 09:15 VM152-SUPPMSM-V-clone.qcow2 | 14G -rw-r--r-- 1 jibe jibe 14G févr. 24 09:15 VM152-SUPPMSM-V-clone.qcow2 | ||
| - | </ | + | ~~~ |
| - | === Copie dossier | + | ### Copie dossier |
| Ne pas oublier le barre oblique (slash) à la fin | Ne pas oublier le barre oblique (slash) à la fin | ||
| - | < | + | ~~~bash |
| rsync -ax / | rsync -ax / | ||
| - | </ | + | ~~~ |
| - | === Diff - diffing | ||
| - | <code bash> | + | ### Utilisation de l' |
| + | |||
| + | ~~~bash | ||
| + | rsync -anv --files-from=push.lst / / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### rsync avec find | ||
| + | |||
| + | ~~~bash | ||
| + | # rsync --files-from=<(find ~/DATA/ -type f -name ' | ||
| + | # find ~/DATA/ -name ' | ||
| + | |||
| + | cd ~/DATA/ | ||
| + | find . -type f -name ' | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ### Diff - diffing | ||
| + | |||
| + | ~~~bash | ||
| diff -r --exclude=' | diff -r --exclude=' | ||
| - | </ | + | ~~~ |
| Équivalent avec rsync | Équivalent avec rsync | ||
| - | < | + | ~~~bash |
| - | rsync -rcvn --delete --exclude=' | + | rsync -rcvn --delete --exclude=' |
| - | </ | + | ~~~ |
| - | === Droits | + | ### Droits |
| chmod - exemple cd iso9660 | chmod - exemple cd iso9660 | ||
| Ligne 99: | Ligne 125: | ||
| **D** pour Directory | **D** pour Directory | ||
| - | < | + | ~~~bash |
| rsync -a -H --delete --chmod=Fu+rw, | rsync -a -H --delete --chmod=Fu+rw, | ||
| - | </ | + | ~~~ |
| Cependant dans le cas d'un ISO CD/DVD nous préférerons : | Cependant dans le cas d'un ISO CD/DVD nous préférerons : | ||
| - | < | + | ~~~bash |
| fakeroot rsync -a -H --delete /mnt/iso /tmp/iso | fakeroot rsync -a -H --delete /mnt/iso /tmp/iso | ||
| - | </ | + | ~~~ |
| chown - exemple synchro dokuwiki | chown - exemple synchro dokuwiki | ||
| - | < | + | ~~~bash |
| rsync -axP --chown=999: | rsync -axP --chown=999: | ||
| - | </ | + | ~~~ |
| - | === Options SSH | + | ### Options SSH |
| - | < | + | ~~~bash |
| rsync -o StrictHostKeyChecking=no -o CheckHostIP=no | rsync -o StrictHostKeyChecking=no -o CheckHostIP=no | ||
| #rsync -e "ssh -o StrictHostKeyChecking=no -o CheckHostIP=no" | #rsync -e "ssh -o StrictHostKeyChecking=no -o CheckHostIP=no" | ||
| - | </ | + | ~~~ |
| - | === Exclusion | + | ### Exclusion |
| ** Le chemin des fichiers à exclure est relatif au répertoire que l'on sauvegarde. ** | ** Le chemin des fichiers à exclure est relatif au répertoire que l'on sauvegarde. ** | ||
| - | < | + | ~~~bash |
| # FAUX | # FAUX | ||
| rsync --archive --verbose --stats --info=progress2 --delete --delete-excluded --exclude="/ | rsync --archive --verbose --stats --info=progress2 --delete --delete-excluded --exclude="/ | ||
| Ligne 133: | Ligne 159: | ||
| # OK | # OK | ||
| rsync --archive --verbose --stats --info=progress2 --delete --delete-excluded -filter=" | rsync --archive --verbose --stats --info=progress2 --delete --delete-excluded -filter=" | ||
| - | </ | + | ~~~ |
| **La racine "/" | **La racine "/" | ||
| Ligne 141: | Ligne 167: | ||
| Exclure les fichiers cachés | Exclure les fichiers cachés | ||
| - | < | + | ~~~bash |
| rsync -ax --exclude=" | rsync -ax --exclude=" | ||
| - | </ | + | ~~~ |
| - | === Liste bande passante / ressources | + | ### Liste bande passante / ressources |
| Liste bande passante / ressources | Liste bande passante / ressources | ||
| '' | '' | ||
| - | < | + | ~~~bash |
| / | / | ||
| - | </code> | + | |
| + | # systemd-run -p IOWeight=10 rsync -axvn --bwlimit=20480 | ||
| + | ~~~ | ||
| Voir aussi | Voir aussi | ||
| - | < | + | ~~~bash |
| renice +19 -p $$ >/ | renice +19 -p $$ >/ | ||
| ionice -c3 -p $$ >/ | ionice -c3 -p $$ >/ | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| ntop -A | ntop -A | ||
| sudo / | sudo / | ||
| - | </ | + | ~~~ |
| == Rsync en mode daemon | == Rsync en mode daemon | ||
| Ligne 180: | Ligne 208: | ||
| - | === Activation | + | ### Activation |
| - | <code bash / | + | '' |
| + | ~~~bash | ||
| RSYNC_ENABLE=true | RSYNC_ENABLE=true | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| systemctl enable --now rsync | systemctl enable --now rsync | ||
| systemctl status rsync | systemctl status rsync | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| rsync rsync:// | rsync rsync:// | ||
| - | </ | + | ~~~ |
| Ligne 200: | Ligne 229: | ||
| * https:// | * https:// | ||
| - | <code ini / | + | '' |
| + | ~~~ini | ||
| uid = swift | uid = swift | ||
| gid = swift | gid = swift | ||
| Ligne 226: | Ligne 256: | ||
| read only = false | read only = false | ||
| lock file = / | lock file = / | ||
| - | </ | + | ~~~ |
| Ligne 232: | Ligne 262: | ||
| Installeur Debian Calamares | Installeur Debian Calamares | ||
| - | <code -> | + | ~~~ |
| Running (" | Running (" | ||
| - | </ | + | ~~~ |
| == Pb | == Pb | ||
| - | === Pb de taille | + | ### Pb de taille |
| Source : https:// | Source : https:// | ||
| Ligne 246: | Ligne 276: | ||
| Pour vérifier que la copie fait bien la même taille | Pour vérifier que la copie fait bien la même taille | ||
| - | < | + | ~~~bash |
| #echo `find . -type f -ls | awk ' | #echo `find . -type f -ls | awk ' | ||
| echo `find / | echo `find / | ||
| echo `find / | echo `find / | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| rsync --delete -v -axHSc / | rsync --delete -v -axHSc / | ||
| - | </ | + | ~~~ |
| | **Option** | | **Option** | ||
| Ligne 262: | Ligne 292: | ||
| - | === Pb : failed to set times on / No such file or directory | + | ### Pb : failed to set times on / No such file or directory |
| - | < | + | ~~~bash |
| sshfs SRV_DEST:/ | sshfs SRV_DEST:/ | ||
| rsync -ax --bwlimit=20480 SRV_SRC01:/ | rsync -ax --bwlimit=20480 SRV_SRC01:/ | ||
| - | </ | + | ~~~ |
| - | <code -> | + | ~~~ |
| rsync: failed to set times on "/ | rsync: failed to set times on "/ | ||
| - | </ | + | ~~~ |
| Solution : Tester avec l' | Solution : Tester avec l' | ||
| - | < | + | ~~~bash |
| rsync -ax -J --bwlimit=20480 SRV_SRC01:/ | rsync -ax -J --bwlimit=20480 SRV_SRC01:/ | ||
| - | </ | + | ~~~ |
| - | === Pb clef USB sync | + | ### Pb clef USB sync |
| Sur clef USB le système peut bufferiser beaucoup trop. | Sur clef USB le système peut bufferiser beaucoup trop. | ||
tech/notes_rsync.1742825205.txt.gz · Dernière modification : de 127.0.0.1
