首页 > 编程知识 正文

gpt分区文件恢复,gpt分区修复引导

时间:2023-05-05 06:07:54 阅读:245919 作者:3906

   今天在使用linux系统时,由于异常断电,在重启时,发现自己的一块磁盘/dev/sdb,变成了未分区状态.初步断定是分区表坏掉了.
   之前有人使用testdisk修复这种情况,自己下载了testdisk,根据网上操作指示,尝试进行修复.create ->select->EFI GPT(不同于Intel)->Analyse->Quicksearch->之后开始了漫长的等待

Analyse cylinder 12173/121600: 10% MS Data 63 97675198 97675136 [llllll] MS Data 63 97675199 97675137 MS Data 97675199 195350335 97675137 MS Data 195561506 3999795233 3804233728

等了一个多小时,还未扫描完,放弃.寻找更简便的放法.

由于GPT分区会在磁盘的最后34个扇区保存分区表等信息的备份,就考虑是否有一种简便方法可以将备份分区表拿过来使用.这时发现了gdisk命令.

./gdisk /dev/sdbGPT fdisk (gdisk) version 1.0.0Partition table scan: MBR: protective BSD: not present APM: not present GPT: presentFound valid GPT with protective MBR; using GPT.Command (? for help): ?b back up GPT data to a filec change a partition's named delete a partitioni show detailed information on a partitionl list known partition typesn add a new partitiono create a new empty GUID partition table (GPT)p print the partition tableq quit without saving changesr recovery and transformation options (experts only)s sort partitionst change a partition's type codev verify diskw write table to disk and exitx extra functionality (experts only)? print this menuCommand (? for help): pDisk /dev/sdb: 5860533168 sectors, 2.7 TiBLogical sector size: 512 bytesDisk identifier (GUID): 68C0B00E-CB14-4587-9ED5-6BAE6F02D352Partition table holds up to 128 entriesFirst usable sector is 34, last usable sector is 5860533134Partitions will be aligned on 2048-sector boundariesTotal free space is 4972 sectors (2.4 MiB)Number Start (sector) End (sector) Size Code Name 1 2048 5856337920 2.7 TiB 0700 primary 2 5856339968 5860532223 2.0 GiB 0700 primaryCommand (? for help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTINGPARTITIONS!!Do you want to proceed? (Y/N):

首先gdisk   [device名称]

然后p,打印出备份表,虽然磁盘头部分区表已经没了,但是p仍然可以打印出分区表,应该是备份表的作用.

最后一步 w,保存.会提示你是否开始,选Y,这时备份分区表就会重写到磁盘头部.

重启系统,磁盘恢复,大功告成.

希望这次经历会帮助到有遇到这个问题的人.

 

计算机毕业设计ssm毕业设计过程管理系统049a8系统+程序+源码+lw+远程部署对象存储怎么设置防盗链 US3详解docker pull 下来的镜像都存到了哪里容器云 NodePort 相关参数修改 UK8S

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。