Purpose of /dev/sda on Linux (When to Use It with an Example)

Linux TLDR
Last Updated:
Reading time: 4 minutes

When a Windows user encounters a Linux system for the first time, their first thought is: where are the “C:/“, “D:/“, or “E:/” drives?

So, my innocent Linux newbies, you must know that Linux doesn’t have any concept of local disk like in Windows; here, each and everything represents a file.

Before you understand exactly what “/dev/sda” is (primary objective of this article), you must first know about what files are and the different types of files in Linux.

What are Files in Linux?

In Linux, each device, like a network adapter, mounted disk, partition, etc., is a file that usually lives somewhere in your “/” root directory (we will discuss them later).

Primarily, there are three types of files in Linux, followed by:

  • General/Ordinary Files: These are the simple files that contain the data.
  • Directory Files: These are the files that contain the ordinary files as well as the directory files.
  • Device Files: These are the device files that represent all the hardware devices connected to your system on boot.

The focus of this article is mostly on the device files, as the primary objective of this article is to explain what “/dev/sda” is.

Now, as you understand, each device is represented as a file in Linux, and these files usually reside in your “/” root directory. Let’s see

What is the “/” Root Directory in Linux?

In simple terms, the root directory is the top directory in your Linux filesystem hierarchy, where all the other files and directories (including “/bin“, “/home“, “/mnt“, or “/var“) reside.

Execute the following command to get a complete list of all files and directories inside your “/” root directory.

$ ls /

Output:

Listing the root directory

As you can see, all the files in your system are categorized and stored in different directories based on their relationship in your parent “/” root directory, for example:

  • The “/bin” directory contains the executable files.
  • The “/home” directory contains user related information.
  • The “/mnt” directory contains information related to mounted files and directories.
  • The “/var” directory is used to store the variable data files.

Similarly to this directory, the “/dev” directory also resides in your “/” root directory.

What is /dev in Linux

As we discussed earlier, there are three types of files in Linux; one of them are device files, which represent all the hardware devices connected to your system on boot.

The “/dev” directory contains all these files with their respective names like “fd“, “loop“, “tty“, “sda“, etc. Each of these files represents a single hardware component connected to your system.

Execute the following command to get a complete list of all device files in your “/dev” directory.

$ ls /dev

Output:

Listing the "/dev" directory

As you can see, there is more information to consume for now, so we will primarily focus on our main topic, which is “sda” files.

What is /dev/sda in Linux

In “/dev/sda“, the “sd” portion of “sda” refers to an SCSI (Small Computer System Interface) disk, which is nothing but a block device and resides in the “/dev” directory.

Before we go any further, let’s find out how many “/dev/sda” device files I have in my “/dev” directory by running the following command:

$ ls -l /dev/sda*

Output:

Listing the sda device files

Now, before I go further and explain more about this, let’s check out how many partitions I have in my Linux system by issuing the fdisk command.

$ sudo fdisk -l

Output:

Listing the partition in Linux

From the above picture, in the device columns, you can clearly see that in my system I have three partitions that represent “BIOS boot“, “EFI System“, and “Linux filesystem“.

So, let’s properly understand what exactly the “sda” is and what it’s referring to in my system.

Whenever you install your Linux operating system, at the time of partition creation, your Linux takes each disk and assigns a decimal number in alphabetical order depending on the number of the disk it found, naming it “sda1“, “sda2“, “sda3“, etc.

Now, each of these SDAs represents a SCSI disk drive (a.k.a. partition) in your system. For me,

  • The “/dev/sda1” represents the BIOS boot partition.
  • The “/dev/sda2” represents the EFI system.
  • The “/dev/sda3” represents the Linux filesystem (where the “/” root directory resides).

Now, don’t get caught up in the idea that you will also have the same number of SDAs in your system pointing towards the same SCSI disk drive; it all depends upon the number of partitions you have in your system.

Final Note to Window Users

Linux users are already familiar with the meaning of “sda“, but if you are a long-time Windows user who has recently transitioned to the Linux environment, you may not be. Then you still might have doubts about where exactly the local disks are that I will click to see my files.

So, for that, you (the Windows user) should note that the Windows filesystem is totally different from Linux; whereas in Linux you don’t have any local disk for each partition, here you have to store and access your files from your “/home/<USERNAME>” directory.

And the role of the “sda” is not to provide you with separation partitions (although they are files) like Windows; they are mostly used by the applications or your Linux system to find the separate partitions and utilize them based on their role.

So, that’s it for now. If you have any doubts or questions related to this topic, feel free to ask them in the comment section.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.