·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
  发表评论 查看评论(共有条评论) 我要提问
 
 


最新资讯更多>> 
· 蔡伦和Linus等入选最有影响力的..
· 第二届LinuxCon 2010大会向共众..
· Leeenux 2.0 – Linux上网本操..
· Canonical发布安全更新涉及众多..
· Google黑客攻击事件更多细节
· Symbian开放源代码 开源是否等..
· “塞班平板”不是没可能 已开始..
· Google 说我们对 WebKit 开源项..
· SymbianOS开源的五点益处
· Core i3-530集成显卡Linux性能..
论坛热点更多>> 
· 我安装了一个CENTOS,但是上..
· 想XP换成ubuntu,可行不?
· CentOS的稳定性如何?能作服..
· 无聊小问题,Linux现在在中国..
· 新人。问题一直在线询问帖子
· 2.6.20内核 3.5寸屏移植
· redhat下如何下载软件?
· redhat中获取当前登录用户的..
· 安装ntfs-3g报错,各位请帮忙看看
· 如何实现文件的复制权限
文档更新更多>> 
· linux下u盘使用
· ubuntu dynamips 绑定网卡到虚拟机
· 虚拟机Debian中网卡无法启动
· 剖析SUSE Linux Tomcat自动启动
· Linux启动过程综述
· 分区大小调整完全手册
· 一步一学Linux与Windows 共享文件..
· 使用U盘安装Debian
· [Ubuntu-9.10] 修改 grub 以更改..
· cacti下利用thold插件来进行EMAI..
 
关于我们 | 联系方式 | 广告合作 | 诚聘英才 | 网站地图 | 友情链接 | 免费注册

Copyright © 2001-2009 ChinaUnix.net All Rights Reserved

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

京ICP证041476号