VizagInfo.com Home | VizagInfo Mirror of LG


(?) New hard drive

From Rodrigues, Joseph

Answered By Thomas Adam, Ben Okopnik, John Karns, Anita Lewis

Hello answer gang,

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.

(!) [Thomas] Right...

(?) The Bios sees the new drive, Linux sees the new drive as /dev/hdc, 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.

(!) [John] Hmm, this seems odd. It would seem that if the BIOS sees it, then the Linux kernel should too.
(!) [Thomas] OK -- I think I see what you're saying, yet your terminology is completely out :) Linux does not use the concept of "drivers" -- there are no drivers to run hardware from. The "/dev/" directory lists all the devices you'll need, and it is the kernel that interfaces with them.
(!) [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.

(?) To answer your question first. This is what I get from the kernel

hdc: bad special flag:0x03
hdc: driver not present
(!) [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 :)

(?) I know how to partition, create the file system, unfortunately I don't know how to install the driver.

(!) [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 :) ). Furthermore, I always like to try and expand on answers so that it makes for good General Readership (tm), rather than answering you specifically.
(!) [Anita] /dev/hdc is likely the right device, since you said you have it on the 2nd IDE and I assume as master.
First step is to partition it. Does 'fdisk /dev/hdc' 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.
After you have a partition, you can run mkfs on it --

(!) [Thomas] To create a filesystem (ext2), issue the following command.... (as root):

mke2fs -c /dev/hdc1

(I have used the "-c" switch here to scan the drive for badblocks -- since this is a new drive, this is a good idea).

(?) I looked in the /dev directory and I do see a /hdc 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.

(!) [Thomas] Yes, /dev/hdc is listed, and yes, the kernel does detect it.
(!) [John] /dev has pre-existing entries for all commonly used devices. The distro (SuSE 7.1) on this laptop has hda through hdl. That doesn't indicate that I have 12 ide devices connected.
(!) [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), ...
(!) [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.
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.
(!) [Ben] ...or a piece of buttered toast plugged into the slot. :)
(!) [John] I believe this may be the case here.
(!) [Ben] Oh - so it is a piece of buttered toast? Right on! I didn't think my ESP was working that well, but if you insist... :)
(!) [Thomas] With a bit of ginger marmalade, yum.
(!) [Heather] Alrighty then :D 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.
(!) [Thomas] :-) Indeed, but sometimes, Ben unless we are told otherwise certain "stock" assumptions have to be made :)
(!) [Thomas] The reason why you cannot access it is because it has not been formatted yet in a manner that the kernel can understand.
(!) [Ben] This, however, is highly probable.
(!) [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.
(!) [Ben] I meant "access" as in "read/write files, etc."; I'm pretty certain Thomas did as well.
(!) [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.
(!) [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.
(!) [Thomas] SeaGate drives were also notorious for falling on their backs with their legs twitching after about a year or so.....
(back to the querent) What exactly do you have planned for this new drive, once it has been formatted? I strongly suggest (no -- I am TELLING you) :) to read the following...:
http://linuxgazette.com/issue83/okopnik.html
(!) [Ben] <grin> Thanks, Thomas. My own advertising service, how cool!
(!) [Thomas] Now -- that said, and you have your drive formatted, you'll now want an entry for it in /etc/fstab so that it can be mounted, so....
mkdir /some_new_mount_point
(change the above as necessary -- that'll ensure a mount point for the new drive. Some people like to have their devices mounted under "/mnt" - it is up to you).
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 < 2.4.xx. If you're running a kernel version >=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....
tune2fs -j /dev/hdc1
to create the journal. If you know you're not using ext3 then skip that.
So...now edit /etc/fstab, and add an entry similar to this....
/dev/hdc /mp ext2 defaults 1 1
You'll have to change the above as necessary (and make sure that you change ext2 -> ext3 or vise-versa). Then when that is done, save the file.
now issue the command....
mount -a
(!) [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:
The fifth field, (fs_freq), is used for these filesystems by the dump( 8) 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.
The sixth field, (fs_passno), is used by the fsck( 8) 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.
So, "fs_passno" will depend on exactly what this partition is. Not a huge thing, but it should be done right.
(!) [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.

(?) System information:


Suse 8.1
HDs both are WD just different models

(?) Any help would be appreciated.


(?) 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.

I installed linux on it, and copied my current home partition from /dev/hda to /dev/hdc. (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).

I went back to booting from /dev/hda 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.

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.

I am hopeful that this may be the cause of the problem.

Thanks for all your help.

Joe.



Copyright © 2003
Copying license http://www.linuxgazette.com/copying.html
Published in Issue 92 of Linux Gazette, July 2003
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/


[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4 [ Index of Past Answers ]