LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices



Reply
 
Search this Thread
Old 10-15-2004, 04:18 AM   #1
fasta
Member
 
Registered: Aug 2003
Location: Livorno - Italy
Distribution: Debian
Posts: 84

Rep: Reputation: 15
HD / mknod issue


I mistakenly deleted my /dev/hdd symbolic link. Obviously the result is I can't access my HDD (ide 1:1) IDE 40gb HardDisk.
Found out that mknod can solve my problem. I succeeded in creating the block device with the correct permissions, but just have real hard time figuring out what the MAJOR and MINOR parameters should correspond to.
Anyone?

Thank you
 
Old 10-15-2004, 04:41 AM   #2
fasta
Member
 
Registered: Aug 2003
Location: Livorno - Italy
Distribution: Debian
Posts: 84

Original Poster
Rep: Reputation: 15
I was diggin' into /proc/ide/hdd and found some files, "settings" is one of these.
Here's the content:
Code:
[root@argo-linux][10:42]/proc/ide/hda $ more settings
name        value               min             max             mode
----        -----               ---             ---             ----
acoustic                0               0               254             rw
address                 0               0               2               rw
bios_cyl                65535           0               65535           rw
bios_head               16              0               255             rw
bios_sect               63              0               63              rw
bswap                   0               0               1               r
current_speed           69              0               70              rw
failures                0               0               65535           rw
init_speed              12              0               70              rw
io_32bit                1               0               3               rw
keepsettings            0               0               1               rw
lun                     0               0               7               rw
max_failures            1               0               65535           rw
multcount               16              0               16              rw
nice1                   1               0               1               rw
nowerr                  0               0               1               rw
number                  0               0               3               rw
pio_mode                write-only      0               255             w
unmaskirq               1               0               1               rw
using_dma               1               0               1               rw
wcache                  1               0               1               rw
Any good hint for my mknod MAJOR & MINOR values? Maybe the "address" parameter is what I am looking for?
 
Old 10-15-2004, 10:54 AM   #3
fasta
Member
 
Registered: Aug 2003
Location: Livorno - Italy
Distribution: Debian
Posts: 84

Original Poster
Rep: Reputation: 15
Talking SOLVED IT!

I found the solution and (as a good open source philosophy follower) here I publish my solution:

the solution was quit simple, as it was written clearly in the file "devices.txt" under /usr/src/linux-X.Y.Z/Documentation/ .
In this file you got all the possible combos of devices that can be eventually soft-linked into the devfs (/dev).

The simple IDE bus devices are listed as follows:
BUS 0 (block devices)

3 block First MFM, RLL and IDE hard disk/CD-ROM interface
0 = /dev/hda Master: whole disk (or CD-ROM)
64 = /dev/hdb Slave: whole disk (or CD-ROM)


so, to build up (for ex.) a softlink to /dev/hda mknod should look like this:

(
Code:
 mknod [OPTION]... NAME TYPE [MAJOR MINOR]
)

e.g.

Code:
mknod hda b 3 0
Then chgrp it to "disks" and set the perms to 660

same thing, but with different params for devices on BUS 1 wich have 22 as MAJOR and 0 (master) and 64 (slave) as MINOR

22 block Second IDE hard disk/CD-ROM interface
0 = /dev/hdc Master: whole disk (or CD-ROM)
64 = /dev/hdd Slave: whole disk (or CD-ROM)

Result:
Code:
mknod hdd b 22 64
will bring my /dev/hdd back to life...

hope it'll help someone!

Cheers

Last edited by fasta; 10-15-2004 at 10:56 AM.
 
Old 10-16-2004, 06:08 AM   #4
melazyboy
LQ Newbie
 
Registered: Feb 2004
Posts: 5

Rep: Reputation: 0
Re: SOLVED IT!

sry about timing just browing and i saw this to answer.. these instructions are for the most part wronqg -- sry, in factI would completly ignore all of that. Instead when using mknod, get your minor and major blocks from /proc/partitions; ie cat /proc/partitions; becides there are major inconsistancies in yoru scheme, you fail to take into account that not every ide device is plugged into your primary or secondary onboard slots; expcansion cards skew these number quite a bit.

