The interfaces of the devices are represented under these two directories.
For example, the interface belonging to the Olympus digital camera is represented by the directory /sys/block/sda/.
The directory sda is the digital camera accessed like a SCSI hard disk.
The following is the content of the sda/ directory:
DA3:~ # ls /sys/block/sda dev queue removable size device range sda1 stat
The subdirectory sda1/ represents the interface to the first partition on the camera's memory card.
For example, by reading the content of /sys/block/sda/sda1/size, you can determine the size of the partition; as shown below:
DA3:~ # cat /sys/block/sda/sda1/size 31959
The partition has a size of 31959 512-byte blocks, which is about 16 MB.
To connect an interface with a device, file system links are used. In the Olympus digital camera example, a link exists from the file /sys/block/sda/device to the corresponding device; as shown below:
DA3:~ # ll /sys/block/sda/device lrwxrwxrwx 1 root root 0 Aug 17 14:03 device ->
Was this article helpful?