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.