Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Grub troubles. Moving linux from hda to hdb

    It seems windows is entirely incabable of booting from anything but hda so I took a friends sujestion and tried to move my linux drive from hda to hdb, however I seem to be having problems getting it to boot. I'm not too fussed about getting window's in the grub boot menu as I can use f11 in my bios to select the drive to boot from.

    I'm using Debian Sarge RC and Grub. I edit the grub and fstab to load hdb instead of hda but when I boot grub gives me this error.
     root (hd1,0)
    Filesystem type unknown, partition type 0x7
    kernel /boot/vmlinuz-2.6.8-2-k7 root=/dev/hdb1 ro
    Error 17:cannot mount selected partition
    press any key....
    If I select the old grub menu option for hda (even thoguh the drive is now on hdb) it actuially seems to boot normally for a moment before stopping with some errors.
    (note, I've also since upgraded to kernel 2.6.11-1-k7 but haven't tried with that as I assume it's not the problem)

    to change the drive from hda to hdb I used the grub module for webmin to duplicate and edit the entry and editid my fstab file to change hda to hdb.

    extract from /boot/grub/menu.lst
    title		Debian GNU/Linux, kernel 2.6.8-2-k7 
    root		(hd0,0)
    kernel		/boot/vmlinuz-2.6.8-2-k7 root=/dev/hda1 ro 
    initrd		/boot/initrd.img-2.6.8-2-k7
    title Debian GNU/Linux, kernel 2.6.8-2-k7 (HDB)
    root (hd1,0)
    kernel /boot/vmlinuz-2.6.8-2-k7 root=/dev/hdb1 ro 
    initrd /boot/initrd.img-2.6.8-2-k7
    the second option is the edited one made by webmin for booting off hdb.

    extract from /etc/fstab
    /dev/hda1       /               reiserfs notail          0       1
    /dev/hda6       /home           reiserfs defaults        0       2
    /dev/hda5       none            swap    sw              0       0
    And I just change the hda's to hdb's when I'm trying to boot with the hard drive on hdb.

    Anyone know what's going wrong here? Thanks.

  2. #2
    Linux Engineer
    Join Date
    Apr 2005
    Buenos Aires, Argentina
    I'd try this command:
    grub-install /dev/hdb
    If that doesn't work, take a look at this.
    "All the drugs in this world won\'t save you from yourself"

  3. #3
    Linux Guru
    Join Date
    May 2004
    Maybe I should do some research here, but who's got time? Is the following theory possible?

    "hda", "hdb", etc are determined by how the drives are "hardwired" to the motherboard, that is hdb is the slave drive on the primary IDE channel.

    Grub sees (hd0) as the drive from which it booted -not where the configuration files, etc are, but rather the drive which has an MBR with Grub installed.

    Is it possible that by choosing to boot the primary slave, Grub sees it as (hd0), while once the kernel is loaded, Linux sees it as hdb?

    When you boot, get the Grub command line, enter 'root (hd0,1)' and then 'kernel / <tab>' and see if that doesn't display the root directory listing. If so, try 'root (hd0,0)' and then make the "root=/dev/hdb1" and make fstab look for hdb.

    Just a theory...
    //got nothin'
    ///this use to look better

  4. $spacer_open
  5. #4
    Linux Newbie
    Join Date
    Jul 2004

    Re: Grub troubles. Moving linux from hda to hdb

    Quote Originally Posted by Zarneth
    Error 17&#58;cannot mount selected partition
    Sounds to me as if you haven't got reiserfs support in grub...

  6. #5
    Sounds to me as if you haven't got reiserfs support in grub...
    I wondered that too but it boots fine from reiserfs when everything's configured to hda.

    Thanks for the sugestions. However I found another supprisingly simple solution.
    I didn't think it was possible but adding the following code to the windows entry in grub fools windows into thinking it's running off hda even thoguh it's still the slave drive/hdb
    map (hd0) (hd1)
    map (hd1) (hd0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts