If you are transitioning from other operating system environments to Linux, the first puzzle you are most likely to face is understanding the Linux file system. To be more specific, you have to understand how Linux labels its hard disk drives (whether internal or external).
On a Windows operating system, this step is straightforward as all the disk drives connected to the operating system environment are identified by relatable labels like C:
, D:
, F:
etc. In most cases, it is the disk drive labeled C:
that hosts the installed copy of the Windows operating system.
Understanding Linux Files
A Linux operating system perceives each and every device-based connection linked to its OS environment as a file. Therefore, Directory Files, Ordinary Files, and Device Files are all categorized as file types.
- General/Ordinary Files – These are the document files that primarily contain data.
- Directory Files – These are files that contain both Ordinary files and Directories which are defined to host some Ordinary files if need be.
- Device Files – These files are a representation of hardware devices as device files on the system.
What is /dev in Linux
Before we get to /dev/sda
; which is the primary objective of this article, we must go through /dev
. We have already stated that the Linux operating system perceives hardware devices connected to it as device files.
The hierarchy of the Linux operating system begins from the root file (/)
.
$ cd /
It is the starting point of understanding the Linux operating system architecture. From the above screen capture, we have listed the content under this root (/)
file directory. From this view and based on this article guide’s objective, we are more interested in what the directory dev has to offer.
/dev
can be fully translated as root device since we are moving from the root (/)
directory to this directory file within it. Viewing the content of this dev directory should reveal/list device files that translate to hardware components connected to our computer.
$ cd dev
As you can see, there is more than enough information to chew inside this directory listing. We are however more interested in what the highlighted sda device file has to offer.
What is /dev/sda in Linux
From /dev/sda
, the sd portion of sda can be translated to SCSI (Small Computer System Interface) disk.
Therefore, sda in full can be translated as the first SCSI hard disk. Under the /dev
directory; from the screenshot above, we can note the device files sda, sda1, sda2, and sda5. The device files sda1, sda2, and sda5 exist as partitions of the first SCSI hard disk sda.
We can now fully refer to this device file as the root device’s first SCSI hard disk. To view some basic information about this device file, we can run the following fdisk command as a sudoer/root user.
$ sudo fdisk -l
On my end, /dev/sda
is partitioned into three device files. /dev/sda1
is the boot partition that makes the Linux OS easily restart, /dev/sda2
is the extended partition primarily used for user files storage, and /dev/sda5
is the Linux partition where your Linux OS installed files reside.
The concept of /dev/sda
is now at our fingertips.