linux:rsync

差分

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

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:rsync [2024/01/14 11:01] – [マウントした NTFS で何もコピーできない] ともやんlinux:rsync [2024/03/14 12:32] (現在) – [rsyncコマンドの元ディレクトリ指定の違いによる動作] ともやん
行 5: 行 5:
  
 ===== rsync + ssh の基本 ===== ===== rsync + ssh の基本 =====
 +<WRAP group>
 +<WRAP column>
 <html> <html>
 <!-- a8net --> <!-- a8net -->
行 10: 行 12:
 <img border="0" width="300" height="250" alt="" src="https://www25.a8.net/svt/bgt?aid=240113051563&wid=001&eno=01&mid=s00000016458003008000&mc=1"></a> <img border="0" width="300" height="250" alt="" src="https://www25.a8.net/svt/bgt?aid=240113051563&wid=001&eno=01&mid=s00000016458003008000&mc=1"></a>
 <img border="0" width="1" height="1" src="https://www14.a8.net/0.gif?a8mat=3YYGEZ+9B72CY+3IZO+HWPVL" alt=""> <img border="0" width="1" height="1" src="https://www14.a8.net/0.gif?a8mat=3YYGEZ+9B72CY+3IZO+HWPVL" alt="">
-</html>\\+</html> 
 +</WRAP> 
 +<WRAP column> 
 +ユニークな転職ナビ押してミソ👆😍 
 +</WRAP> 
 +</WRAP>
 ここでは、rsyncとsshを利用してリモートサーバのバックアップを取る方法を説明する。\\ ここでは、rsyncとsshを利用してリモートサーバのバックアップを取る方法を説明する。\\
 rsyncは指定されたフォルダ間の同期を高速に行うことができる。sshを利用するとリモートサーバとの間でディレクトリの同期処理を行える。\\ rsyncは指定されたフォルダ間の同期を高速に行うことができる。sshを利用するとリモートサーバとの間でディレクトリの同期処理を行える。\\
行 18: 行 25:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>sudo</brsync <b class=HIK>-avP --delete --copy-links</b> /home/samba/DataShare /mnt/backup/+<font color="#FF8700"><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/
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 36: 行 43:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete -e</b> ssh ローカルディレクトリ ユーザ@リモートサーバ:転送先フォルダ+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> ssh ローカルディレクトリ ユーザ@リモートサーバ:転送先フォルダ
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 54: 行 61:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete -e</b> ssh ユーザ@リモートサーバ:バックアップ元ディレクトリ ローカルバックアップ先ディレクトリ+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> ssh ユーザ@リモートサーバ:バックアップ元ディレクトリ ローカルバックアップ先ディレクトリ
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 61: 行 68:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete -e</b> "ssh -p10022ユーザ@リモートサーバ:バックアップ元ディレクトリ ローカルバックアップ先ディレクトリ+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font<font color="#A2734C">&quot;ssh -p10022&quot;</font> ユーザ@リモートサーバ:バックアップ元ディレクトリ ローカルバックアップ先ディレクトリ
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 68: 行 75:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete -e</b> ssh username@remote.server.com:/remote/server/directory/ /local/client/directory/20081016+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> ssh username@remote.server.com:/remote/server/directory/ /local/client/directory/20081016
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 81: 行 88:
 sent 2594 bytes  received 403518 bytes  14767.71 bytes/sec sent 2594 bytes  received 403518 bytes  14767.71 bytes/sec
 total size is 140703092  speedup is 346.46 total size is 140703092  speedup is 346.46
-</pre></html></WRAP> 
-<WRAP color_command><html><pre> 
-<b class=GRN>$</b> 
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 98: 行 102:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete -e</b> ssh username@remote.server.com:/remote/server/directory/ /local/client/directory/20081016+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> ssh username@remote.server.com:/remote/server/<b class=DiYE>directory</b><b class=RED>/</b> /local/client/directory/20081016
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
-/remote/server/directory<html><span style="color: red">/</span></html> のように、元ディレクトリの最後に "<html><span style="color: red">/</span></html>" を付けると、directory の内容が 20081016 内に展開されるかたちで同期される🤔\\+<html><code>/remote/server/<b class=RED>directory/</b></code></html> のように、元ディレクトリの最後に "<html><code><b class=RED>/</b></code></html>" を付けると、<html><code>directory</code></html> の内容が <html><code>20081016</code></html> 内に展開されるかたちで同期される🤔\\
 \\ \\
 先ディレクトリに元ディレクトリ名のディレクトリが作成される例: 先ディレクトリに元ディレクトリ名のディレクトリが作成される例:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete -e</b> ssh username@remote.server.com:/remote/server/directory /local/client/directory/20081016+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> ssh username@remote.server.com:/remote/server/<b class=DiYE>directory</b> /local/client/directory/20081016
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
-/remote/server/<html><span style="color: red">directory</span></html> のように、元ディレクトリの最後に "<html><span style="color: red">/</span></html>" を付けないと、20081016 内に directory が作成されてその中に同期される🤔\\+<html><code>/remote/server/<b class=RED>directory</b></code></html> のように、元ディレクトリの最後に "<html><code><b class=RED>/</b></code></html>" を付けないと、<html><code>20081016</code></html> 内に <html><code>directory</code></html> が作成されてその中に同期される🤔\\
  
 ===== rsync でレジューム同期を行うには? ===== ===== rsync でレジューム同期を行うには? =====
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avzP --delete -e</b> ssh user@remote.srv.com:/remote/server/directory/ /local/client/directory/20150804+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avzP</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> ssh user@remote.srv.com:/remote/server/directory/ /local/client/directory/20150804
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
-**-P** --partial --progressと同じ+<html><code>-P</code></html> --partial --progressと同じ
  
 ===== rsync 進行状況を正確に知る ===== ===== rsync 進行状況を正確に知る =====
