Adding a Second Hard Disk in Linux

December 08, 2006
This article explains how you can connect an IDE hard disk to a computer in different combinations just by changing its jumper settings.

I have the following IDE hard disks.
  • A Seagate 12 GB hard disk
  • A Samsung 2.1 GB hard disk
  • And another Seagate 20 GB hard disk

I wanted to add one of them as a second hard disk to my computer.

I opened up the computer case and inserted one of the hard disk (listed above) in the hard disk bay, set up the connectors and turned on the machine hoping to see it boot up as normal.

Problem : GRUB gives the error that it can't find the root partition

That was rather surprising as I had not made any changes to the structure of the hard disk either by re-installing Linux or modifying the grub menu. After some head scratching, I figured out that perhaps the hard disks are detected in a different order by the computer. To verify this, I booted using a Linux Live CD and I was right. The original hard disk was detected by Linux as '/dev/hdb' instead of /dev/hda and this messed up everything as my /etc/fstab file and the GRUB menu had the entry '/dev/hda'.

The thing to remember is that IDE hard disks have around 8 pins at the back which can be connected together via jumpers. And depending on what position you have set the jumpers, the hard disks will be detected in different ways by the computer.

Usually, when you buy a new hard drive, it will have the jumper pins in the cable select position. This allows the drive to assume the proper role of master or slave based on the connector used on the cable. For the cable select setting to work properly, the cables you are using must support the cable select feature.

In my case, I had two hard disks connected using the same cable and both had the jumper pins in the cable select position. This meant that when I booted the PC, it automatically selected one hard disk as the primary master and the other as the primary slave.

And unfortunately, it selected the hard disk which had the Linux OSes as the primary slave which was why it was detected by Linux as '/dev/hdb' instead of '/dev/hda'.

IDE hard disk jumper settings
IDE Hard disk jumper settings

Once I figured this out, the solution was simple. I re-opened my computer case and changed the jumper settings of the hard disk containing the Linux OS to the primary master and the jumper settings of the second hard disk to the slave position and I was able to boot into Linux without a problem.

Different IDE hard disks have different jumper positions for setting them as primary and slave and the positions are usually printed on top of the hard disk.

Check the table printed on your hard disk before changing the jumper pins.

I now have two remaining hard disks. I can fit them into the computer too, but then you can connect only a total of four devices this way namely -

  1. primary master,
  2. primary slave,
  3. secondary master, and
  4. secondary slave

Then I won't have a vacant slot to connect the internal CD Writer and the DVD drive. So I use these two hard disks for backing up data.


  • It is good that SATA drives have got ridden of this problem, meaning setting the master/slave jumpers as on older IDE drives.

    I am still wondering when the CD/DVD-ROMS will get more SATA ports, as still you find that most of the new models are released w/o SATA support.

  • Old hard drives are "data loss" just waiting to happen.

    Not only are they tiny (and sloooooow), but well well well past their MTBF rating (at least thats true in most cases).

    With new 5 year warranty 250G PATA drives costing $82US why dork around with old & tiny drives?

    If you say, that's ok, my data is pretty much worthless and I don't care if it disappears, then why store it at all, delete it and move on.

  • @anonymous
    I agree when you say that for critical data, these hard drives are not good. But these old hard drives can be effectively used to store say ISO images of Linux OSes, software packages and in some cases even be used to mount a local repository, then you can store mp3 music - a ton of them in a 10 GB hard disk. And if they just die, no harm at all as still it would have met my purpose.

    So if my uses are those I stated above, I think it is a waste of money to go out and buy a brand new hard disk even if it costs only $82.

  • If you have got a mix of SATA and IDE, re-jumpering may not help.

    At issue is the GRUB's device map that keeps changing when you add drives. If the change is just an addition at the bottom of the list, you can easily manage. But it gets serious when the changes imply re-ordering.

    In my mind, the only way out is for GRUB to identify drives by label. You, the user, can then decide what and where. In rare cases, when duplicate labels occur, GRUB should stop and ask the user to rectify. So whatever the mix and the BIOS view of the mix, GRUB would not be fooled.

  • Grub makes your life easier for this, as you can just hit 'e' at the boot prompt, then hit 'e' again to edit the boot lines and check that you have the right devices. Tab completion allows you to actually check the paths are correct. Then you can boot without a boot-cd and get your system running, but don't forget to edit the /boot/grub/menu.lst and make it correct for your next reboot.

    Of course, making sure your main disk is /dev/hda (primary master) will save you lots of trouble, but raid controllers and sata may end up before your main disk if you have not used them before.

  • i added more disks to my box with the aid of hdd controller cards by promise. Worked well for me :)

  • This is not a linux specific problem - the same thing can happen for windows too. All the hard disk detection is done by the BIOS - before booting the OS.

    I got this problem when I used a SATA HDD and a IDE HDD together. I could not get it to work.

  • SATA is not good for linux... at least not yet..

    Ask anyone who knows what happen when you try to install linux on a SATA hard drive (primary those with a VIA-chipset)

    SATA is not good.. Not goood!!!

  • @ anonymous (12/13/2006 07:45:05 AM)

    i've been running linux for more than 2 years on sata drives .. never had a problem.
    HOWEVER, wanting to install windows on a 250 gb sata disk is plainly impossible as the windows setup only detects drives up to 120 gb ..

    As i said never had a problem with sata, i have had problems witch drives that grub didn't find anymore after i added or removed some ide drive .. my guess is that IDE comes first in my bios .. sata second , so every time i add an ide drive i have to edit my grub menu.lst ==> i'm beginning to get the hang of it :D

  • It is good that SATA drives have got ridden of this problem, meaning setting the master/slave jumpers as on older IDE drives.

    True in the most part. Some early versions of motherboards' chipset have issues with detecting newer SATA II connections. (VIA800 Chipsets) Thus, newer sata hard drives have a jumper to select SATA I or II connections.