·ChinaUnix首页 ·论坛 ·博客 
Linux首页 | Linux新闻 | Linux论坛 | Linux文档 | Linux下载 | Linux博客 | Linux搜索 | 开源项目孵化平台 | 《开源时代》
新手入门 | 安装启动 | 管理员指南 | 开发手册 | 桌面应用 | 程序开发 | 数据库 | 网络技术| CentOS | Fedora | MySQL | Apache | Ubuntu | Gentoo| OSCON08
  Linux时代 >> 技术文档 >> 系统管理
 
TestDisk 恢复误删的磁盘分区
来源: ChinaUnix博客  日期: 2007.10.27 16:59 (共有条评论) 我要评论
 

                                                    昨晚装系统,不小心把移动硬盘上一个 81G 的 reiserfs 分区给删除了,那上面可有积累了六年的资料啊,当时还没反应过来,甚至沾沾自喜,过了一会才发现该删的分区完好无损,这才仔细一看,原来如此...
    于是赶紧卸载了移动硬盘,保证不会再犯傻去给那块空闲的空间新建分区... 早上忽然想到以前在什么地方看到过的一个软件 TestDisk,于是赶紧展开救援工作...
一、安装 TestDisk
    在这里下载
    http://www.cgsecurity.org/testdisk-6.8.tar.bz2
tar jxvf testdisk-6.8.tar.bz2
cd testdisk-6.8
./configure
make
sudo make install
二、恢复实践
    启动 testdisk:
sudo /usr/local/sbin/testdisk
    第一页屏幕要求选择如何处理记录信息
   
TestDisk 6.8, Data Recovery Utility, August 2007
Christophe GRENIER
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
    第二页要求选择磁盘:
TestDisk 6.8, Data Recovery Utility, August 2007
Christophe GRENIER
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/hda - 40 GB / 37 GiB
Disk /dev/sda - 120 GB / 111 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.
    下一页选择分区表类型,一般都是 Intel/PC:
TestDisk 6.8, Data Recovery Utility, August 2007
Christophe GRENIER
http://www.cgsecurity.org
Disk /dev/sda - 120 GB / 111 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 very
rare for a drive to be 'Non-partitioned'.
    现在可以 Analyse 了:
TestDisk 6.8, Data Recovery Utility, August 2007
Christophe GRENIER
http://www.cgsecurity.org
Disk /dev/sda - 120 GB / 111 GiB - CHS 14593 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 分区昨晚被我删了...所以 9960 之前那些空间就是寻找的目标:
TestDisk 6.8, Data Recovery Utility, August 2007
Christophe GRENIER
http://www.cgsecurity.org
Disk /dev/sda - 120 GB / 111 GiB - CHS 14593 255 63
Current partition structure:
     Partition                  Start        End    Size in sectors
1 P FAT32 LBA             9960   0  1 14592 254 63   74429145 [HZG'S]
No partition is bootable
*=Primary bootable  P=Primary  L=Logical  E=Extended  D=Deleted
[Proceed ]  [ Backup ]
                            Try to locate partition
    直接选择开始处理(Proceed),要问你一句:
TestDisk 6.8, Data Recovery Utility, August 2007Christophe GRENIER http://www.cgsecurity.orgShould TestDisk search for partition created under Vista ? [Y/N] (answer Yes ifunsure)
    不知道啥叫 Vista,我选 N:
TestDisk 6.8, Data Recovery Utility, August 2007
Christophe GRENIER
http://www.cgsecurity.org
Disk /dev/sda - 120 GB / 111 GiB - CHS 14593 255 63
     Partition               Start        End    Size in sectors
* Linux                    0   1  1  9959 254 63  160007337
P FAT32 LBA             9960   0  1 14592 254 63   74429145 [HZG'S]
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
ReiserFS 3.6 with standard journal, need recovery, 81 GB / 76 GiB
哈哈,看到了没有, 0~9959 那个 Linux 分区,被发现了...
    使用左右方向键将其调整成以前的状态 P(主分区),然后 Enter 继续:
TestDisk 6.8, Data Recovery Utility, August 2007Christophe GRENIER http://www.cgsecurity.orgDisk /dev/sda - 120 GB / 111 GiB - CHS 14593 255 63     Partition                  Start        End    Size in sectors 1 P Linux                    0   1  1  9959 254 63  160007337 2 P FAT32 LBA             9960   0  1 14592 254 63   74429145 [HZG'S][  Quit  ]  [Search! ]  [ Write  ]                       Write partition structure to disk
    选择 Write 保存,万事大吉!!
三、感慨
TestDisk 很好用...
               
               
               
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/23703/showart_408954.html
  发表评论 查看评论(共有条评论) 我要提问
 
 


最新资讯更多>> 
· 金山卫士开源计划首周源码下载..
· 谷歌劝说诺基亚采用Android操作..
· 11月份Linux市场占有率升至5%
· Apache 基金会确认退出 JCP 执..
· Chrome 10 新功能探秘:新增GP..
· 金山宣布开源其安全软件
· 开源FTP服务器ProFTPD发现后门
· 女黑客在开源会议上抱受骚扰
· 21款值得关注的Linux游戏
· 马化腾:腾讯半年后彻底转型,..
论坛热点更多>> 
· Linux系统移植从零开始!参与..
· 学习linux的意义在哪里
· 使用netfilter在哪能获取到原..
· 哥纠结了
· 一个在线读开源代码的工具,..
· 为什么我的目录下没有.cshrc..
· 初学linux从哪里开始
· linux 系统无法上网
· 新手安装UCenter 时总是出错..
· cacti添加主机显示的状态都是..
文档更新更多>> 
· 菜鸟入门三星ARM11嵌入式系统,是..
· 寻redhat 5.3 的中文手册 for ia64
· 请问redhat 5.3 企业版的用户手册..
· LINUX与UNIX SHELL编程指南(中文)
· 一些基本用户管理以及基本安装方法
· 菜鸟学习linux笔记与练习-----第..
· 菜鸟学习linux笔记与练习-----第..
· 服务器配置:Squid配置详解
· linux下u盘使用
· ubuntu dynamips 绑定网卡到虚拟机
 
关于我们 | 联系方式 | 广告合作 | 诚聘英才 | 网站地图 | 友情链接 | 免费注册

Copyright © 2001-2009 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们

京ICP证:060528号