Discussion:
IDE drive seen as SATA; I'm stuck
(too old to reply)
Mike Spencer
2019-10-26 06:44:54 UTC
Permalink
This may sound complicated but it may not be so very much so if you
know more than I do. And not Slackware-specific but all Slackware
under the hood.

Machine 1 has a native SATA HD and IDE connectors as well.

Installed new Linux (SLackware 14.2) on the SATA HD. All in order.

Connected a 500 G IDE drive to an IDE connector and installed new
Slackware on it, too. The system saw the IDE drive as /dev/sdb, i.e
as if it were a SATA drive. I don't understand why but I carried on.
Install proceeded as expected.

Using the CMOS menu ("hit F12 for boot options"), I can choose from

+ onboard SATA drive
+ onboard IDE drive
+ onboard DVD
+ onboard floppy

Choosing "onboard IDE drive" from the menu, the system boots from the
IDE drive. So the CMOS is seeing it as IDE even though Linux thinks
it's a SATA. All is well with the new install on the IDE drive.

Transfer ~/*, archival data, make numerous tweaks. Still boots & runs
fine.

Now I move that IDE HD to another machine, Machine 2, whose HD was
native IDE, connect it to IDE connectors. Boot fails. (Expected.
I'll come back to this.)

Booting from an install DVD, as root, cfdisk sees the new IDE HD as sda.
cfdisk says there *is* no hda. What? Not as expected.

I had expected that this HD would be seen, when plugged into Machine
2, as hda. I had expected to boot from DVD, edit lilo.conf to have:

boot = /dev/hda

image = /boot/vmlinuz
root = /dev/hda3

and run lilo. But because the system only sees sda, lilo won't do
this. "Fatal: open /dev/hda: No such device..."

How do I make Machine 2 see this HD as hda?

I don't know where the data bits reside that causes the HD to be seen
as sda when connected to an IDE plug in a machine that was IDE native
from the start.

The MBR itself doesn't contain any references to "sda" or "hda" but
lilo must have put that data somewhere when the IDE drive was running
on Machine 1. And Machine 2 failed to boot (I'm guessing here)
because of it?

Would (from a DVD boot) doing

mount -t ext4 /dev/sda3 /mnt
chroot /mnt
lilo -b /dev/sda

but with the hda lines above in lilo.conf fix it on reboot?

Sounds like a shot in the dark: -b forces *write* to (what is
presently) sda but lilo would need to find location data for hda when,
as far as lilo can tell, hda doesn't exist.

Running lilo -v -t -b /dev/sda (-t == dry-run) produces warnings but
none relevant to the problem.

I *reallly* don't understand this sda vs. hda business.
/proc/partitions doesn't exist under a DVD rescue boot. Where does
the kernel get the data for /proc/partitions at boot time? Can I
change that?


I really *really* don't want to do the partitioning over because I
have many hours into transferring data and doing something like 50
separate tweaks to configure everything, a tedious and painstaking
task.

Help?
--
Michael Spencer Nova Scotia, Canada
netrixtardis
2019-10-26 08:30:58 UTC
Permalink
Post by Mike Spencer
This may sound complicated but it may not be so very much so if you
know more than I do. And not Slackware-specific but all Slackware
under the hood.
Machine 1 has a native SATA HD and IDE connectors as well.
Installed new Linux (SLackware 14.2) on the SATA HD. All in order.
Connected a 500 G IDE drive to an IDE connector and installed new
Slackware on it, too. The system saw the IDE drive as /dev/sdb, i.e
as if it were a SATA drive. I don't understand why but I carried on.
Install proceeded as expected.
Using the CMOS menu ("hit F12 for boot options"), I can choose from
+ onboard SATA drive
+ onboard IDE drive
+ onboard DVD
+ onboard floppy
Choosing "onboard IDE drive" from the menu, the system boots from the
IDE drive. So the CMOS is seeing it as IDE even though Linux thinks
it's a SATA. All is well with the new install on the IDE drive.
Transfer ~/*, archival data, make numerous tweaks. Still boots & runs
fine.
Now I move that IDE HD to another machine, Machine 2, whose HD was
native IDE, connect it to IDE connectors. Boot fails. (Expected.
I'll come back to this.)
Booting from an install DVD, as root, cfdisk sees the new IDE HD as sda.
cfdisk says there *is* no hda. What? Not as expected.
I had expected that this HD would be seen, when plugged into Machine
boot = /dev/hda
image = /boot/vmlinuz
root = /dev/hda3
and run lilo. But because the system only sees sda, lilo won't do
this. "Fatal: open /dev/hda: No such device..."
How do I make Machine 2 see this HD as hda?
I don't know where the data bits reside that causes the HD to be seen
as sda when connected to an IDE plug in a machine that was IDE native
from the start.
The MBR itself doesn't contain any references to "sda" or "hda" but
lilo must have put that data somewhere when the IDE drive was running
on Machine 1. And Machine 2 failed to boot (I'm guessing here)
because of it?
Would (from a DVD boot) doing
mount -t ext4 /dev/sda3 /mnt
chroot /mnt
lilo -b /dev/sda
but with the hda lines above in lilo.conf fix it on reboot?
Sounds like a shot in the dark: -b forces *write* to (what is
presently) sda but lilo would need to find location data for hda when,
as far as lilo can tell, hda doesn't exist.
Running lilo -v -t -b /dev/sda (-t == dry-run) produces warnings but
none relevant to the problem.
I *reallly* don't understand this sda vs. hda business.
/proc/partitions doesn't exist under a DVD rescue boot. Where does
the kernel get the data for /proc/partitions at boot time? Can I
change that?
I really *really* don't want to do the partitioning over because I
have many hours into transferring data and doing something like 50
separate tweaks to configure everything, a tedious and painstaking
task.
Help?
I recall that since kernel 2.6.19 all PATA/SATA are using the same
driver, which calls all drives as /dev/sd*. see
https://kernelnewbies.org/Linux_2_6_19#Libata_PATA_.28Parallel_ATA.29_merge
for details. As such, on the 2nd machine the drive would be seen as
/dev/sda, and you should update your lilo config to match.
Mike Spencer
2019-10-27 05:02:57 UTC
Permalink
Post by netrixtardis
[much snippage]
How do I make Machine 2 [Slack 14.2] see this HD as hda?
[more snippage]
I recall that since kernel 2.6.19 all PATA/SATA are using the same
driver, which calls all drives as /dev/sd*. see
https://kernelnewbies.org/Linux_2_6_19#Libata_PATA_.28Parallel_ATA.29_merge
for details. As such, on the 2nd machine the drive would be seen as
/dev/sda, and you should update your lilo config to match.
Ah, just so. The price of clinging doggedly to the trailing edge of
technology. :-)

Edit lilo.conf and fstab to reference sda, run lilo and all is well.

Now, with a clean boot and all basic functionality, of course I have
more problems that I'll put in separate posts.

I *have* installed recent kernels but just a vanilla Slackware install
on whatever hardware was there -- this Acer laptop, f'rgzample.
Upgrading from Slack 11/2.4 kernel on this machine is the first time
in many years that I've dealt with moving HDs around from one box to
another in the process of building the system.

And I didn't know about *all* HDs being sdx to newer kernels so I had
painted^H^H^H^H^H^H^H configured myself into a corner.

Tnx to netrixtardis, Petri Kaukasoina, Aragorn, Eric Pozharski. No
need to quote you all at length here; all point me to the same hole
in my knowledge. Why I was still using Slack 11 is another, possibly
boring story.
--
Michael Spencer Nova Scotia, Canada
Petri Kaukasoina
2019-10-26 08:33:27 UTC
Permalink
Post by Mike Spencer
Machine 1 has a native SATA HD and IDE connectors as well.
Installed new Linux (SLackware 14.2) on the SATA HD. All in order.
Connected a 500 G IDE drive to an IDE connector and installed new
Slackware on it, too. The system saw the IDE drive as /dev/sdb, i.e
as if it were a SATA drive. I don't understand why but I carried on.
Install proceeded as expected.
Using the CMOS menu ("hit F12 for boot options"), I can choose from
+ onboard SATA drive
+ onboard IDE drive
+ onboard DVD
+ onboard floppy
Choosing "onboard IDE drive" from the menu, the system boots from the
IDE drive. So the CMOS is seeing it as IDE even though Linux thinks
it's a SATA. All is well with the new install on the IDE drive.
What do you have in /etc/lilo.conf on that new install which boots?
My crystal ball tells you have:
boot=/dev/sdb
root=/dev/sdb3
Post by Mike Spencer
Now I move that IDE HD to another machine, Machine 2, whose HD was
native IDE, connect it to IDE connectors. Boot fails.
How does it fail? According to my crystal ball, your kernel boots but it
tells you it can't find the root device. That would mean it tries to find
root on /dev/sdb3 and now you only have one disk. It should have been
root=/dev/sda3, instead.

Boot machine 2. If your default lilo entry is called 'linux', write
'linux root=/dev/sda3' to the lilo prompt. Does it boot now? Fix lilo.conf,
run lilo and reboot.
Petri Kaukasoina
2019-10-26 08:44:15 UTC
Permalink
Post by Petri Kaukasoina
What do you have in /etc/lilo.conf on that new install which boots?
boot=/dev/sdb
root=/dev/sdb3
How does it fail? According to my crystal ball, your kernel boots but it
tells you it can't find the root device. That would mean it tries to find
root on /dev/sdb3 and now you only have one disk. It should have been
root=/dev/sda3, instead.
Boot machine 2. If your default lilo entry is called 'linux', write
'linux root=/dev/sda3' to the lilo prompt. Does it boot now? Fix lilo.conf,
run lilo and reboot.
Or you could boot machine 1 from that disk, change lilo.conf to have
boot=/dev/sdb
root=/dev/sda3
then run lilo, move disk to machine 2, boot, change lilo.conf to
boot=/dev/sda
root=/dev/sda3
and run lilo. The idea is that boot= contains the present device name where
to write now and root= contains the name that the device will have when booted
next time.
Aragorn
2019-10-26 10:35:28 UTC
Permalink
Post by Mike Spencer
This may sound complicated but it may not be so very much so if you
know more than I do. And not Slackware-specific but all Slackware
under the hood.
Machine 1 has a native SATA HD and IDE connectors as well.
Installed new Linux (SLackware 14.2) on the SATA HD. All in order.
Connected a 500 G IDE drive to an IDE connector and installed new
Slackware on it, too. The system saw the IDE drive as /dev/sdb, i.e
as if it were a SATA drive. I don't understand why but I carried on.
Welcome to the 21st century. The Linux kernel has been treating all
PATA and SATA — note that all SATA drives and even SCSI/SAS drives are
IDE ("Integrated Drive Electronics") drives — as SCSI devices for at
least ten years already. So that means that the old /dev/hdX
designations are no longer used, and that they are all addressed by the
kernel via the SCSI mid-layer as /dev/sdX.
Post by Mike Spencer
Install proceeded as expected.
Using the CMOS menu ("hit F12 for boot options"), I can choose from
+ onboard SATA drive
+ onboard IDE drive
+ onboard DVD
+ onboard floppy
Choosing "onboard IDE drive" from the menu, the system boots from the
IDE drive. So the CMOS is seeing it as IDE even though Linux thinks
it's a SATA.
SATA is IDE too. What you mean is PATA. And yes, the BIOS will see
that it's a PATA drive because the BIOS deals with the low-level
connection protocol. The Linux kernel no longer differentiates between
parallel ATA/IDE and serial ATA/IDE, although SATA devices will
commonly get a lower alphabetic character for the X in "/dev/sdX" than
PATA devices.
Post by Mike Spencer
All is well with the new install on the IDE drive.
Transfer ~/*, archival data, make numerous tweaks. Still boots & runs
fine.
Now I move that IDE HD to another machine, Machine 2, whose HD was
native IDE, connect it to IDE connectors. Boot fails. (Expected.
I'll come back to this.)
Different hardware and different bus address for the device.
Post by Mike Spencer
Booting from an install DVD, as root, cfdisk sees the new IDE HD as
sda. cfdisk says there *is* no hda. What? Not as expected.
See higher up.
Post by Mike Spencer
I had expected that this HD would be seen, when plugged into Machine
boot = /dev/hda
image = /boot/vmlinuz
root = /dev/hda3
and run lilo. But because the system only sees sda, lilo won't do
this. "Fatal: open /dev/hda: No such device..."
How do I make Machine 2 see this HD as hda?
You can't — or at least, not with any kernel more recent than 2.6.18 or
so. I'm not sure on the exact kernel version where the old
designations were dropped, but I'm guessing it will have been around
that time.
Post by Mike Spencer
I don't know where the data bits reside that causes the HD to be seen
as sda when connected to an IDE plug in a machine that was IDE native
from the start.
Now you're just making stuff up. I suggest reading the documentation
of the Linux kernel.
Post by Mike Spencer
I *reallly* don't understand this sda vs. hda business.
See higher up.
Post by Mike Spencer
/proc/partitions doesn't exist under a DVD rescue boot. Where does
the kernel get the data for /proc/partitions at boot time?
It gets that from udev.
Post by Mike Spencer
Can I change that?
No.
Post by Mike Spencer
I really *really* don't want to do the partitioning over because I
have many hours into transferring data and doing something like 50
separate tweaks to configure everything, a tedious and painstaking
task.
There is no need to repartition anything. Just start using the
/dev/sdX designations instead of /dev/hdX. Or better still, use
filesystem UUIDs or (unique) filesystem LABELs.

$ man mkfs

$ man mount

$ man fstab
--
With respect,
= Aragorn =
Eric Pozharski
2019-10-26 12:43:27 UTC
Permalink
with <***@roadgrime.nodomain.nowhere> Mike Spencer wrote:

*SKIP*
Post by Mike Spencer
How do I make Machine 2 see this HD as hda?
You don't. 'boot=' option of /etc/lilo.conf tells lilo where to put
its stuff. lilo operates on block-specials directly -- as major-minor
block-specials as those pairs translate in INT13 of real-mode BIOS.
Because lilo does its magick before kernel comes, and isn't OS by
itself, thus when lilo is doing its magick there is no /dev/hda or
/dev/sda.

*CUT*
--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
Loading...