linux主分区表丢失,linux修复丢失的分区表
先模拟破快分区表
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 Linux
Partition 1 does not end on cylinder boundary.
/dev/vdb2 205 611 204801 83 Linux
Partition 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/vdb
vdb 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 -h
Filesystem 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修复丢失的分区表相关推荐
- Linux下GPT分区,gdisk修复损坏的分区表
今天在使用linux系统时,由于异常断电,在重启时,发现自己的一块磁盘/dev/sdb,变成了未分区状态.初步断定是分区表坏掉了. 之前有人使用testdisk修复这种情况,自己下载了testd ...
- linux 主进程 等待,Linux启动与进程
操作系统中,前台进程和后台进程有什么区别?特征是什么? 后台程序基本上不和用户交互,优先级别稍微低一点 前台的程序和用户交互,需要较高的响应速度,优先级别稍微高一点 直接从后台手工启动一个进程用得比较 ...
- linux mbr 分区表修复,备份/恢复MBR和分区表,以及无备份修复MBR及分区表错误;浅谈引导故障和分区方案...
[原创]备份/恢复MBR和分区表以及无备份修复MBR和分区表错误,浅谈引导故障和分区方案.(完成66%) (这是我博客中的一篇文章,现在发到这里来) 手工备份/恢复MBR和分区表,以及无备份修复MBR ...
- 【疑难杂症爆破委员会】UEFI Linux、Windows双系统,丢失Windows的efi文件导致找不到启动项(恢复Windows的efi文件)
[疑难杂症爆破委员会] UEFI Linux.Windows双系统,丢失Windows的efi文件导致找不到启动项,导致无法进入Windows系统 状况说明 状况是这样的:我本来好好的装着Linux和 ...
- 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 ...
- linux修复安装软件,Linux系统安装教程及卸载修复
如何安装Linux系统,Linux安装需要注意哪些问题,如何正确卸载Linux系统,Linux系统安装教程及卸载修复,随小编看看教程. 一.准备工作: 1.购买红旗Linux5.0桌面正式版安装光盘或 ...
- Linux系统引导过程及修复
Linux系统引导过程及修复 1.通电 2.bios初始化 2.1 bios简介 2.2作用 3.磁盘引导 3.1mbr 3.2当mbr数据丢失系统会因为找不到启动分区而停止启动 3.2.1问题模拟方 ...
- Linux启动故障排查和修复技巧
一个执着于技术的公众号 我发现Linux系统在启动过程中会出现一些故障,导致系统无法正常启动,我在这里写了几个应对单用户模式.GRUB命令操作.Linux救援模式的故障修复案例帮助大家了解此类问题的解 ...
- Linux 系统启动故障排查和修复
我发现Linux系统在启动过程中会出现一些故障,导致系统无法正常启动,我在这里写了几个应用单用户模式.GRUB命令操作.Linux救援模式的故障修复案例帮助大家了解此类问题的解决. (一)单用户模式 ...
- 通过PXE启动rescue模式修复丢失的系统文件(fstab/bash/mount/grub)
当系统由于某种原因导致以下几种系统文件丢失的时候,通过rescue模式可以很容易的帮我们修复系统而不用再麻烦的重装系统. 其中可能导致系统无法启动的文件有: /etc/fstab./bin/bash. ...
最新文章
- 我用1台笔记本模拟黑洞引力波,和超算2个月得出的结果只差1%丨马萨诸塞大学出品...
- numpy学习笔记(莫烦python)
- android listView的setOnScrollListener的使用
- c语言实现线性表的算法,数据结构算法代码实现——线性表的定义(一)
- 复杂电路简化经典例题_一天搞定考试系列之电路原理(3)
- 《AFTrans》来自ViT的免费午餐!北大阿里提出用于细粒度视觉识别的自适应注意多尺度融合Transformer...
- SAAS多租户实现方案_springboot 实现多租户_基于共享数据库_共享schema_共享数据表_基于baomidou_mybatis_plus---springcloud工作笔记158
- 【渝粤题库】陕西师范大学202281 中央银行学II 作业(专升本)
- java复制文件的4种方式及拷贝文件到另一个目录下的实例代码
- 递归算法经典实例python-Python递归算法详解
- 虚幻引擎3的代码讲解
- 计算机网络原理学习笔记
- 数组排序和集合排序的使用
- 手机短信校验(前端js)
- “3G域名”遭恶炒 用友移动代理被指画饼圈钱
- R语言 交互式绘图echarts4r包Pictorial深探
- 谷歌中国宣布启用简短域名g.cn
- Auto.js Pro安卓免ROOT引流脚本开发系列教程25网易公开课(3)-取用户性别
- Lumion 11软件介绍
- numpy.floor()函数的使用
热门文章
- 如何下载武清区卫星地图高清版大图?
- GMC Graph-Based Multi-View Clustering
- 蓝桥杯之单片机设计与开发——第八届省赛_基于单片机的电子钟程序设计与调试
- C++时间库chrono_Time_point (三)
- Android电子书和platforms下载【【【115网盘】】】
- 笔记本保养的8个注意事项
- Spring Condition条件使用示例
- 杂项-IM:IM(即时通讯),一种基于互联网的即时交流消息的业务
- 2月23日至3月5日所学(上)
- 爬取药品说明书,看看感冒药说明书背后的秘密|凹凸数读