如何按磁盘上的顺序打印分区列表(Manjaro linux)

如何按磁盘上的顺序打印分区列表(Manjaro linux)

Sda 的分区方式如下:

在此处输入图片描述

注意具体顺序:sda11 > sda6 > sda7 > sda9 > ...

想要按照相同的顺序打印分区的信息并将其存储在文本文件中。

我尝试过的-

gdisk -l /dev/sda

[manjaro@manjaro-10ahs0wn00 ~]$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 500118192 sectors, 238.5 GiB
Model: Lexar 256GB SSD 
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): F07CA5E4-85FA-F247-855D-4DB101931C1C
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 500118158
Partitions will be aligned on 1-sector boundaries
Total free space is 135154 sectors (66.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1        19255304       500118143   229.3 GiB   8300  STATE
   2         2117638         2183173   32.0 MiB    7F00  KERN-A
   3        10866696        19255303   4.0 GiB     7F01  ROOT-A
   4         2183174         2248709   32.0 MiB    7F00  KERN-B
   5         2478088        10866695   4.0 GiB     7F01  ROOT-B
   6           16448           16448   512 bytes   7F00  KERN-C
   7           16456         2113607   1024.0 MiB  7F01  ROOT-C
   8         2248712         2281479   16.0 MiB    8300  OEM
   9         2113608         2113608   512 bytes   7F02  reserved
  10         2113609         2113609   512 bytes   7F02  reserved
  11              64           16447   8.0 MiB     FFFF  RWFW
  12         2412552         2478087   32.0 MiB    EF00  EFI-SYSTEM

fdisk -l /dev/sda

[manjaro@manjaro-10ahs0wn00 ~]$ sudo fdisk -l /dev/sda
[sudo] password for manjaro: 
Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Lexar 256GB SSD 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F07CA5E4-85FA-F247-855D-4DB101931C1C

Device        Start       End   Sectors   Size Type
/dev/sda1  19255304 500118143 480862840 229.3G Linux filesystem
/dev/sda2   2117638   2183173     65536    32M ChromeOS kernel
/dev/sda3  10866696  19255303   8388608     4G ChromeOS root fs
/dev/sda4   2183174   2248709     65536    32M ChromeOS kernel
/dev/sda5   2478088  10866695   8388608     4G ChromeOS root fs
/dev/sda6     16448     16448         1   512B ChromeOS kernel
/dev/sda7     16456   2113607   2097152     1G ChromeOS root fs
/dev/sda8   2248712   2281479     32768    16M Linux filesystem
/dev/sda9   2113608   2113608         1   512B ChromeOS reserved
/dev/sda10  2113609   2113609         1   512B ChromeOS reserved
/dev/sda11       64     16447     16384     8M unknown
/dev/sda12  2412552   2478087     65536    32M EFI System

Partition table entries are not in disk order.

sfdisk -d /dev/sda

[manjaro@manjaro-10ahs0wn00 ~]$ sudo sfdisk -d /dev/sda
[sudo] password for manjaro: 
label: gpt
label-id: F07CA5E4-85FA-F247-855D-4DB101931C1C
device: /dev/sda
unit: sectors
first-lba: 34
last-lba: 500118158
sector-size: 512

/dev/sda1 : start=    19255304, size=   480862840, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=0D2E3A01-7890-074A-9801-9407ED8D90E3, name="STATE"
/dev/sda2 : start=     2117638, size=       65536, type=FE3A2A5D-4F32-41A7-B725-ACCC3285A309, uuid=417541BD-8D79-A34C-AE63-CB8B79BE3D03, name="KERN-A", attrs="GUID:48,49,50,51,52,53,54,55"
/dev/sda3 : start=    10866696, size=     8388608, type=3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC, uuid=C9D9828E-5FC8-9A42-A6A0-6E64FF8F3383, name="ROOT-A"
/dev/sda4 : start=     2183174, size=       65536, type=FE3A2A5D-4F32-41A7-B725-ACCC3285A309, uuid=3E6C72E3-744D-1B40-825D-570F4D1CB0DF, name="KERN-B", attrs="GUID:52,53,54,55"
/dev/sda5 : start=     2478088, size=     8388608, type=3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC, uuid=4393B767-9292-3E4F-BC6A-FFCB3BB76B4C, name="ROOT-B"
/dev/sda6 : start=       16448, size=           1, type=FE3A2A5D-4F32-41A7-B725-ACCC3285A309, uuid=A2E8DF92-A885-D64A-9DCE-109DFD3A912D, name="KERN-C", attrs="GUID:52,53,54,55"
/dev/sda7 : start=       16456, size=     2097152, type=3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC, uuid=105C4E07-0CD3-9A4D-8C31-E3D75A0B80AF, name="ROOT-C"
/dev/sda8 : start=     2248712, size=       32768, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=D80BFCAD-4771-6C48-9DBB-0ADFBE10DBF1, name="OEM"
/dev/sda9 : start=     2113608, size=           1, type=2E0A753D-9E48-43B0-8337-B15192CB1B5E, uuid=6D272F77-489E-E94A-B903-59BFD612F648, name="reserved"
/dev/sda10 : start=     2113609, size=           1, type=2E0A753D-9E48-43B0-8337-B15192CB1B5E, uuid=E0C92DB9-1C4D-9B4C-92C6-D002B685E39C, name="reserved"
/dev/sda11 : start=          64, size=       16384, type=CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3, uuid=E9016D9E-426D-434E-ABA0-614273D7BA5A, name="RWFW"
/dev/sda12 : start=     2412552, size=       65536, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=EE625F5C-40D7-614D-80A3-0C4DA423711B, name="EFI-SYSTEM"

sfdisk /dev/sda

[manjaro@manjaro-10ahs0wn00 ~]$ sudo sfdisk /dev/sda

Welcome to sfdisk (util-linux 2.36).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Checking that no-one is using this disk right now ... OK

Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Lexar 256GB SSD 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F07CA5E4-85FA-F247-855D-4DB101931C1C

Old situation:

Device        Start       End   Sectors   Size Type
/dev/sda1  19255304 500118143 480862840 229.3G Linux filesystem
/dev/sda2   2117638   2183173     65536    32M ChromeOS kernel
/dev/sda3  10866696  19255303   8388608     4G ChromeOS root fs
/dev/sda4   2183174   2248709     65536    32M ChromeOS kernel
/dev/sda5   2478088  10866695   8388608     4G ChromeOS root fs
/dev/sda6     16448     16448         1   512B ChromeOS kernel
/dev/sda7     16456   2113607   2097152     1G ChromeOS root fs
/dev/sda8   2248712   2281479     32768    16M Linux filesystem
/dev/sda9   2113608   2113608         1   512B ChromeOS reserved
/dev/sda10  2113609   2113609         1   512B ChromeOS reserved
/dev/sda11       64     16447     16384     8M unknown
/dev/sda12  2412552   2478087     65536    32M EFI System

Partition table entries are not in disk order.

Type 'help' to get more information.

>>> ^C

sfdisk -l /dev/sda

[manjaro@manjaro-10ahs0wn00 ~]$ sudo sfdisk -l /dev/sda
[sudo] password for manjaro: 
Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Lexar 256GB SSD 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F07CA5E4-85FA-F247-855D-4DB101931C1C

Device        Start       End   Sectors   Size Type
/dev/sda1  19255304 500118143 480862840 229.3G Linux filesystem
/dev/sda2   2117638   2183173     65536    32M ChromeOS kernel
/dev/sda3  10866696  19255303   8388608     4G ChromeOS root fs
/dev/sda4   2183174   2248709     65536    32M ChromeOS kernel
/dev/sda5   2478088  10866695   8388608     4G ChromeOS root fs
/dev/sda6     16448     16448         1   512B ChromeOS kernel
/dev/sda7     16456   2113607   2097152     1G ChromeOS root fs
/dev/sda8   2248712   2281479     32768    16M Linux filesystem
/dev/sda9   2113608   2113608         1   512B ChromeOS reserved
/dev/sda10  2113609   2113609         1   512B ChromeOS reserved
/dev/sda11       64     16447     16384     8M unknown
/dev/sda12  2412552   2478087     65536    32M EFI System

Partition table entries are not in disk order.

从输出中可以清楚地看出,我尝试过的所有命令都按顺序排列分区编号,而不是显示分区的实际顺序,即 11>6>7>9>...

使用 Manjaro Linux

我的问题是如何按相同的顺序打印分区?

答案1

相关内容