rsync でデータ移行したときのメモ(macOS)

古いmacから新しいmacへデータを移行をrsyncで行ったときのメモです。

rsync

移行先で実行

rsync -auvzE --progress 移行元のIP:~/Desktop ~/Desktop
  • a archive mode; same as -rlptgoD (no -H)
  • u skip files that are newer on the receiver
  • v increase verbosity
  • z compress file data during the transfer
  • E copy extended attributes
  • --progress show progress during transfer

macOS の場合は、E オプションをつけて拡張属性もコピーされるようにしておく。

移行元へ ssh で接続できるようにシステム環境設定の「共有」で「リモートログイン」を有効にしておく。 移行が終わったら忘れずに無効にする。

rsync でエラーが出る場合

Write failed: Broken pipe でエラーを吐いて、ClientAliveInterval などを調整しても効果がないときは Homebrew から最新の rsync を入れてしまう

brew install rsync

導入前後のバージョン

% /usr/bin/rsync --version
rsync  version 2.6.9  protocol version 29
Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
              inplace, IPv6, 64-bit system inums, 64-bit internal inums

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.
% /usr/local/bin/rsync --version
rsync  version 3.2.3  protocol version 31
Copyright (C) 1996-2020 by Andrew Tridgell, Wayne Davison, and others.
Web site: https://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, hardlink-specials, symlinks, IPv6, no atimes,
    batchfiles, inplace, append, ACLs, xattrs, optional protect-args, iconv,
    symtimes, no prealloc, stop-at, crtimes, file-flags
Optimizations:
    SIMD, asm, openssl-crypto
Checksum list:
    xxh128 xxh3 xxh64 (xxhash) md5 md4 none
Compress list:
    zstd lz4 zlibx zlib none

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.