LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /dev/* ...what are they? (https://www.linuxquestions.org/questions/linux-newbie-8/dev-%2A-what-are-they-226270/)

Sinope 09-03-2004 03:04 PM

/dev/* ...what are they?
 
I'm slowly learning the ropes on Linux... I got a book called the Linux Pocket Guide by Daniel J. Barrett, which has been very helpful.

However, there is still one aspect I am totally clueless on: devices.

For instance, when I insert a floppy, I have to su -c "mount /dev/hd0 /mnt/floppy". Okay, that's no problem-- a bit annoying, but no big deal. I can do the same thing with smbfs shares on my parents' computers.

I have two CD drives. Here's where I get confused. When I know which one I want to mount, I use /dev/hdc or /deb/hdd. Works fine. Only, there is also this mysterious /dev/cdrom. When I mount it, I'm never sure what I'm going to get. Plus, there is a /dev/dvd.... is this just a copy of /dev/hdd? And what is the "dvd:/" that Xine wants but can never find? How do I get access to an audio CD?


Basically, I want to know what, exactly, the /dev/* files are, and how to work with them. Can anybody recommend any resources?

Thanks!


--S

btmiller 09-03-2004 03:11 PM

/dev files are device files. They're a static (or dynamic in newer systems) set of files that correspond to hardware on your system. There are two types of device files, block devices (disk drives and other sorts of storage mostly) and character devices (everything else, e.g. terminals and the null device). One of the fundamental abstractions of Unix is "everything's a file". In moust systems /dev/cdrom and /dev/dvd are symlinks to the appropriate /dev/hd* file or /dev/sd* (if you're using SCSI).

The files themselves have special meaning to the kernel. Each device has a major and minor number (you can see them with ls -l). When you open a device file, the major and minor number trigger magic in the kernel that invokes the appropriate driver to transmit commands to the device.

greasycreek 09-03-2004 05:15 PM

Re: /dev/* ...what are they?
 
Quote:

For instance, when I insert a floppy, I have to su -c "mount /dev/hd0 /mnt/floppy". Okay, that's no problem-- a bit annoying, but no big deal. I can do the same thing with smbfs shares on my parents' computers.
look into the /etc/fstab file to take care of your mount points.

see http://shilo.is-a-geek.com/slack/fstab12.html
it helped me out.

Sinope 09-03-2004 07:45 PM

BT: the hint about those numbers was very helpful... thanks!

Shilo: your site is great! Thanks a bunch! Like whoa! I totally bookmarked it.

--S

irlandes 09-04-2004 08:46 PM

mknod
 
I think the command to make devices is mknod, see man mknod from any terminal. You need those major and minor device numbers to make one. This is not something that is commonly needed by noobs, but nice to know as a curiosity item.


All times are GMT -5. The time now is 07:31 PM.