Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check the device names of each partition under Linux and grub

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to view the device names of each partition under Linux and grub. The introduction in this article is very detailed and has a certain reference value. Interested friends must finish reading it!

On the naming of Partition Devices under linux

Sda (/ dev/sda) refers to the first hard disk itself (SATA hard disk is represented by sda, while IDE hard disk is represented by hda)

Sda1 represents the first primary partition of the first hard disk (the extended partition is treated here as the primary partition)

Sda2 represents the first hard disk and the second primary partition.

Sda3 represents the first hard disk and the third primary partition.

Sda4 represents the fourth primary partition of the first hard disk.

Sda5 represents the first logical partition of the first hard disk

Sda6 represents the first hard disk and the second logical partition.

And so on and so on. . (if the second hard drive is represented as sdb\ hdb)

As sda, hda and other names are linux notation, so if you want to view, linux can be used under the command to view: sudo fdisk-l, there are many ways to view partition devices in linux, a lot of search, so I will not explain.

About the naming of grub partition devices

In addition, the first hard drive of the system is expressed as (hd0), and the first partition on it is represented as (hd0,0), that is to say, for the hard disk, x and y are all counted from 0, x represents the hard disk number, and y represents the partition number. Since there can only be four primary partitions, the four primary partitions of the first hard disk are represented by (hd0,0) ~ (hd0,3) respectively; the logical partition is calculated from (hd0,4), that is, the first logical partition is represented by (hd0,4), the second logical partition is represented by (hd0,5), and so on. In general, the hard disk of the machine is a primary partition, and the rest is a logical partition. So disk C is represented by (hd0,0) and disk D by (hd0,4). The optical disc is represented by (cd) and the first soft drive is represented by (fd0).

For example, my hard drive has two primary partitions and the rest are logical partitions. It is represented by (hdx,y) as shown in the following figure:

If you are still not sure about the grub partition representation corresponding to your hard disk partition, you can use the ls command under grub to check the files under the partition to determine:

Ls lists all current devices. Such as (hd0,0), (hd0,1), (hd0,5), (hd0,6), etc.

Ls-l details all current devices. For partitions, their label and uuid are displayed.

Ls (hd0,1) / list (hd0,1) all files in the root directory of the partition.

So if you're not sure, use ls to list all the current devices and use the ls (hd0,X) / command to determine one by one. (X needs to be changed according to the partition)

The above is all the contents of the article "how to check the device names of each partition under Linux and grub". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 265

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report