Contact us

Print

Creating devices

Devices are usually located in the “/dev” directory, but they can also be created anywhere on the file system. You will be using the “mknod” command and the “MAKEDEV” script.
The syntax for the mknod command is:

Usage: mknod OPTION... NAME TYPE MAJOR MINOR

To create a new CDROM device

1. Create a new directory called mydevices in root’s home directory “/root/mydevices”.

root@localhost root# mkdir mydevices

2.Change directory to “mydevices” directory

3. First find out the major and minor number for your current CDROM drive. It is
attached to the file /dev/cdrom.

root@localhost root# file /dev/cdrom

/dev/cdrom: symbolic link to /dev/hdc

The above output shows the CDROM drive is actually attached to the file /dev/hdc.

4. Find out the device type, major and minor numbers for the “/dev/hdc/” file. What are they?



5. Create a new CDROM device file called “mycdrom” using the major and minor
numbers your found out from above. Type:

root@localhost mydevices# mknod -m 0600 mycdrom b 22 0

6. Find out the file type for the device you have just created: Type:

root@localhost mydevices# file mycdrom

mycdrom: block special (22/0)

You have created a CDROM type of device.

7. Using the “ls –l “ command, list the permissions on the device you just created. List
the output here:



Created by: system. Last Modification: Tuesday 25 of November, 2008 17:37:26 EST by admin.

...