如何編輯 ddrescue 日誌檔案以在某個位置恢復?

如何編輯 ddrescue 日誌檔案以在某個位置恢復?

GNU ddrescue我正在嘗試使用日誌檔案對 500GB 磁碟進行映像。我達到了 420GB,然後我用 停止了它ctrl+c。一段時間後我再次運行該命令,儘管有日誌文件,但它又重新開始。

舊的日誌檔案已被 覆蓋ddrescue

正如我所說,到目前為止,我的映像檔大小為 500GB 磁碟中的 420GB。如何編輯日誌檔或告知ddrescue從 420GB 左右恢復?我花了幾天ddrescue才達到 420GB。我不想重新開始這個過程。

這是日誌檔:

# Mapfile. Created by GNU ddrescue version 1.21
# Command line: ddrescue /dev/sdd /media/myname/New Volume4/backup.dmg /media/myname/New Volume4/logfile.log
# Start time:   2016-05-17 13:08:39
# Current time: 2016-05-17 13:08:48
# Copying non-tried blocks... Pass 1 (forwards)
# current_pos  current_status
0x0C770000     ?
#      pos        size  status
0x00000000  0x0C770000  +
0x0C770000  0x7464496000  ?

這是sudo fdisk -l我想要鏡像的磁碟的內容:

Disk /dev/sdd: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disk identifier: 0xeea5da13

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1              63   976768064   488384001    7  HPFS/NTFS/exFAT

答案1

日誌檔案中的十六進位數字0x0C770000表示讀取了大約 200 MiB。這證實了你ddrescue重新開始的說法。

要修改,首先取得影像的十六進位大小:

printf "%x\n" $(($(wc -c < "/media/myname/New Volume4/backup.dmg")-4096))

(我4096從實際尺寸中減去以防萬一。這可能是不必要的;但不會造成傷害。)

然後0C770000用結果數字替換日誌中的每個(需要三個替換)。請注意,有0x一些前綴是您不應觸及的。為此,請執行以下操作sed

sed -i 's/0C770000/the_resulted_number_here/' "/media/myname/New Volume4/logfile.log"

注意:我不知道為什麼第二次嘗試重新開始而不是繼續。日誌檔案現在(幾乎)是中斷傳遞後的樣子(如果沒有讀取錯誤),因此此行為可能會因相同(但未知)的原因再次出現。

重新開始ddrescue

ddrescue /dev/sdd "/media/myname/New Volume4/backup.dmg" "/media/myname/New Volume4/logfile.log"

相關內容