[Novalug] boot embarrassment : clue, please?

Peter Larsen plarsen at famlarsen.homelinux.com
Fri Feb 13 16:21:33 EST 2009


On Fri, 2009-02-13 at 14:46 -0600, Beartooth wrote:
> On Fri, 13 Feb 2009, Peter Larsen wrote:
> 
> > Sounds like some computer science presentation may come in 
> > handy? A device is _anything_ that your computer talks to 
> > outside the main board. Your hdd is a device, your USB, your 
> > printer, your monitor, keyboard, mouse etc. It's something that 
> > interacts with the computer's mainboard - either directly or 
> > indirectly through a controller.
> 
>  	That helps, yes, thanks. But I have another problem, 
> possibly mine alone as a refugee from pure mathematics: I've 
> never been able to tell whether a device is hardware, or software 
> that does something with it -- identifies it, talks to it, 
> whatever. Sometimes it seems to be one, sometimes the other -- 
> to the extent that one hardware browser seems to use an entirely 
> different language than another.

That's because it's both. At least in the broadest form. To make
computers work we need both hardware and software. One doesn't work
without the other. That goes for printers, monitors etc. too. What some
see as a chip, others sees as a ROM with code in it that controls the
hardware. In essense, without software the hardware doesn't do anything.
Without the hardware, the software has nothing to run on.

When it comes to devices - we use hardware to hook things together.
Either by cables, via electric circuit boards or even over the air.
However, without software - the kernel and device module - this
connection means nothing to the computer. The software that "goes with"
the hardware makes the connection, so you the user can finally make use
of it.

There are situations where the software is "hardcoded" into the device,
others where the computer loads the software in the kernel/user space.
But in all cases, it's done to facilitate the communication with the
hardware.

Let's take a hard drive as an example. Inside the "box" you call the
hard drive you'll find the following: spinning platters, read/write
heads on top of the platters, motors, a controller board and SATA
plugs/power. The platters simply spins at a constant speed - 7200 rpms
or more (up to 15000 rpms on the high end drives). Basically, the faster
it spins the faster you can retrieve data (in theory). Still, at 15000
rpms the hard drive is still very slow compared to the processor. The
arms can move back and forth - and there's a head of each of the platter
surfaces. There's a small motor that controls the head movement.

Now - without anything else, the hard drive is rather useless. The
controller board holds a lot of chips and software. This board is what
makes the hard drive behave in the way you expect. It makes sure the
disk spins at the right speed. It moves the head in and out according to
commands it gets, and it turns on reading/writing as it is being
commanded to do. Since the platters are spinning slowly, the board
actually has a small queue on it - it remembers what it was told to do,
and while the arms and disk spins to get into the position you
requested, the "computer" on the board, waits. The smart ones looks at
the queue and finds the most optimal way to request data with as few
movements as possible. Once read, data is first put in small on-board
buffer and when the system bus is free, this buffer is then sent back to
the CPU or in most cases, memory address that it was requested to put
the data to.

As you see - the software on the main board is actually what runs the
hard drive logic. Even more complicated - the SATA bus also needs a
driver - which your kernel loads. This allows your computer to know how
to "ask" for the right stuff on the bus. 

The boarder between hardware and software isn't always easy to spot. For
instance, inside the central processing unit (CPU) is something called
microcode. This is what actually makes the CPU know how to execute
statements like MOV 0,AX - but the code when you look at it, is a simple
set of binary patterns that opens/closes circuits in the CPU to allow
for the flow of electrons. It's software - but very tightly coupled to
the hardware.

> 
> > What grub wants to know is where to install. In /boot/grub 
> > you'll find device-map. This is where you configure the map 
> > between unix devices and the pseudo map that grub uses 
> > (remember, grub runs before linux so it's sorta in it's own 
> > little world). This is usually generated for you on install, 
> > and in MOST installations your device would be hd0.
> >
> > This is mine on this laptop: (hd0)  /dev/sda
> >
> > What grub-install wants to know is the device - so you give it hd0. That
> > should be it.  You can also give it the unix-path (/dev/sda in my case).
> 
>  	So when my tab did nothing, and I took a stab at 
> substituting (hd0,0) into Varol's directions, I got lucky, right?

Sorta - not really luck. The last 0 is the partition. Computers start
counting from 0 - not 1 - so hd0,0 means the first hard drive, first
partition. I _think_ the latter ,0 is default if you don't tell it about
it.

/dev/sda is not a partition but a disk pointer. Grub usually gets
installed in the MBR and then inside the boot partition for the later
boot phases.

>  	Incidentally, that particular machine, designed as a 
> server, has two hard drives, which were originally locked 
> together to make one clone the other. I got my Friendly Local 
> Alpha Plus Technoid (FLAP) to unlock that. So would /dev/sdb have 
> worked??

If it's a poweredge SC - you should have a raid controller in there. I'm
pretty sure you have a mirrored pair, in which case to linux you have
_one_ hard drive, /dev/sda - and you cannot (at least not easily)
address each drive of the mirrored pair easily. The RAID controller
makes sure both drives are in sync with your updates.

If there's no raid controller you already have an /dev/sdb. Check your
dmesg output. It'll explain how many drives your computer actually sees
(do a search for sda - it'll bring you to the section where it found sda
- below it it would write about sdb if it found it and so on).

-- 
Peter Larsen <plarsen at famlarsen.homelinux.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://calypso.tux.org/pipermail/novalug/attachments/20090213/f3c9feeb/attachment.bin 


More information about the Novalug mailing list