Disk

使用 dd 將較小磁碟複製到較大磁碟後修復 GPT

  • September 30, 2022

我使用 dd 將較小的磁碟複製到較大的磁碟上,但是現在啟動時出現以下 dmesg 錯誤:

[Fri Sep 30 11:48:43 2022] GPT:Primary header thinks Alt. header is not at the end of the disk.
[Fri Sep 30 11:48:43 2022] GPT:1953525167 != 3907029167
[Fri Sep 30 11:48:43 2022] GPT:Alternate GPT header not at the end of the disk.
[Fri Sep 30 11:48:43 2022] GPT:1953525167 != 3907029167
[Fri Sep 30 11:48:43 2022] GPT: Use GNU Parted to correct GPT errors.

我該如何解決這個問題?該錯誤表明使用parted,但我不確定要執行哪些命令?

你不需要做任何特別的事情,只需用於p列印有關磁碟的資訊,parted 會告訴你分區表錯誤並詢問你該怎麼做,只需告訴Fix它:

# parted /dev/loop0
GNU Parted 3.5
Using /dev/loop0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Warning: Not all of the space available to /dev/loop0 appears to be used, you can fix the GPT to use all of the space (an extra 10485760 blocks) or continue with the current setting? 
Fix/Ignore? Fix
...

(當然替換/dev/loop0為您的磁碟,例如/dev/sda)。

引用自:https://unix.stackexchange.com/questions/719264