linux:rsync

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:rsync [2025/04/24 04:39] – [除外パターンを bash braces '{}' で効率よく書く✍😍] ともやんlinux:rsync [2025/12/16 06:45] (現在) – [ローカルディレクトリ → ローカルディレクトリ (ディスク間コピーなど)] ともやん
行 30: 行 30:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<font color="#0087FF"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avP</font> <font color="#A347BA">--delete</font> <font color="#A347BA">--copy-links</font> /home/samba/source /mnt/backup/+<font color="#0087FF"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avP</font> <font color="#A347BA">--delete</font> <font color="#A347BA">--dry-run</font> <font color="#A347BA">--copy-links</font> /home/samba/source /mnt/backup/
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
-<html><code>-a</code></html> 元のパーミッションやグループなどを保持したまま同期\\ +''%%-a%%'' 元のパーミッションやグループなどを保持したまま同期\\ 
-<html><code>-v</code></html> 処理中のファイル名を表示\\ +''%%-v%%'' 処理中のファイル名を表示\\ 
-<html><code>-P</code></html> 進行状況を表示\\ +''%%-P%%'' 進行状況を表示\\ 
-<html><code>--delete</code></html> コピー元で削除されたファイルは、コピー先でも削除\\ +''%%--delete%%''コピー元で削除されたファイルは、コピー先でも削除\\ 
-<html><code>--copy-links</code></html> シンボルリンク先のファイルをコピー\\ +''%%--dry-run%%'' ドライランモードを有効にする <wrap em>''%%--delete%%''で事故る前に''%%--dry-run%%''を活用せよ‼️😎</wrap>\\ 
-<html><code>-z</code></html> データを圧縮する(ローカルコピーでは速度が低下するので指定しない)\\ +''%%--copy-links%%'' シンボルリンク先のファイルをコピー\\ 
-<html> +''%%-z%%'' データを圧縮する(ローカルコピーでは速度が低下するので指定しない)\\
-<a href="https://px.a8.net/svt/ejp?a8mat=3YYGEZ+9B72CY+3IZO+I3D2Q" rel="nofollow">選ばれて10年。エンジニアの気持ちが分かる転職エージェントは【アイムファクトリー】</a> +
-<img border="0" width="1" height="1" src="https://www18.a8.net/0.gif?a8mat=3YYGEZ+9B72CY+3IZO+I3D2Q" alt=""> +
-</html>\\+
  
 ==== ローカルディレクトリ → リモートサーバ の転送 ==== ==== ローカルディレクトリ → リモートサーバ の転送 ====
行 171: 行 168:
  
 [[dt>rpalo/bash-brackets-quick-reference-4eh6|Bash Brackets Quick Reference - DEV Community]] [[gtr>https://dev.to/rpalo/bash-brackets-quick-reference-4eh6|翻訳]]\\ [[dt>rpalo/bash-brackets-quick-reference-4eh6|Bash Brackets Quick Reference - DEV Community]] [[gtr>https://dev.to/rpalo/bash-brackets-quick-reference-4eh6|翻訳]]\\
 +
 +==== 複数ディレクトリをリモートへ同期 ====
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avP<b class=DiYE>R</b></font> <font color="#A347BA">--no-inc-recursive</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> <font color="#A2734C">&quot;ssh -p20022&quot;</font> /var/cache/<font color="#2A7BDE"><b>{</b></font>dnf,libdnf5<font color="#2A7BDE"><b>}</b></font> root@wicked-beat:/
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +building file list ... 
 +1444 files to consider
 +/var/cache/libdnf5/updates-e19adde8fd271134/packages/
 +/var/cache/libdnf5/updates-e19adde8fd271134/packages/amd-gpu-firmware-20250410-1.fc41.noarch.rpm
 +     26,173,116 100%  383.94MB/   0:00:00 (xfr#1, to-chk=775/1444)
 +/var/cache/libdnf5/updates-e19adde8fd271134/packages/amd-ucode-firmware-20250311-1.fc41.noarch.rpm
 +        356,123 100%    4.30MB/   0:00:00 (xfr#2, to-chk=774/1444)
 +/var/cache/libdnf5/updates-e19adde8fd271134/packages/amd-ucode-firmware-20250410-1.fc41.noarch.rpm
 +        357,604 100%    2.82MB/   0:00:00 (xfr#3, to-chk=773/1444)
 +/var/cache/libdnf5/updates-e19adde8fd271134/packages/android-tools-35.0.2-2.fc41.x86_64.rpm
 +      2,124,004 100%    2.05MB/   0:00:00 (xfr#4, to-chk=772/1444)
 +...
 +</pre></html></WRAP>
 +</WRAP>
 +''-R'', ''--relative'' 相対パス名を使用する\\
 +
 +**送信されるパス情報の量を削減する...🤔**\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avRP</font> <font color="#A347BA">--no-inc-recursive</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> <font color="#A2734C">&quot;ssh -p20022&quot;</font> /var/cache/<b class=DiYE>./</b><font color="#2A7BDE"><b>{</b></font>dnf,libdnf5<font color="#2A7BDE"><b>}</b></font> root@wicked-beat://var/cache/
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +building file list ... 
 +1442 files to consider
 +libdnf5/updates-e19adde8fd271134/packages/
 +libdnf5/updates-e19adde8fd271134/packages/appstream-data-41-11.fc41.noarch.rpm
 +     16,048,246 100%    3.86MB/   0:00:03 (xfr#1, to-chk=769/1442)
 +libdnf5/updates-e19adde8fd271134/packages/arm-none-eabi-gcc-cs-14.1.0-4.fc41.x86_64.rpm
 +    281,265,139 100%    2.22MB/   0:02:00 (xfr#2, to-chk=768/1442)
 +libdnf5/updates-e19adde8fd271134/packages/at-spi2-atk-2.54.1-1.fc41.i686.rpm
 +         95,484 100%  825.19kB/   0:00:00 (xfr#3, to-chk=767/1442)
 +libdnf5/updates-e19adde8fd271134/packages/at-spi2-atk-2.54.1-1.fc41.x86_64.rpm
 +         88,221 100%  700.43kB/   0:00:00 (xfr#4, to-chk=766/1442)
 +...
 +</pre></html></WRAP>
 +</WRAP>
 +
 +<WRAP mincode>
 +  It is also possible to limit the amount of path information that is sent as
 +    implied directories for each path you specify. With a modern rsync on the sending side (beginning with 2.6.7), you can insert a dot and a slash into the source path, like this: 
 +  CW rsync -avR /foo/./bar/baz.c remote:/tmp/ 
 +\\
 +  送信されるパス情報の量を制限することも可能です
 +  指定する各パスの暗黙のディレクトリ。送信側に最新のRSYNCを使用すると(2.6.7で始まる)、このようなソースパスにドットとスラッシュを挿入できます。
 +  cw rsync -avr /foo/./bar/baz.c remote:/tmp/
 +</WRAP>
  
 ===== 冗長でくどい Verbose ...😅 ===== ===== 冗長でくどい Verbose ...😅 =====
  • linux/rsync.1745437163.txt.gz
  • 最終更新: 2025/04/24 04:39
  • by ともやん