Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to fix GRUB on my PC, but I'm running into serious issues doing so. Any help would be greatly appreciated as I'm completely crippled right now. Here is the sequence of events for this PC:

  1. Installed Windows 7
  2. Split full disk into two partitions (one for win7 and one for multimedia)
  3. Long time passed
  4. Split one of the partitions into two again
  5. Installed Ubuntu 11.04 on new partition
  6. A little time passed
  7. Windows 7 acting up, reinstall
  8. Ubuntu GRUB gone
  9. Tried restoring GRUB by mounting and grub-install from live USB
  10. Tried switching to a live CD instead of USB (thinking it might be the drive)
  11. Now I don't see GRUB and I'm getting "input/output" errors

An example i/o error:

ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbe86aff6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       48727   391393280    7  HPFS/NTFS
/dev/sda2           48727       77063   227612647+   7  HPFS/NTFS
/dev/sda3           77063       91202   113566721    5  Extended
/dev/sda5           77063       90622   108908544   83  Linux
/dev/sda6           90622       91202     4657152   82  Linux swap / Solaris


ubuntu@ubuntu:~$ sudo mount /dev/sda5 /mnt
ubuntu@ubuntu:~$ sudo grub-install --root-directory=/mnt /dev/sda
mkdir: cannot create directory `/mnt/boot': Input/output error
ubuntu@ubuntu:~$ cd /mnt
ubuntu@ubuntu:/mnt$ ls
ls: cannot access etc: Input/output error
share|improve this question
    
I/O error indicates a HDD problem. Check your disk. –  arrange Jul 28 '11 at 12:28
    
Input/ouput error definitely mean you have messed up with you hdd man.. –  llm Jul 29 '11 at 3:02
add comment

3 Answers

Try to install Boot-repair. It's a very useful utility, because you can repair GRUB easily, according to your problem.

share|improve this answer
add comment

Boot Repair

enter image description here

Main features...

*. Recover or Repair your Grub code in MBR when you can't even boot your OS.

*. Repair it within the OS (you know, even if you removed your boot loader, as long as you don't reboot your PC, you're gonna be fine, for a while :P)

*. Reinstall the loader.

enter image description here

*. Change the location of the GRUB installation (you know, installing it into an another HDD, etc).

*. Restore the original boot sector.

You can install the magnificent :D Boot-Repair in Ubuntu 11.04 Natty Narwhal, 11.10 Oneiric Ocelot, 12.04 Precise Pangolin, 10.10 and 10.04 by entering the below command in your Terminal.

  sudo add-apt-repository ppa:yannubuntu/boot-repair
  sudo apt-get update
  sudo apt-get install boot-repair

How the heck can I use it if I can't boot into my Ubuntu desktop Gayan!, you... nutcase?

Well my friend, use your Live CD or Live USB... boot into your desktop using those media and simply instal the Boot-Repair using the same command. Or I think you should be able to run it in the "/usr/bin" directory if no internet connection is available. In that sense, we can actually create a Linux recovery disk/LiveCD by using this app that should help to access/recover our data without even losing a single byte! :D. Good luck.

share|improve this answer
add comment

It does looks like that the best thing to do before anything is to boot it up and make a backup of your "MULTIMEDIA" partition so if something happens the damage should be not that much.

If you are getting errors from I/O it might be because when you did your partitions been compromised. That happen also with me when I upgraded from Vista till win7 that it created it self new NTFS partitions and having problems with one logical partition where it used to be the ubuntu(thanks god not my /home)

After you manage to do your backup you can try out this commands in a terminal (I'm assuming that your ubuntu is in sda5)

mount /dev/sda5 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
cp /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt
grub-install --recheck /dev/sda

and reboot your computer and it should load the ubuntu, after that you have to add your windows over the grub2 menu list, to do it so type in one terminal

sudo update-grub

I hope that you can solve your problem and you dosent need to reinstall everything again (including win). If you have to do it so I recommend to make you partitions physical and not logical how the windows does. There is many ways to create it partitions before installing the OS's. I recommend to have one HirensBoot always in hand. In this cd you can find all the kinds of tools that you might need to partitioned your HD and many, many others cool things

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.