old-www/LDP/LG/issue92/tag/3.html

532 lines
20 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<META NAME="generator" CONTENT="lgazmail v1.4G.i">
<TITLE>The Answer Gang 92: New hard drive</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!--endcut ==============================================-->
<!-- begin 3 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>New hard drive</H3>
<p><strong>From Rodrigues, Joseph
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By Thomas Adam, Ben Okopnik, John Karns, Anita Lewis
</strong></p>
<P><STRONG>
Hello answer gang,
</STRONG></P>
<P><STRONG>
I have recently installed an additional IDE hard drive on my system. I
previously had 1 IDE HD and one CDRW each on its on controller. After adding
the new HD, I changed the old HD and CDRW to one controller, HD master, CDRW
slave, and put the new HD on the other controller.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Right...
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
The Bios sees the new drive, Linux sees the new drive as <TT>/dev/hdc</TT>, but
looking at the output of the dmesg command I see that it can not find a
driver for it, thus I can't use Fdisk (that's what led me to look at dmesg
in the first place) to partition it and create the file systems that I want.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [John]
Hmm, this seems odd. It would seem that if the BIOS sees it, then the
Linux kernel should too.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
OK -- I think I see what you're saying, yet your terminology is completely
out
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> Linux does not use the concept of "drivers" -- there are no drivers
to run hardware from. The "<TT>/dev/</TT>" directory lists all the devices you'll
need, and it is the kernel that interfaces with them.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
My question to Joseph would be, what exactly are you seeing in the
output of "dmesg" that is causing you to draw this conclusion? The
conclusion is incorrect, but the message is still important.
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
To answer your question first.
This is what I get from the kernel
</STRONG></P>
<pre><strong>hdc: bad special flag:0x03
hdc: driver not present
</strong></pre>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Also, Fdisk is used to detect information about your drive -- NOT to set
formatting (as per the DOS equivilent). There is also a program called
"cfdisk" which is quite good, but still very much experimental and not
something that I would recommend you use. So, we'll stick to the CLI
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I know how to partition, create the file system, unfortunately I don't know
how to install the driver.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
The fact that you knew how to partition your drive is irrelivent in this
case, as I did not know that (my powers of Telepathy aren't all that great
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> ). Furthermore, I always like to try and expand on answers so that it
makes for good General Readership (tm), rather than answering you
specifically.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Anita]
<TT>/dev/hdc</TT> is likely the right device, since you said you have it on the 2nd
IDE and I assume as master.
</blockQuote>
<blockQuote>
First step is to partition it. Does 'fdisk <TT>/dev/hdc</TT>' do anything? Does the
drive get found? Hopefully it does and you can then use that program to
partition the drive making at least 1 partition. You don't have to
partition it all at this time if you only want to use part of it, but
remember that if you want more than 4 partitions, you will have to make one
of them extended. With fdisk, just do 'm' like it says in order to see the
commands.
</blockQuote>
<blockQuote>
After you have a partition, you can run mkfs on it --
</blockQuote>
<P>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
To create a filesystem (ext2), issue the following command.... (as root):
</P>
<pre>mke2fs -c /dev/hdc1
</pre>
<P>
(I have used the "-c" switch here to scan the drive for badblocks -- since
this is a new drive, this is a good idea).
</P>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I looked in the <TT>/dev</TT> directory and I do see a <TT>/hdc</TT> device, so I really don't
know how to proceed. I checked some of the howtos, but they all assume that
the driver is installed and you can access the drive.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Yes, <TT>/dev/hdc</TT> is listed, and yes, the kernel does detect it.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [John]
<TT>/dev</TT> has pre-existing entries for all commonly used devices. The
distro (<A HREF="http://www.suse.com/">SuSE</A> 7.1) on this laptop has hda through hdl. That doesn't
indicate that I have 12 ide devices connected.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
Erm... well, we don't actually know what the kernel detects. He may have a bad drive, some
totally weirdo IDE controller that Linux won't recognize (hey, anything
is possible), ...
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [John]
A couple of weeks ago I had a
similar experience with a new Western Digital drive. It seems that for
want of a few more pennies, they are now making hd's which are not
equipped with a full IDE controller. The one I was dealing with required
that it be connected with the jumper on the drive set to "cs" or cable
select. When set to master (why on earth they would bother to put a
"master" jumper position on a drive that didn't support it is beyond me)
I could do nothing with the drive. (Although I seem to remember that the
BIOS coudn't see it either, which seems to differ from what the querent is
seeing.) It was recognized fine when set to cable select, but that was
it. I thought the drive had died on me and brought it back for an
exchange.
</blockQuote>
<blockQuote>
Perhaps it was defective, I don't know. But I resisted the retailer's
argument that I just continue using it with the limitation of using it as
"cs", and insisted on exchanging it for different device. It was also a
different brand - Maxtor. The WD had a very "cheap" feel to it, much
lighter than any hd I can ever remember handling, which also made me
somewhat suspicious.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
...or a piece of buttered toast plugged into the slot.
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [John]
I believe this may be the case here.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
Oh - so it <EM>is</EM> a piece of buttered toast? Right on! I didn't think my
ESP was working that well, but if you insist...
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
With a bit of ginger marmalade, yum.
</blockQuote>
<blockquote><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] Alrighty then
<IMG SRC="../../gx/dennis/smily.gif" ALT=":D"
height="24" width="20" align="middle"> Can we get a photo for "Really Weird Things
That Can Manage To Run Linux If You Really Try" ? If not, I will
have to see if we can get a picture of that for
a future HelpDex! Buttered toast as a drive must really cook.
</blockquote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
<IMG SRC="../../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle"> Indeed, but sometimes, Ben unless we are told otherwise certain
"stock" assumptions have to be made
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
The reason
why you cannot access it is because it has not been formatted yet in a
manner that the kernel can understand.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
This, however, is highly probable.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [John]
He should be able to run fdisk on an unformatted disk. My guess is that
the kernel makes an inquiry to the drive controller, and the platter
contents should completely irrelevant. One possible exception would be a
drive having some surface damage in a critical area such as sector zero -
which might cause a problem for the controller ... or the controller being
defective.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
I meant "access" as in "read/write files, etc."; I'm pretty certain
Thomas did as well.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Yes, I did, Ben. The querent already stated it was seen in "dmesg" output. I
was more concerned with ensuring that the drive could read/write files, etc.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
"fdisk" does indeed deal specifically with the IDE
control mechanism rather than the platter contents (other than track 0);
it shouldn't care about the contents at all, although some broken DOS
versions (I'm thinking specifically of OnTrack, lo these many years ago)
could be made to hang with a maliciously crafted MBR - there was a
mutated version of the "Jerusalem" virus that was plain murder on
Compaqs. I met several "techies" who mistakenly threw away perfectly
good HDs because of it.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
SeaGate drives were also notorious for falling on their backs with their
legs twitching after about a year or so.....
</blockQuote>
<blockQuote>
(back to the querent)
What exactly do you have planned for this new drive, once it has been
formatted? I <EM>strongly</EM> suggest (no -- I am TELLING you)
<IMG SRC="../../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> to read the
following...:
</blockQuote>
<blockQuote><BLOCKQuote>
<A HREF="../../issue83/okopnik.html"
>http://linuxgazette.com/issue83/okopnik.html</A>
</BLOCKQuote></blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
<IMG SRC="../../gx/dennis/smily.gif" ALT="&lt;grin&gt;"
height="24" width="20" align="middle"> Thanks, Thomas. My own advertising service, how cool!
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Now -- that said, and you have your drive formatted, you'll now want an
entry for it in <TT>/etc/fstab</TT> so that it can be mounted, so....
</blockQuote>
<blockquote><pre>mkdir /some_new_mount_point
</pre></blockquote>
<blockQuote>
(change the above as necessary -- that'll ensure a mount point for the new
drive. Some people like to have their devices mounted under "<TT>/mnt</TT>" - it is
up to you).
</blockQuote>
<blockQuote>
now -- you up until now you haven't said exactly which filesystem you'll
be using. I stuck with ext2 as it is the de-facto for kernels &lt; 2.4.xx. If
you're running a kernel version &gt;=2.4.17 and it has ext3 support compiled
in (it ought to) -- then you can use ext3. To do that though, you'll need
to run....
</blockQuote>
<blockquote><pre>tune2fs -j /dev/hdc1
</pre></blockquote>
<blockQuote>
to create the journal. If you know you're not using ext3 then skip that.
</blockQuote>
<blockQuote>
So...now edit <TT>/etc/fstab</TT>, and add an entry similar to this....
</blockQuote>
<blockQuote>
<TT>/dev/hdc</TT> <TT>/mp</TT> ext2 defaults 1 1
</blockQuote>
<blockQuote>
You'll have to change the above as necessary (and make sure that you
change ext2 -&gt; ext3 or vise-versa). Then when that is done, save the file.
</blockQuote>
<blockQuote>
now issue the command....
</blockQuote>
<blockquote><pre>mount -a
</pre></blockquote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
Since "defaults" in the above includes the "auto" option, this partition
will be mounted automatically the next time you boot. However, the last
two numbers which you show as "1 1" take a little more than just a
blind copy-and-paste. From the "fstab" man page:
</blockQuote>
<blockQuote><BLOCKQuote>
The fifth field, (fs_freq), is used for these filesystems by the
dump(
<IMG SRC="../../gx/dennis/smily.gif" ALT="8)"
height="24" width="20" align="middle"> command to determine which filesystems need to be dumped.
If the fifth field is not present, a value of zero is returned
and dump will assume that the filesystem does not need to be
dumped.
</BLOCKQuote></blockQuote>
<blockQuote>
The sixth field, (fs_passno), is used by the fsck(
<IMG SRC="../../gx/dennis/smily.gif" ALT="8)"
height="24" width="20" align="middle"> program
to determine the order in which filesystem checks are done at
reboot time. The root filesystem should be specified with a
fs_passno of 1, and other filesystems should have a fs_passno of
2. Filesystems within a drive will be checked sequentially,
but filesystems on different drives will be checked at the same
time to utilize parallelism available in the hardware. If the
sixth field is not present or zero, a value of zero is returned
and fsck will assume that the filesystem does not need to be
checked.
</blockQuote>
<blockQuote>
So, "fs_passno" will depend on exactly what this partition is. Not a
huge thing, but it should be done right.
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
and that'll mount your new drive. If you "cd" to the mount-point, you'll
find a "Lost+Found" directory there, which is used during "fsck"'s for any
lost inode data that can be found.
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
System information:
</STRONG></P>
<blockquote><code><font color="#000033"><br>Suse 8.1
<br>HDs both are WD just different models
</font></code></blockquote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Any help would be appreciated.
</STRONG></P>
<HR width="10%" align="left"><P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Here is what I did.
I booted from the CDR and went into rescue mode. From there I had no
problem accessing hdc and using fdisk to partition the disk as I wanted.
</STRONG></P>
<P><STRONG>
I installed linux on it, and copied my current home partition
from <TT>/dev/hda</TT> to <TT>/dev/hdc.</TT> (yes I could have copied all the file
systems, but I am not proficient enough to work out all the details,
this way it took me less time to do it, and less aggravation. I may
still want to do this as an exercise later).
</STRONG></P>
<P><STRONG>
I went back to booting from <TT>/dev/hda</TT> and was still having the same
problem with hdc when booting from hda. I just got a response from
someone which I think may have hit the nail on the head, and I quote:
"Just a thought: do you have a line such as "hdc=ide-scsi" somewhere in
your LILO (or GRUB or whatever) configuration? Trying to treat the hard
drive as an ATAPI device might cause the problem you're seeing."
sent by John-Paul Stewart.
</STRONG></P>
<P><STRONG>
As a matter of fact I do. As soon as I get home today, I will check the
parameters from by boot setup from hdc against hda and correct the hda
parameters.
</STRONG></P>
<P><STRONG>
I am hopeful that this may be the cause of the problem.
</STRONG></P>
<P><STRONG>
Thanks for all your help.
</STRONG></P>
<P><STRONG>
Joe.
</STRONG></P>
<!-- end 3 -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
<h5>
<br>Copyright &copy; 2003
<br>Copying license <A HREF="">http://www.linuxgazette.com/copying.html</A>
<BR>Published in Issue 92 of <i>Linux Gazette</i>, July 2003</H5>
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<SMALL><CENTER><H6 ALIGN="center">HTML script maintained by
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H6></SMALL></CENTER>
<HR>
<!--startcut ======================================================= -->
<P> <hr>
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
<p align="center">
<table width="100%" border="0"><tr>
<td align="right" valign="center"
><IMG ALT="" SRC="../../gx/navbar/left.jpg"
WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="middle" border="0"
><A HREF="../index.html"
><IMG SRC="../../gx/navbar/toc.jpg" align="middle"
ALT="[ Table Of Contents ]" border="0"></A
><A HREF="../lg_answer.html"
><IMG SRC="../../gx/dennis/answertoc.jpg" align="middle"
ALT="[ Answer Guy Current Index ]" border="0"></A></td>
<td align="center" valign="center"><A HREF="../lg_answer.html#greeting"><img align="middle"
src="../../gx/dennis/smily.gif" alt="greetings" border="0"></A> &nbsp;
<A HREF="../../tag/bios.html">Meet&nbsp;the&nbsp;Gang</A> &nbsp;
<A HREF="1.html">1</A> &nbsp;
<A HREF="2.html">2</A> &nbsp;
<A HREF="3.html">3</A> &nbsp;
<A HREF="4.html">4</A>
</td>
<td align="left" valign="center"><A HREF="../../tag/kb.html"
><IMG SRC="../../gx/dennis/answerpast.jpg" align="middle"
ALT="[ Index of Past Answers ]" border="0"></A
><IMG ALT="" SRC="../../gx/navbar/right.jpg" align="middle"
WIDTH="14" HEIGHT="45" BORDER="0"></td></tr></table>
</p>
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<!--endcut ========================================================= -->
<P> <hr>
<!--startcut ======================================================= -->
<CENTER>
<!-- *** BEGIN navbar *** -->
<!-- *** END navbar *** -->
</CENTER>
</p>
<!--endcut ========================================================= -->
<!--startcut ======================================================= -->
</BODY></HTML>
<!--endcut ========================================================= -->