LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem with the block device (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-the-block-device-4175420178/)

shivanag 08-03-2012 08:45 AM

problem with the block device
 
Im using linux version linux-2.6.32

I created one block device using mknod command

mknod /dev/mtdblock10 b 31 10

It is showing in the list

ls -lrt /dev/mtdblock*
brw-rw-rw- 1 root root 31, 7 Jul 25 06:06 /dev/mtdblock7
brw-rw-rw- 1 root root 31, 6 Jul 25 06:06 /dev/mtdblock6
brw-rw-rw- 1 root root 31, 5 Jul 25 06:06 /dev/mtdblock5
brw-rw-rw- 1 root root 31, 4 Jul 25 06:06 /dev/mtdblock4
brw-rw-rw- 1 root root 31, 3 Jul 25 06:06 /dev/mtdblock3
brw-rw-rw- 1 root root 31, 2 Jul 25 06:06 /dev/mtdblock2
brw-rw-rw- 1 root root 31, 1 Jul 25 06:06 /dev/mtdblock1
brw-rw-rw- 1 root root 31, 0 Jul 25 06:06 /dev/mtdblock0
brw-rw-rw- 1 root root 31, 8 Aug 3 06:50 /dev/mtdblock8
brw-rw-rw- 1 root root 31, 10 Aug 3 12:52 /dev/mtdblock10

cp /tmp/example /dev/mtdblock10
cp: unable to open `/dev/mtdblock10': No such device or address


help me in this regard

Thanks in advance

MensaWater 08-03-2012 09:42 AM

When you create device file specifying major/minor you're telling the system to use a physical device referenced by that major/minor. That device has actually exist. That is to say for example even though you might have entries for /dev/sda and /dev/sdb for your first two hard drives and can figure out what /dev/sdc should be then mknod for it you still wouldn't be able to use /dev/sdc unless there was actually a 3rd hard drive at the major/minor you specified. (In fact Linux creates multiple /dev/sd devices at install even though your system may only contain 1 hard drive.)

Also since device files are references to physical devices what you can do with them is heavily dependent on the device being referenced. That is to say cp from a file to say /dev/pts/10 because the device is a pseudo terminal not a directory.

I don't know what mdtblock is supposed to reference but the principles would be the same. You'd need to know there was an actual device to be referenced at the major/minor you had specified and know whether cp was a relevant command for such a device.


All times are GMT -5. The time now is 06:49 AM.