问题描述: linux主机重启后丢失分区表,怎么解决。
问题解答: Testdisk 官网下载:http://www.cgsecurity.org/wiki/TestDisk_CN
[root@mx ~]# tar -jxvf testdisk-7.0.linux26-x86_64.tar.bz2
[root@mx ~]# cd testdisk-7.0 [root@mx ~]# ls [root@mx ~]# ./testdisk_static
第一页屏幕要求选择如何处理记录信息
第二页要求选择磁盘: TestDisk is free software, and comes with ABSOLUTELY NO WARRANTY.
Select a media (use Arrow keys, then press Enter): >Disk /dev/sda - 21 GB / 20 GiB - VMware, VMware Virtual S Disk /dev/sr0 - 3720 MB / 3548 MiB (RO) - VMware Virtual SATA CDRW Drive [Proceed ] [ Quit ]
第三页选择分区表类型,一般都是 Intel/PC: Disk /dev/sda - 21 GB / 20 GiB Please select the partition table type, press Enter when done. [Intel ] Intel/PC partition [Mac ] Apple partition map [None ] Non partitioned media [Sun ] Sun Solaris partition [XBox ] XBox partition [Return ] Return to disk selection Note: Do NOT select 'None' for media with only a single partition. It's veryrare for a drive to be 'N
现在可以 Analyse (分析)了: Disk /dev/sda - 21 GB / 19 GiB - CHS 2610 255 63 [ Analyse ] Analyse current partition structure and search for lost partitions [ Advanced ] Filesystem Utils [ Geometry ] Change disk geometry [ Options ] Modify options [ MBR Code ] Write TestDisk MBR code to first sector [ Delete ] Delete all data in the partition table [ Quit ] Return to disk selection Note: Correct disk geometry is required for a successful recovery. 'Analyse' process may give some warnings if it thinks the logical geometry is mismatched.
列出现有的分区表内容,并提示继续还是备份,这里只有一个分区,实际上另外一个 Linux 分区被删了。 所以 1937 之前那些空间就是寻找的目标: Disk /dev/sda - 21 GB / 20 GiB - CHS 2610 255 63 Current partition structure: Partition Start End Size in sectors 1 * Linux 0 32 33 25 159 6 409600 2 P Linux Swap 1937 218 10 2068 101 17 2097152 *=Primary bootable P=Primary L=Logical E=Extended D=Deleted >[Quick Search] [ Backup ]
Disk /dev/sda - 21 GB / 20 GiB - CHS 2610 255 63 Partition Start End Size in sectors >* Linux 0 32 33 25 159 6 409600 * Linux 25 159 7 1937 218 9 30720000 P Linux Swap 1937 218 10 2068 101 17 2097152
使用左右方向键将其调整成以前的状态 P(主分区),然后 Enter 继续: Disk /dev/sda - 21 GB / 20 GiB - CHS 2610 255 63 Partition Start End Size in sectors * Linux 0 32 33 25 159 6 409600 >P Linux 25 159 7 1937 218 9 30720000 P Linux Swap 1937 218 10 2068 101 17 2097152
Write partition structure to disk 选择 Write 保存 Write partition table, confirm ? (Y/N) Y 退出,reboot
|