Restore lost linux partitions and repair grub

Source: Internet
Author: User
Tags testdisk
Restore lost linux partitions and repair grub 1. background original hard disk partition: C (NTFS), D (NTFS), E (350G, NTFS) download ubuntu-12.04-desktop-i386.iso, hard disk installation ubuntu12.04 installation, delete the edisk partition in liveCD, create a new one from the end...
Restore lost linux partitions and repair grub 1. background original hard disk partition: C (NTFS), D (NTFS), E (350G, NTFS) download ubuntu-12.04-desktop-i386.iso, hard disk installation ubuntu12.04 installation, delete the edisk partition in liveCD, create a GB ext4 partition from the end, mount it to "/", and create a 2 gb swap partition. at this time, there is no allocated space between disk D and SWAP about GB. After the installation is complete, grub is mounted to the ext4 partition and the system is guided through grub. everything works normally. After windows is restarted, an unallocated GB space is used to create a new NTFS partition: an edisk. (Note: linux ext file system cannot be identified in windows. this step will lead to the loss of ext4 partitions in the partition table, resulting in subsequent problems)
2. grub rescue www.2cto.com restarts the system again, and an error occurs: unknown filesystem. go to grub rescue mode error: unknown filesystemgrub rescue> enter the ls command to view the partition grub rescue> ls (hd0) (hd0, msdos6) (hd0, msdos5) (hd0, msdos1) to ls for the four partitions respectively, try to find the partition grub rescue> ls (hd0, msdosX) where grub is located) but error: unknown filesystem is returned for all the four partitions (note: This is because the ext4 partition where grub is located does not exist in the partition table). it seems impossible to fix it directly in grub rescue. Fortunately, there is still liveCD to see what's going on with the hard disk.
3. recover lost linux partition because there is no optical drive, I give priority to the production of U disk liveCD, tried to use UNetbootin and UltraISO to write the ubuntu-12.04-desktop-i386.iso image into the U disk, can not start (U disk also tried two, one 1 GB disk and one 16 GB disk failed, and the one gb usb flash disk was used as the win pe boot disk.) I did not go into the details. To save time, I borrowed a USB drive and ubuntu12.04 to install the disc. Enter the ubuntu system from liveCD and run the fdisk command to view the partition. The ext4 partition is no longer visible. It is said that testdisk is an artifact for repairing partition tables. after apt-get fails (the cause is unknown), I manually downloaded version 6.14, run, select hard disk, scan, after a period of time, seven or eight D Ed partitions with the D Mark are all the products of the previous tossing partitions. find the Linux ext4 partition in which start and end can be connected to the existing partition, press the P key to view the list of partition files. then, press the left and right keys to change the partition mark from D to * (Bootable Primary ), before that, however, you must change the * mark of disk C to P (Primary), probably because only one bootable partition is allowed. Follow the prompts to write these changes to the partition table. After www.2cto.com exits testdisk, run fdisk again. you can see that the ext4 partition has been retrieved.
4. after the grub is restarted, it still enters grub rescue. use the method described in the second section to partition ls one by one until ls (hd0, msdosX) can list the files in the partition, if multiple linux partitions exist, check whether/boot/grub exists. If "/boot" is not attached separately, run the following command grub rescue> ls (hd0, msdosX)/boot/grub. if "/boot" is attached to an independent partition, run the following command grub rescue> ls (hd0, msdosX)/grub and press Enter. if you can list a bunch of files, the location of grub is found. grub rescue> set root = (hd0, msdosX) grub rescue> set prefix = (hd0, msdosX)/boot/grubgrub rescue> insmod/boot/grub/normal. mod www.2cto.com and execute grub rescue> normal. the grub menu appears for a long time. Go to ubuntu and run sudo update-grubsudo grub-install/dev/sda on the terminal. sda indicates the hard disk number, instead of restarting the partition number. then, go to the grub menu and the repair is successful. 5. refer to [1] ljj_jjl2008. Grub Rescue repair method (according to the online information, the introduction of commands also introduced the principle). Ubuntu Chinese forum. http://forum.ubuntu.org.cn/viewtopic.php? F = 139 & t = 348503 author pengeorge
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.