先模拟破快分区表

dd if=/dev/zero of=/dev/vdb bs=512 count=1

然后先使用 parted尝试修复

parted /dev/vdb

GNU Parted 2.1

使用 /dev/vdb

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) rescue

错误: /dev/vdb: unrecognised disk label

猜是MSDOS的于是 (parted) mklabel msdos

然后再rescue

(parted) rescue

起始点? 0

结束点? 10000

没有原来分区表的信息,只能猜,没有任何收获,尝试使用gpart工具

gpart /dev/vdb

Begin scan...

Possible extended partition at offset(601mb)

Possible partition(Linux ext2), size(4518mb), offset(601mb)

End scan.

Checking partitions...

Partition(Linux ext2 filesystem): primary

Ok.

Guessed primary partition table:

Primary partition(1)

type: 131(0x83)(Linux ext2 filesystem)

size: 4518mb #s(9253376) s(1231839-10485214)

chs:  (1023/15/63)-(1023/15/63)d (1222/1/1)-(10401/15/62)r

Primary partition(2)

type: 000(0x00)(unused)

size: 0mb #s(0) s(0-0)

chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Primary partition(3)

type: 000(0x00)(unused)

size: 0mb #s(0) s(0-0)

chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Primary partition(4)

type: 000(0x00)(unused)

size: 0mb #s(0) s(0-0)

chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

有一点收获,于是将猜的结果写入磁盘

root@localhost ~]# gpart -W /dev/vdb /dev/vdb

Begin scan... (时间很长)

1 - Absolute start sector (           0)

2 - Absolute sector count (           0)

3 - Partition type        (           0)(unused)

这里会让你填三个值,第一个,第二个,我怎么可能能记得!选第三个,由于记得有一个拓展分区,就写了Extended

Disk /dev/vdb: 5368 MB, 5368709120 bytes

16 heads, 63 sectors/track, 10402 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000d0da8

Device Boot      Start         End      Blocks   Id  System

/dev/vdb1            1223       10402     4626688   83  Linux

/dev/vdb4   *           1           1           0    0  Empty

结果找回来一个分区,注意vdb1,挂载起来,发现数据回来了,晕。

网上的testdisk,貌似认不到虚拟机的硬盘,晕

最后尝试 fsck一下,看行不行

结果依然不行,判他死缓,告诉大家,备份非常重要,不要抱着侥幸心里过关!

、――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

补充一下,后来发现其实 gpart 很好用,之前不行,是因为磁盘vdb没有分区和数据,后来我把vdb分了4个区,都有数据,执行gpart,很快就修复了

[root@localhost ~]# gpart /dev/vdb

Begin scan...

Possible partition(Linux ext2), size(100mb), offset(0mb)

Possible partition(Linux ext2), size(200mb), offset(100mb)

Possible partition(Linux ext2), size(300mb), offset(300mb)

Possible extended partition at offset(601mb)

Possible partition(Linux ext2), size(4518mb), offset(601mb)

End scan.

Checking partitions...

Partition(Linux ext2 filesystem): primary

Partition(Linux ext2 filesystem): primary

Partition(Linux ext2 filesystem): primary

Partition(Linux ext2 filesystem): primary

Ok.

Guessed primary partition table:

Primary partition(1)

type: 131(0x83)(Linux ext2 filesystem)

size: 100mb #s(205568) s(63-205630)

chs:  (0/1/1)-(203/15/62)d (0/1/1)-(203/15/62)r

Primary partition(2)

type: 131(0x83)(Linux ext2 filesystem)

size: 200mb #s(409602) s(205632-615233)

chs:  (204/0/1)-(610/5/39)d (204/0/1)-(610/5/39)r

Primary partition(3)

type: 131(0x83)(Linux ext2 filesystem)

size: 300mb #s(615888) s(615888-1231775)

chs:  (611/0/1)-(1023/15/63)d (611/0/1)-(1221/15/63)r

Primary partition(4)

type: 131(0x83)(Linux ext2 filesystem)

size: 4518mb #s(9253376) s(1231839-10485214)

chs:  (1023/15/63)-(1023/15/63)d (1222/1/1)-(10401/15/62)r

[root@localhost ~]# gpart -W /dev/vdb /dev/vdb

Begin scan...

Possible partition(Linux ext2), size(100mb), offset(0mb)

Possible partition(Linux ext2), size(200mb), offset(100mb)

