# Need help with PATA on the libata system

## fuzzybee

I'm doing a new install - booting off a LiveCD.  I believe it was the latest, FWIW.  This CD does not use libata for my PATA drives, so I have /dev/hda (my boot drive), /dev/hdb (my DVD-ROM), and /dev/sda, sdb, and sdc.  

I'd like to go ahead and remove the deprecated old PATA drivers, so I complied my kernel using sata_nv and pata_amd.  Of course, this moves my devices off /dev/hd* - but it moves them to the end of my /dev/sd* range.  My questions regarding this:

- How do I do my grub device matrix?  When I CHROOT off my install CD, it builds in the /dev/hda.  Can I manually alter this file before I install my grub.conf, and will it let me apply it to the (then) /dev/hda?

- What happens if I add another SATA drive? Does this totally botch my boot, since it would (presumably) move my PATA drive to /dev/sde?

I guess a nice workaround would be to somehow allow my PATA drive to boot first, since it will always be my boot disk.  Is there any way to make it appear as /dev/sda short of removing the other drives?

----------

## BradN

1 (grub):  Grub doesn't care about sda/hda for the bootloader itself - it uses the system BIOS to load the kernel.  So changing the kernel drivers won't affect grub itself at all.  But, you may need to alter your kernel boot parameters to reflect the new device.

2 (device naming):  I think the best strategy here is to not even worry about what name devices show up as, but instead look into the UUID feature that can be used in fstab to specify volumes without using the path to the device.  http://linux.byexamples.com/archives/321/fstab-with-uuid/

I believe there's a way to use UUID in the kernel parameters as well, but I haven't checked.

Good luck!

----------

## fuzzybee

Thanks for the response.

I looked up the UUID stuff for #2 - doesn't seem too difficult.  Two of my SATA drives arem't reporting UUIDs (although I shouldn't need them for booting) - could this be because the partitions are empty? (EDIT: ignore this - I hadn't formatted the partitions)

I'm a little confused.  Here's my current (non-functional) grub.conf:

title Gentoo Linux 2.6.34-r12

root (hd0,0)

kernel /boot/kernel-2.6.34-gentoo-r12 root=/dev/hda3

title Gentoo Linux 2.6.34-r12 (rescue)

root (hd0,0)

kernel /boot/kernel-2.6.34-gentoo-r12 root=/dev/hda3 init=/bin/bb

Should I be able to replace the root=/dev/hda3 with root=GUID=blah for the root partition?

----------

## BradN

The best way to find out is just give it a shot - it won't wreck anything if it doesn't work  :Smile: 

Tip:  Use the edit command in grub to try it out, then if it works, make the change in the config file.

----------

## NeddySeagoon

fuzzybee,

```
kernel /boot/kernel-2.6.34-gentoo-r12 root=/dev/hda3
```

will be wrong.

It will either be sda3 or sdc3, depending on how your BIOS is set. 

Trial and error is easy. At the boot screen, press e then follow the on screen instructions.

The root fsck will fail when the kernel loads because /etc/fstab will be wrong.  You can fix that.

At the prompt ... or give the root password for maintainance, give the root password.

You system will continue to boot but with errors as root is read only.

Run 

```
mount -o remount,rw /
```

to get root rw.

Now you can edit /etc/fstab, and grub.conf in the normal way.

After that, shutdown for a reboot.

You can use UUID on the kernel line in grub.conf but you need to call mount from inside an initrd to do it.

The kernel does not read UUIDs itself.

----------

## fuzzybee

Thanks.

The UUIDs won't change when I boot out of the CHROOT, will they?  I've already set those in my fstab.

I *believe* my pata drive comes up as /dev/sdd1-3.  I guess I'll just plan on booting off a CD if I add another SATA disk, eh?

I've seen it bantered around to leave the PATA driver in the kernel, and load the SATA driver as a module to ensure it loads second.  Would this work in getting my PATA drive to always go to /dev/sda?

----------

## NeddySeagoon

fuzzybee,

The UUIDS will only chnage if your reformat the filesystem.

You mean the PATA driver in the SATA menu ?

Yes, that works because the in kernel things are initialised before modules are loaded.

If you add another drive, you can use the trial and error method at the grub prompt.

----------

## fuzzybee

Got it.  Thanks again for the help.

----------

## fuzzybee

Thanks for your help, everybody - got it booted up this afternoon.

----------

## BradN

No problem  :Smile: 

----------

