What is dev sda in linux

Understanding the Role of /dev/sda in Linux

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.

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.

Читайте также:  Linux setting stack size

Listing the

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*

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

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/ ” 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.

Источник

What does /dev/sda in Linux mean?

stand for? What does it mean? I have both Fedora and Ubuntu installed and if I explore them using Ext2explore from Windows, I see these names:

3 Answers 3

TL;DR: It has to do with the way Linux (and other Unixes as well) name their drives, much in the way that Windows uses C:, D:, etc. (NOTE: This is what we call a metaphor. In other words, a blatant lie that helps people understand without being even remotely accurate. Read on for a more detailed explanation. )

  • /dev/ is the part in the Unix directory tree that contains all «device» files — Unix traditionally treats just about everything you can access as a file to read from or write to.
  • sd originally identified a SCSI device, but since the proliferation of USB (and other removable) data carriers, it became a catch-all for any block device (another Unix term; in this context, anything capable of carrying data) that wasn’t already accessible via IDE. When SATA came around, the developers figured it’d be much easier and much more convenient for everyone to add it into the existing framework rather than write a whole new framework.
  • The letter immediately after sd signifies the order in which it was first found — a,b,c. z, Aa. Az. etc. (Not that there are many situations in the real world where more than 26 discrete block devices are on the same bus. )
  • Finally, the number after that signifies the partition on the device. Note that because of the rather haphazard way PCs handle partitioning, there are only four «primary» partitions, so the numbering will be slightly off from the actual count. This isn’t a terrible problem as the main purpose for the naming scheme is to have a unique and recognizable identifier for each partition found in this manner.
Читайте также:  Перезапуск samba linux mint

To answer your specific question: /dev/sda9 means the ninth partition on the first drive.

A metaphor is usually related in some sort of tangential way that is more closely related to the addressee’s experience than the concept or thing one wishes to explain. So one might explain the workings of a processor in terms of tractors and muddy boots to a farmer, for example. The hope is the addressee will be able to utilise the symbolic link(s) in order to mentally construct a working model of whatever the addresser is describing, without first-hand knowledge. So it’s only really a lie in the same way a block-chain is a lie about a pass-phrase. In fact, a blockchain is a sort of metaphor.

/dev is your filesystem representation of devices your system understands — providing a mechanism for applications to access data on the device without needing to know specifically what the device is.

sd is for (originally) scsi disk devices, however it seems to now refer to removable devices in general and SATA devices

and the letter is just the number of the device, starting at a, with the number indicating the partition.

sd originates from the driver sd-mod . It literally stands for scsi disk.

The reason (S)ATA disks are also listed as SCSI disks is, SCSI commands pretty much provides a superset of features that can be provided by ATA commands, therefore modern systems (including Windows, AFAIK) will have an implementation of SCSI-ATA Translation Layer (SATL) in the system (in Linux it is provided by the libata driver) to talk to the (S)ATA disks, while the upper layer of the system can be generalized.

As you may not aware of, USB drives «speaks» SCSI (i.e. takes and responds to SCSI commands), no matter if it supports the USB Attached SCSI Protocol or not. Also, most of the USB HDDs/SSDs are SATA disks bridged to USB. For those the bridge provides the SATL, but not the operating system.

Читайте также:  Linux mint узнать имя компьютера

Источник

What is /dev/sda in Linux File System?

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 (/) .

Linux File System

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.

List Linux Dev Files

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.

List Linux Partitions

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.

Источник

Оцените статью
Adblock
detector