Possible partition(Linux ext2), size(300mb), offset(300mb)

Possible extended partition at offset(601mb)

Possible partition(Linux ext2), size(4518mb), offset(601mb)

End scan.

Checking partitions...

Partition(Linux ext2 filesystem): primary

Partition(Linux ext2 filesystem): primary

Partition(Linux ext2 filesystem): primary

Partition(Linux ext2 filesystem): primary

Ok.

Guessed primary partition table:

Primary partition(1)

type: 131(0x83)(Linux ext2 filesystem)

size: 100mb #s(205568) s(63-205630)

chs:  (0/1/1)-(203/15/62)d (0/1/1)-(203/15/62)r

Primary partition(2)

type: 131(0x83)(Linux ext2 filesystem)

size: 200mb #s(409602) s(205632-615233)

chs:  (204/0/1)-(610/5/39)d (204/0/1)-(610/5/39)r

Primary partition(3)

type: 131(0x83)(Linux ext2 filesystem)

size: 300mb #s(615888) s(615888-1231775)

chs:  (611/0/1)-(1023/15/63)d (611/0/1)-(1221/15/63)r

Primary partition(4)

type: 131(0x83)(Linux ext2 filesystem)

size: 4518mb #s(9253376) s(1231839-10485214)

chs:  (1023/15/63)-(1023/15/63)d (1222/1/1)-(10401/15/62)r

Edit this table (y,n) : n

Activate which partition (1..4, q to quit) : 1234

Activate which partition (1..4, q to quit) : 1..4

Write this partition table (y,n) : y

Warning: partition table written, you should reboot now.

[root@localhost ~]# fdisk -l

Disk /dev/vda: 32.2 GB, 32212254720 bytes

16 heads, 63 sectors/track, 62415 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00014cd2

Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *           3        1018      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/vda2            1018        5179     2097152   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/vda3            5179       62416    28847104   83  Linux

Partition 3 does not end on cylinder boundary.

Disk /dev/vdb: 5368 MB, 5368709120 bytes

16 heads, 63 sectors/track, 10402 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System/dev/vdb1   *           1         204      102784   83  LinuxPartition 1 does not end on cylinder boundary./dev/vdb2             205         611      204801   83  LinuxPartition 2 does not end on cylinder boundary./dev/vdb3             612        1222      307944   83  Linux/dev/vdb4            1223       10402     4626688   83  Linux[root@localhost ~]# mount /dev/vdbvdb   vdb1  vdb2  vdb3  vdb4  [root@localhost ~]# mount /dev/vdb1 /mnt/1/[root@localhost ~]# mount /dev/vdb2 /mnt/2/[root@localhost ~]# mount /dev/vdb3 /mnt/3/[root@localhost ~]# mount /dev/vdb5 /mnt/4/mount: you must specify the filesystem type[root@localhost ~]# mount /dev/vdb4 /mnt/4/[root@localhost ~]# df -hFilesystem      Size  Used Avail Use% Mounted on/dev/vda3        27G  6.0G   20G  24% /tmpfs           4.0G   72K  4.0G   1% /dev/shm/dev/vda1       477M   33M  419M   8% /boot/dev/vdb1        98M  5.6M   87M   7% /mnt/1/dev/vdb2       194M  5.6M  179M   4% /mnt/2/dev/vdb3       292M   11M  267M   4% /mnt/3/dev/vdb4       4.4G  137M  4.0G   4% /mnt/4

