Skip to contentSkip to conversation

Mention fdisk -l order on man page

DISCUSSION Dan Jacobson 2 participants 2 messages Mar 7, 2021 – Mar 8, 2021 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Regarding fdisk -l,
the partitions are sorted

# fdisk -l|grep -P /dev/\\S+\\d|sed 's/ .*//'
/dev/sda1
/dev/sda2
/dev/sda3
/dev/sda4
/dev/sda5
/dev/sda6
/dev/sda7
/dev/sda8

So why can't the disks also be sorted:

# fdisk -l|grep Disk\ /
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk /dev/sdb: 14.91 GiB, 16008609792 bytes, 31266816 sectors
Disk /dev/sdd: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk /dev/sdc: 14.46 GiB, 15525216256 bytes, 30322688 sectors
Disk /dev/sdg: 3.8 GiB, 4075290624 bytes, 7959552 sectors
Disk /dev/sdj: 28.84 GiB, 30963400704 bytes, 60475392 sectors
Disk /dev/sdk: 29.72 GiB, 31914983424 bytes, 62333952 sectors
# fdisk -l|grep Disk\ /|sort -c
sort: -:4: disorder: Disk /dev/sdc: 14.46 GiB, 15525216256 bytes, 30322688 sectors

Sure we can do

# fdisk -l /dev/sd?|grep Disk\ /
fdisk: cannot open /dev/sde: No medium found
fdisk: cannot open /dev/sdf: No medium found
fdisk: cannot open /dev/sdh: No medium found
fdisk: cannot open /dev/sdi: No medium found
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk /dev/sdb: 14.91 GiB, 16008609792 bytes, 31266816 sectors
Disk /dev/sdc: 14.46 GiB, 15525216256 bytes, 30322688 sectors
Disk /dev/sdd: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk /dev/sdg: 3.8 GiB, 4075290624 bytes, 7959552 sectors
Disk /dev/sdj: 28.84 GiB, 30963400704 bytes, 60475392 sectors
Disk /dev/sdk: 29.72 GiB, 31914983424 bytes, 62333952 sectors

But as you see, there is some noise often.

OK, maybe it is just reading in physical disk/partition/device order always. OK, mention that on the man page.

maintainer
#1 lore raw
Quoted 2 lines · Dan Jacobson

OK, maybe it is just reading in physical disk/partition/device order always. OK, mention that on the man page.

It's in order how kernel listens it in /proc/partitionts. I have info about it to the man page.

Thanks for your report.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com