Linux 檔案複製與 ETA?

Linux 檔案複製與 ETA?

我正在磁碟之間複製大量文件。大約有 16 GB 的數據。我想查看進度信息,甚至預計完成時間從命令列

有什麼建議嗎?

答案1

使用rsync --human-readable --progress

對於單一文件和區塊設備,還有pv.如果你確實需要一個準確的進度條,請嘗試使用tarpv - 像這樣:

source=/the/source/directory
target=/the/target/directory
size=$(du -sx "$source")
cd "$source"
find . xdev -depth -not -path ./lost+found -print0 \
    | tar --create --atime-preserve=system --null --files-from=- \
          --format=posix --no-recursion --sparse \
    | pv --size ${size}k \
    | { cd "$target"; \
        tar --extract --overwrite --preserve-permissions --sparse; }

但請注意,GNUtar尚不支援 ACL 或擴充屬性,因此如果您要複製使用「acl」或「xattrs」選項掛載的檔案系統,則需要使用 rsync(使用「--acls」和「--xattrs」選項)。就我個人而言,我使用:

rsync --archive --inplace --hard-links --acls --xattrs --devices --specials \
    --one-file-system --8-bit-output --human-readable --progress /source /target

也要考慮是否要使用--delete和/或--numeric-ids選項。

答案2

而不是dd我會建議pv,例如:

% tar -cf - INPUT | pv -rbe -s SIZE | tar -xf - -C DEST 

答案3

你有沒有嘗試過rsync -P?如果您正在使用dd,例如tar -cf - src | dd | (cd dest; tar -xf -)您應該能夠使用 Ctrl-T (SIGINFO) 來查看您的進度。

相關內容