LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Lost Windows partition after using install-grub command (https://www.linuxquestions.org/questions/linux-newbie-8/lost-windows-partition-after-using-install-grub-command-582301/)

viperflyer 09-05-2007 02:38 AM

Lost Windows partition after using install-grub command
 
Please help. I was hoping to move GRUB from a hard-drive that is dieing a slow death to a good drive which already has Windows XP installed on it. I used command "sudo grub-install /dev/hda1" hoping to install GRUB on this good drive. However, in the process I have lost the drive altogether. I tried uninstalling GRUB by booting from Windows XP CD but I don't see that partition at all to log in and use FIXMBR. Is there any other alternative to recover this drive or have I lost all the data?

Thanks in advance.

Following is the outcome of "sudo fdisk -l"

Disk /dev/hda: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 7297 58613121 7 HPFS/NTFS

Disk /dev/hdd: 61.4 GB, 61492838400 bytes
255 heads, 63 sectors/track, 7476 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdd1 1 2557 20539071 83 Linux
/dev/hdd2 * 2558 7476 39511867+ 7 HPFS/NTFS

Lenard 09-05-2007 04:11 AM

Thiese are your Windows XP partitions;

/dev/hda1 * 1 7297 58613121 7 HPFS/NTFS (most likely you Windows C: drive)

/dev/hdd2 * 2558 7476 39511867+ 7 HPFS/NTFS (most likely your Windows D: or E: drive)

One can check the Windows partitions from Linux after installing fuse and ntfs-3g

You may be able to correct your mistake by booting into Linux and doing:

grub-install --recheck /dev/hda1

Also google on Bart PE

b0uncer 09-05-2007 04:18 AM

By giving hda1 to grub-install you specified it should install itself to the beginning of the hda1 partition. If you want to install it to MBR, you don't give the partition number, just the disk (hda for example, which is the same as (hd0)) on which you want GRUB be put on (to the MBR).

Installing GRUB should't destroy any personal data even if you did install it onto a partition and not MBR. It takes up 512 bytes from the beginning of the disk or partition, where a bootloader and partition table is usually stored in. Regular partitions start only after that, so your "problem" is just that the Windows bootloader is confused (probably because GRUB is where it wants to see something else); fixing it shouldn't be that bad, and anyway recovering your data for backing up for example is a matter of mounting the Windows partitions. Many modern distributions have ntfs read support out of the box (you need ntfs-3g only if you wish to write to the partitions also), so you can just mount the Windows partition(s) as you would mount any other partitions, specifying the filesystem type as ntfs (or auto).

syg00 09-05-2007 04:30 AM

Quote:

Originally Posted by viperflyer (Post 2881670)
I used command "sudo grub-install /dev/hda1"

Bad, *very* bad.
This over-writes the NTFS partition, not the MBR.
Quote:

I tried uninstalling GRUB by booting from Windows XP CD but I don't see that partition at all to log in and use FIXMBR. Is there any other alternative to recover this drive or have I lost all the data?
Try fixboot first, followed by fixmbr.
If you're lucky you'll be back in business.

Your data is still there, you just need to be able to get at it. See how you go with the above.

Edit: D'oh, slow typer ...


All times are GMT -5. The time now is 04:47 PM.