打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
最新分享
在ubuntu 上使用TestDisk数据恢复

转自:http://www.360doc.com/   官方文档:http://www.360doc.com/

需求:

单系统ubuntu,想装windows,结果误删除了ubuntu下的一个分区(windows安装的时候明明看了好几遍,还是误删了),安装前,确认下分区状况,发现分区不对,立即停止安装系统,进入ubuntu(ubuntu启动不起来,将前512字节dd回MBR,也可以通过grub>命令修复),安装testdisk


testdisk简介

testdisk是一款强大并且免费的数据恢复的软件,软件的主要功能是当人为的错误(意外的删除你的分区表),软件出现问题,或者中毒的情况下,帮助用户找回丢失的分区,或者是将一个不能启动的盘让其启动起来。在很多的操作系统上,都可以使用testdisk,包括Linux,MacOS,Windows,并支持许多的文件系统

1 下载 TestDisk

TestDisk 在大多数linux的发行版上都有相应的软件包, 例如: Debian/Ubuntu, Fedora, Mandriva, 等 (完整的系统列表都在  http://www.360doc.com/). 在 Debian/Ubuntu 上你可以运行
apt-get install testdisk
来安装它

2 使用TestDisk

TestDisk 在ubuntu上可以用以下的命令运行
testdisk /list
可以列出你现有的分区表:
server1:~# testdisk /list
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Please wait...
Disk /dev/sda - 32 GB / 29 GiB - CHS 3916 255 63, sector size=512

Disk /dev/sda - 32 GB / 29 GiB - CHS 3916 255 63
      Partition                   Start         End     Size in sectors
1 * Linux                     0    1   1   3869 254 63    62171487
2 E extended               3870    0   1   3915 254 63      738990
5 L Linux Swap             3870    1   1   3915 254 63      738927
现在假设你误删分区表,现在需要修复,我们开始使用testdisk工具

testdisk
根据菜单提示去选择:
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org


TestDisk is a data recovery 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
<-- Create
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

   TestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.

Select a media (use Arrow keys, then press Enter):
Disk /dev/sda - 32 GB / 29 GiB


[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 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org


Disk /dev/sda - 32 GB / 29 GiB

Please select the partition table type, press Enter when done.
[Intel   ]   Intel/PC partition
[Mac     ]   Apple partition map
[None    ]   Non partioned 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 very
rare for a drive to be 'Non-partitioned'.
选择你的分区表类型
<-- Intel
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org


Disk /dev/sda - 32 GB / 29 GiB - CHS 3916 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.
<-- Analyse
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 32 GB / 29 GiB - CHS 3916 255 63
Current partition structure:
      Partition                   Start         End     Size in sectors
No partition is bootable













*=Primary bootable   P=Primary   L=Logical   E=Extended   D=Deleted

[Proceed ]
                             Try to locate partition
As you see, no bootable partitions have been found. Select
<-- Proceed
to continue. On the next screen TestDisk will show you the partitions it has found:
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 32 GB / 29 GiB - CHS 3916 255 63
      Partition                Start         End     Size in sectors
* Linux                     0    1   1   3869 254 63    62171487
L Linux Swap             3870    1   1   3915 254 63      738927











Structure: 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
EXT3 Large file Sparse superblock Recover, 31 GB / 29 GiB
<-- ENTER
现在将我们找回来的新分区表写回硬盘,选择write
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 32 GB / 29 GiB - CHS 3916 255 63

      Partition                   Start         End     Size in sectors
1 * Linux                     0    1   1   3869 254 63    62171487
2 E extended LBA           3870    0   1   3915 254 63      738990
5 L Linux Swap             3870    1   1   3915 254 63      738927













[   Quit   ]   [Search! ]   [ Write   ]
                        Write partition structure to disk
<-- Write
键入Y确定写入:
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Write partition table, confirm ? (Y/N)
<-- Y
TestDisk 告诉你需要重启系统以生效:
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org


You will have to reboot for the change to take effect.












[Ok]
<-- Ok
选择quit推出
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org


Disk /dev/sda - 32 GB / 29 GiB - CHS 3916 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.
<-- Quit
选择quit退出testdisk
TestDisk 6.5, Data Recovery Utility, October 2006
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

   TestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.

Select a media (use Arrow keys, then press Enter):
Disk /dev/sda - 32 GB / 29 GiB









[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.

                                   Quit program
<-- Quit
现在我们可以关闭testdisk然后重启系统,如果我们的运气不是很差的话,在新的分区表生效的情况下,我们的数据就可以找回来了,
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
用 testdisk 恢复 Linux 上已删除的文件
TestDisk & PhotoRec——两个数据恢复软件
TestDisk使用积累
误Ghost分区丢失数据恢复故障还原
电脑数据回复常用技巧大全!
在 Windows Vista 电脑上增加磁盘分区空间 - 惠普网上贴心服务 (中国 - ...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服