行 125: 行 129:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avzP --delete --no-inc-recursive -e</b> ssh user@remote.srv.com:/remote/server/directory/ /local/client/directory/20150804+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avzP</font> <font color="#A347BA">--delete</font> <font color="#A347BA">--no-inc-recursive</font> <font color="#A347BA">-e</font> ssh user@remote.srv.com:/remote/server/directory/ /local/client/directory/20150804
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 141: 行 145:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>sudo</b> rsync <b class=HIK>-avz --delete -e</b> ssh user@remote.server.com:/remote/server/directory/ /local/client/directory/+<font color="#FF8700"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:single">sudo</u></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> ssh user@remote.server.com:/remote/server/directory/ /local/client/directory/
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 151: 行 155:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ mkdir -p /var/www/html/+<font color="#FF8700"><b>$</b></font> <font color="#26A269">mkdir</font> <font color="#A347BA">-p</font> <u style="text-decoration-style:single">/var/www/html/</u>
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 159: 行 163:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete -e</b> /var/www/vhosts/ '/mnt/win_c-drv/Program Files (x86)/Ampps/www/vhosts/'+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> <font color="#A347BA">-e</font> /var/www/vhosts/ <font color="#A2734C">&apos;/mnt/win_c-drv/Program Files </font><font color="#12488B"><b>(</b></font><font color="#A2734C">x86</font><font color="#12488B"><b>)</b></font><font color="#A2734C">/Ampps/www/vhosts/&apos;</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 177: 行 181:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-avz --delete</b> /var/www/vhosts/ '/mnt/win_c-drv/Program Files (x86)/Ampps/www/vhosts/'+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-avz</font> <font color="#A347BA">--delete</font> /var/www/vhosts/ <font color="#A2734C">&apos;/mnt/win_c-drv/Program Files </font><font color="#12488B"><b>(</b></font><font color="#A2734C">x86</font><font color="#12488B"><b>)</b></font><font color="#A2734C">/Ampps/www/vhosts/&apos;</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 189: 行 193:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-<b class=GRN>$</b> <b class=HIY>rsync</b> <b class=HIK>-rlptvz --delete</b> /var/www/vhosts/ '/mnt/win_c-drv/Program Files (x86)/Ampps/www/vhosts/'+<font color="#FF8700"><b>$</b></font> <font color="#26A269">rsync</font> <font color="#A347BA">-rlptvz</font> <font color="#A347BA">--delete</font> /var/www/vhosts/ <font color="#A2734C">&apos;/mnt/win_c-drv/Program Files </font><font color="#12488B"><b>(</b></font><font color="#A2734C">x86</font><font color="#12488B"><b>)</b></font><font color="#A2734C">/Ampps/www/vhosts/&apos;</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 207: 行 211:
 [[http://superuser.com/questions/534862/what-does-rsyncs-output-tell-here-about-to-chk|What does Rsync's output tell here about to-chk?]]\\ [[http://superuser.com/questions/534862/what-does-rsyncs-output-tell-here-about-to-chk|What does Rsync's output tell here about to-chk?]]\\
  
 +<WRAP group>
 +<WRAP column>
 <html> <html>
 <!-- a8net --> <!-- a8net -->
行 213: 行 219:
 <img border="0" width="1" height="1" src="https://www19.a8.net/0.gif?a8mat=3YYGEZ+9B72CY+3IZO+I1NCH" alt=""> <img border="0" width="1" height="1" src="https://www19.a8.net/0.gif?a8mat=3YYGEZ+9B72CY+3IZO+I1NCH" alt="">
 </html> </html>
 +</WRAP>
 +<WRAP column>
 +押してはダメ🙅‍♂️だ転職しちゃうぞ👆
 +</WRAP>
 +</WRAP>
  
  • linux/rsync.1705197677.txt.gz
  • 最終更新: 2024/01/14 11:01
  • by ともやん