BBS水木清华站∶精华区

发信人: linuxrat (竹剑居士*农大历史上最差的学生), 信区: Linux        
标  题: 挽救已遭破坏的分区表[FWD] 
发信站: BBS 水木清华站 (Thu Feb  3 11:32:50 2000) 
 
 想来不小心的道友经常会碰上这种事情, 这里提供一篇文章, 参考一下吧. 
 不过我的习惯总是fdisk -l /dev/hdX > hdX.info. 备份起来就高枕无忧了. 
 预防为主么, 不要等到出了问题才慌张哦. 防患于未然啦. 呵呵... 
 URL:http://www.linuxforum.com/plug/articles/partition.html 
===Begin=== 
   Partition Disaster Recovery 
 
   If you have attempted an install of a RedHat/Mandrake distribution and 
   you are dual-booting another operating system (like MS Windows), you 
   may have trashed your partition table and can no longer access MS 
   Windows. 
 
   There is a Linux Partition-Rescue mini-HOWTO, but it seems slightly 
   askew to me, telling you to find Partition Magic, a commercial 
   program, "on the internet", and having used the program Partition 
   Magic, I don't think it could do it as well as this article. 
 
   But fear not, there is a way to recover. Essentially, you will be 
   using Linux fdisk to rebuild your partition table. If you get it 
   correct, your partitions are restored. The reason this works is that 
   Linux fdisk does not automatically format the partition when it is 
   created; you need to give a separate command for that in Linux, 
   because you have many choices as to how to format the partition. MS 
   fdisk just creates a new table and formats at teh same time. 
 
   Like most recovery strategies, it helps if you plan ahead. If you are 
   reading this before the fact, here is what you should do: 
     * Run Linux fdisk with the -l option, like this: fdisk /dev/hda -l > 
       /tmp/hdaconfig.txt 
     * This generates a file that contains teh same info as if you ran 
       fdisk /dev/hda and used the p copmmand to see the drive partition 
       information. 
     * Print this information out and save it- it can come in very handy. 
     * Practice with any recoery tools you may need to use. 
 
   The Magic 
     * Boot to Linux (you can use an all-on-a-floppy distro like 
       tomsrtbt). 
     * Run fdisk /dev/hda at the prompt after you log on. 
     * Using the information that you had prviously saved, re-create the 
       partition table exactly, including parition types (fat32, ext2, 
       etc.) 
     * Use the w command to write the new partition table and exit fdisk. 
     * If your MBR is messed up, boot to the Windows Emergency Boot 
       Disk(you did make one, didn't you?) and run fdisk /mbr to restore 
       the MS master boot record. 
     * Re-boot and Windows should be back. 
     * You can use you Linux boot disk (you did make one, didn't you?) to 
       boot to your Linux install and run /sbin/lilo to restore lilo to 
       the mbr if needed. 
 
   HELP - I didn't make a MS Windows Emergency Boot Disk or Don't Have a 
   Bootable DOS Disk With MS fdisk! 
 
   You can: 
     * Borrow one from a friend. Remember to thank them. 
     * Begin the MS Windows install on another computer and go only as 
       far as the "Create and Emergency Boot Disk" section. (If you stop 
       there, it won't mess up the existing insttall of MS WIndows on 
       that machine - don't do anything stupid. OK?) 
     * Use FREEDOS . 
 
   HELP - I didn't make a Linux Boot Disk! 
(这个tomsrtbt可以在http://www.toms.net/rb/home.html找到, 其实也就是一个 
 rescue盘之类的东东啦. ) 
   You can get tomsrtbt , the install/utility disk from Peanut Linux, 
   AIRMID Linux or something similar, then boot your Linux of choice. 
     * From the lilo prompt of Peanut and AIRMID, you can try lilo 
       root=/dev/hdax ro ,where x is the partition number of your Linux 
       partition. 
 
 
     * For tomsrtbt, you need to mount the Linux partition from your hard 
       drive by: 
 
     mkdir /mnt/linux #this is to create a mount point 
 
     mount -t ext2 /dev/hdax /mnt/linux #this mounts an ext2 partition 
     known as hdax (where x is the number of the partition) 
 
     /lilo -r /mnt/linux/etc #this causes tomsrtbt to run lilo using the 
     configuration in you hard drive partition, writing you lilo 
     information to your mbr. 
 
 
   This article is a work in progress. I would appreciate you feedback. 
 
===End===== 
-- 
 //sigh, 签名档太长会浪费空间, 所以放到个人说明档里面去了。呵呵... 
 我转载的一切文章, 版权归相应的作者所有。 
 
※ 修改:·linuxrat 於 Feb  3 15:02:07 修改本文·[FROM: 202.112.168.253] 
※ 来源:·BBS 水木清华站 smth.org·[FROM: 202.112.168.253] 

BBS水木清华站∶精华区