linux断电分区表丢失,linux修复丢失的分区表相关推荐

  1. Linux下GPT分区,gdisk修复损坏的分区表

    今天在使用linux系统时,由于异常断电,在重启时,发现自己的一块磁盘/dev/sdb,变成了未分区状态.初步断定是分区表坏掉了.    之前有人使用testdisk修复这种情况,自己下载了testd ...

  2. linux mbr 分区表修复,备份/恢复MBR和分区表,以及无备份修复MBR及分区表错误;浅谈引导故障和分区方案...

    [原创]备份/恢复MBR和分区表以及无备份修复MBR和分区表错误,浅谈引导故障和分区方案.(完成66%) (这是我博客中的一篇文章,现在发到这里来) 手工备份/恢复MBR和分区表,以及无备份修复MBR ...

  3. 【疑难杂症爆破委员会】UEFI Linux、Windows双系统,丢失Windows的efi文件导致找不到启动项(恢复Windows的efi文件)

    [疑难杂症爆破委员会] UEFI Linux.Windows双系统,丢失Windows的efi文件导致找不到启动项,导致无法进入Windows系统 状况说明 状况是这样的:我本来好好的装着Linux和 ...

  4. Linux磁盘相关-分区与修复

    转自:http://balistardut.github.io/2016/01/30/Linux%E7%A3%81%E7%9B%98%E7%9B%B8%E5%85%B3-%E5%88%86%E5%8C ...

  5. Linux启动故障排查和修复技巧

    一个执着于技术的公众号 我发现Linux系统在启动过程中会出现一些故障,导致系统无法正常启动,我在这里写了几个应对单用户模式.GRUB命令操作.Linux救援模式的故障修复案例帮助大家了解此类问题的解 ...

  6. Linux 系统启动故障排查和修复

    我发现Linux系统在启动过程中会出现一些故障,导致系统无法正常启动,我在这里写了几个应用单用户模式.GRUB命令操作.Linux救援模式的故障修复案例帮助大家了解此类问题的解决. (一)单用户模式 ...

  7. 通过PXE启动rescue模式修复丢失的系统文件(fstab/bash/mount/grub)

    当系统由于某种原因导致以下几种系统文件丢失的时候,通过rescue模式可以很容易的帮我们修复系统而不用再麻烦的重装系统. 其中可能导致系统无法启动的文件有: /etc/fstab./bin/bash. ...

  8. linux修复安装软件,Linux系统安装教程及卸载修复

    如何安装Linux系统,Linux安装需要注意哪些问题,如何正确卸载Linux系统,Linux系统安装教程及卸载修复,随小编看看教程. 一.准备工作: 1.购买红旗Linux5.0桌面正式版安装光盘或 ...

  9. Linux系统引导过程及修复

    Linux系统引导过程及修复 1.通电 2.bios初始化 2.1 bios简介 2.2作用 3.磁盘引导 3.1mbr 3.2当mbr数据丢失系统会因为找不到启动分区而停止启动 3.2.1问题模拟方 ...

  10. 计算机bootmgr丢失,如何修复BOOTMGR缺少错误

    什么是BOOTMGR? BOOTMGR代表Windows启动管理器.从Windows Vista开始,到今天的Windows Server 2008和Windows 7标准版,BOOTMGR始终用于查 ...

最新文章

  1. Linux Kernel TCP/IP Stack — L2 Layer — Traffic Control(流量控制)
  2. C#实现winform仿div+css半透明遮罩效果
  3. 求幂,我居然又没做出来
  4. 869. 重新排序得到 2 的幂
  5. 《WinForm开发系列之控件篇》Item25 Lable(暂无)
  6. 输入挂(bzoj 2901: 矩阵求和)
  7. 第二部分 Automake的标准工程组织
  8. UE4官方文档UI学习:7. UMG 用事件驱动UI更新
  9. 怎样使用WP Review Pro插件?
  10. Linux操作系统面试题
  11. 总结一下__declspec(dllimport)的作用
  12. 如何高效的进行版本管理,版本管理的方法
  13. 单板嵌入式计算机定义,用于嵌入式控制系统的单板计算机
  14. 秒杀系统的技术架构设计与实现
  15. bind的原理和bind的实现
  16. 大数据“偏见”会让我们变蠢吗
  17. 2023年自动化测试真有那么重要吗?内卷严重,测试技能水涨船高......
  18. 河北省专接本计算机大纲,河北专接本考试科目大纲
  19. 机器学习编程sklearn常用语句
  20. [牛客网刷题]L32 非整数倍数据位宽转换24to128

热门文章

  1. 并联串联混合的电压和电流_详解三相并联型有源滤波器(APF)控制仿真!
  2. 学好UG编程之后,为什么要学习自己制作UG后处理?
  3. 无线电技术 | 关于无线定位技术TDOA的综合论述(一)
  4. html连接accdb文件,连接Access2007数所库(accdb格式数据库)需要另安驱动
  5. 水仙花数(java)
  6. 使用MySQLTuner脚本检测、优化MySQL数据库
  7. 基于433M频率无线通信模块在评委台的无线传输应用
  8. 华东师范大学 2017 计算机系暑期夏令营机试
  9. 网络基础:socket模块
  10. 相控阵天线(十二):天线校准技术仿真介绍之旋转矢量法