cat /proc/paritions yeilds WITH 2.6x kernel
major/minor/#blocks/name

an example is
3 0 80043264 hda

mknod b 3 0 hda
 
Old 10-18-2004, 03:56 AM   #5
fasta
Member
 
Registered: Aug 2003
Location: Livorno - Italy
Distribution: Debian
Posts: 84

Original Poster
Rep: Reputation: 15
Hi melazyboy!
I don't actually think the instructions I gave are wrong as you say... maybe they're explained like hell and uncomprehensible, that I agree , but not wrong...
I agree that you can find infos on /proc/partitions, but think about this: i accidentally (damn me) lost /dev/hdd link. That way are you sure that I could find the infos about the minor and major in the file /proc/partitions? I wouldn t be so sure. You maybe able to find the parameters regarding the hdd PARTITIONS, but not those about the whole hdd, since the link in the devfs was lost.
So, the file (/usr/src/linux-2.6.8/Documentation/devices.txt, in my case) I took the MINOR and MAJOR values from is a file that can be <u>always</u> found in the linux Documentation, i.e. mostly the best solution (to my knowledge, of course) since those values are set in the C header file wich handles the hardware devices.
Still, I think I will delete my block device /dev/hdd from the devfs and see if your solution could work, since looks very fast-n-easy.
On top of all, the solution I found worked for me. So I don't see how you can define it as "wrong"
Thanks for helping anyway.
 
Old 02-03-2005, 09:56 PM   #6
elfoozo
Member
 
Registered: Feb 2004
Location: MI
Distribution: debian unstable
Posts: 252

Rep: Reputation: 32
I was sooo hoping melazyboy's solution would work since I just installed a new disk and found out I don't have a block device defined in /dev so I'd have to create one.

localhost:/dev# cat /proc/partitions
major minor #blocks name

3 0 195360984 hda
3 1 77650146 hda1
3 2 1 hda2
3 5 497983 hda5
33 0 195360984 hde
33 1 195358401 hde1
34 0 195360984 hdg
34 1 195358401 hdg1
56 0 195360984 hdi
56 1 195358401 hdi1

localhost:/dev# ls /dev/hdi*
ls: /dev/hdi*: No such file or directory

localhost:/dev# mknod hdi b 56 0

localhost:/dev/# mknod hdi1 b 56 1

Success! Thank you!

Last edited by elfoozo; 02-03-2005 at 10:21 PM.
 
Old 08-07-2006, 05:14 PM   #7
mad4linux
Member
 
Registered: Aug 2003
Distribution: Debian Testing / kubuntu
Posts: 86

Rep: Reputation: 21
Thx melazyboy!

I just accidentaly deleted /dev/hdd insteasd of /dev/cdrecorder a misleading symlink after i've added a new dvdrom.
And you, fasta just helped me out! Works perfect. So people, as long as your cdrom drives are directly plugged to the mainboard, it works.
Thx man, that's good open source world, i'd say (as well as melazyboys answer). there's always a lot to learn, and it's nowhere as easy as in the linux community!

Last edited by mad4linux; 08-07-2006 at 05:16 PM.
 
Old 08-08-2006, 01:39 AM   #8
fasta
Member
 
Registered: Aug 2003
Location: Livorno - Italy
Distribution: Debian
Posts: 84

Original Poster
Rep: Reputation: 15
Happy to be helpful, as usual
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mknod Basel Linux From Scratch 1 09-03-2005 03:13 PM
mknod Infinite_Pizza Linux - Software 2 04-14-2005 09:59 PM
[c] mknod() function MD3 Programming 2 04-03-2005 11:14 AM
mknod or devfs? rose_bud4201 *BSD 5 05-07-2004 02:29 AM
mknod watashiwaotaku7 Linux - Software 1 01-23-2003 11:11 PM


All times are GMT -5. The time now is 04:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration