testdisk恢复ubuntu分区表
- testdisk介绍
- 安装testdisk
- 使用testdisk恢复分区表
testdisk介绍
testdisk 具有广泛的功能,包括恢复丢失或损坏的分区和使不能启动磁盘可以重新启动,也经常被用来恢复被误删的文件。
安装testdisk
如果系统分区表被删除,需要使用ubuntu的启动盘,选择try ubnutu模式进入试用系统。
1、可以直接在终端安装testdisk:
sudo apt-get install testdisk
通过命令直接打开testdisk:
testdisk
2、也可以访问testdisk的CN网站,
在文档帮助下找到下载,点击
选择 Linux, kernel 2.6.18 or later x86_64下载
下载完成后解压缩,进入解压缩文件夹内打开终端:
./testdisk_static
使用testdisk恢复分区表
进入testdisk界面后:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.orgTestDisk is free data recovery software designed to help recover lost
partitions and/or make non-booting disks bootable again when these symptoms
are caused by faulty software, certain types of viruses or human error.
It can also be used to repair some filesystem errors.Information gathered during TestDisk use can be recorded for later
review. If you choose to create the text file, testdisk.log , it
will contain TestDisk options, technical information and various
outputs; including any folder/file names TestDisk was used to find and
list onscreen.Use arrow keys to select, then press Enter key:
>[ Create ] Create a new log file[ Append ] Append information to log file[ No Log ] Don't record anything
选择[ No Log]
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.orgTestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.Select a media (use Arrow keys, then press Enter):
>Disk /dev/sda - 2000 GB / 1863 GiB - ST2000DM006-2DM164>[Proceed ] [ Quit ]Note: Disk capacity must be correctly detected for a successful recovery.
If a disk listed above has incorrect size, check HD jumper settings, BIOS
detection, and install the latest OS patches and disk drivers.
上下键选择要恢复分区的硬盘,然后选择[Proceed]
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.orgDisk /dev/sda - 2000 GB / 1863 GiB - ST2000DM006-2DM164Please select the partition table type, press Enter when done.
>[Intel ] Intel/PC partition[EFI GPT] EFI GPT partition map (Mac i386, some x86_64...)[Humax ] Humax partition table[Mac ] Apple partition map[None ] Non partitioned media[Sun ] Sun Solaris partition[XBox ] XBox partition[Return ] Return to disk selectionHint: Intel partition table type has been detected.
Note: Do NOT select 'None' for media with only a single partition. It's very
rare for a disk to be 'Non-partitioned'.
据说testdisk会自动选择分区表类型,我的自动选择是[Intel ],也确实没有问题。
Enter进入下一步:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.orgDisk /dev/sda - 2000 GB / 1863 GiB - ST2000DM006-2DM164CHS 243201 255 63 - sector size=512>[ 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 selectionNote: Correct disk geometry is required for a successful recovery. 'Analyse'
process may give some warnings if it thinks the logical geometry is mismatched.
选择[ Analyse ],进入下一步:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.orgDisk /dev/sda - 2000 GB / 1863 GiB - CHS 243201 255 63
Current partition structure:Partition Start End Size in sectors1 P Linux 26144 7 40 243201 78 13 34870251522 * Linux 0 32 33 127 155 28 20480003 P Linux 127 155 29 24104 80 40 3851857924 E extended 24104 113 8 26144 7 39 327659545 L Linux Swap 24104 113 10 26144 7 39 32765952*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
>[Quick Search] [ Backup ]Try to locate partition
现在显示的是当前该硬盘的分区状态,选择[Quick Search],进入下一步:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.orgDisk /dev/sda - 2000 GB / 1863 GiB - CHS 243201 255 63Partition Start End Size in sectors
>D Linux 0 32 33 127 155 28 2048000D Linux 127 155 29 24104 80 40 385185792D Linux Swap 24104 113 10 26144 7 39 32765952D Linux 26144 7 40 243201 78 13 3487025152Structure: Ok. Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,Enter: to continue
ext4 blocksize=4096 Large_file Sparse_SB Recover, 1048 MB / 1000 MiB
出现的分区就是当前的和删除分区前的分区表,上下键选择需要恢复的分区表,按P可以查看该分区下的文件目录。按照提示可以使用c键复制目录下的文件到其它位置。
发现自己需要的分区,按Enter键继续。
当所有分区被列出后,选择Write,按Enter,y或者OK,分区恢复。
如果有分区没有找到,可以在Write选择界面选择Deeper Search进行深度搜索。