In Linux,

  1. For a hard disk, there is a device file such as /dev/sda or /dev/hda depending on the interface type of the hard disk.

    Does the existence of its device file mean that the driver for the hard disk is running?

    How can I find out what device driver it is?

  2. For a partition on a hard disk, there is a device file such as /dev/sda1 or /dev/hda1.

    Does the existence of its device file mean that the driver for the partition is running?

    How can I find out what device driver it is?

    Is the driver for a partition on a disk the same as the driver for the disk?

  3. For a file system on a partition on a hard disk, we can't access the file system until we mount it to some directory under /.

    Before mounting a file system, is the driver for the file sytem not running?

    A file system has a device driver for the file system type (e.g. Linux has some device driver for ntfs file systems), so is a file system considered as a device?

    What is the device file of a file system? Is the mount dir for a file system the device file for the file system?

  • for all your “does the existance…” questions, the answer is same as “does your system use udev”. What OS are you using? – ctrl-alt-delor Feb 8 '15 at 19:19
  • Ubuntu. How do I know if a linux OS uses udev? – Tim Feb 8 '15 at 19:29
  • What version of Ubuntu?, the latest defiantly does use udev. It is not Linux that uses udev, udev is a user-land tool. The system as a whole uses udev. – ctrl-alt-delor Feb 8 '15 at 19:33
  1. Yes, if there is disk device as /dev/sda this mean driver for this type of disk is loaded. You can check the exact driver by executing

    ls -l /dev/sda

    brw-rw---- 1 root disk 8, 0 Apr 8 2014 /dev/sda

And in this case you have major number = 8, so you can search in kernel source what is this driver

  1. There is no such thing as running partition. Also there is no driver for partition. Partition is part of storage device and access to it is via storage driver (see point 1).

    ls -l /dev/sda1

    brw-rw---- 1 root disk 8, 1 Apr 8 2014 /dev/sda1

  2. For filesystems the propper name is kernel module, not driver. Driver is related to devices. Even if your filesystem is not mounted the module can be loaded. It is independent. There is no device file for filesystem

  • There are drivers for partitions. They can't be configured as modules, so you'll never see them in lsmod, but you can see the compilation options CONFIG_xxx_PARTITION in the kernel configuration. On a PC you'll only ever see MSDOS and EFI but there's a whole world of other partition types out there. – Gilles 'SO- stop being evil' Feb 8 '15 at 23:18

In Linux the word "driver" is used as much as "kernel modules" that support certain hardware.

Kernel support is decided when the options are selected and the kernel is compiled from source and comes in two forms, static or as a dynamically loaded module. (Monolithic versus micro-kernel)

A static module is a fixed part of the kernel and the core functionality of that kernel and dynamic module can be loaded on-demand to extend the base functionality.

The name of block and character devices is unimportant, at least for the kernel. It is the major and minor number that instructs the kernel which module is to be used to access it. A range of major and minor number is assigned statically (check Documentation/devices.txt in the kernel source for a list), more modern kernel modules use dynamic major/minor numbers.

It is purely convention to call the first SCSI disk /dev/sda but is is the major and numbers that are used by the kernel to select the right module to access it.

ls -l /dev/sda 
brw-rw---- 1 root disk 8, 0 Apr 8 2014 /dev/sda 

For instance I can access that same disk by setting up a new device with the same magic numbers 8,0 with mknod

 mknod /dev/my-first-disk b 8 0

That brings us closer to the answer of your first question: does the presence of the device entry mean it is supported by your running kernel? No. With mknod you can create devices with any major and minor number and name, even ones which are not used/reserved for by any kernel module.

The nuance being that most people do not create their own devices but rely on udev to do so dynamically for them. Then the presence of device names is often an indication that certain hardware was identified correctly.

Currently loaded dynamic modules are displayed with lsmod but what static support is available requires knowing the compile time options used to build the kernel, often stored in a file called /boot/config-<kernel-version>. Static support is always available.

A file system is not a device but a translation layer from the bytes stored on device to usable data. A lot more here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.