0

we notice about this problem in last few days on one redhat machine ( version 7.2 )

we notice that order of the disks isn't according to the right order

note - sda is the OS

instead to get the order from small to end as the following :

/dev/sdb
/dev/sdc
/dev/sdd
.
.

we get the following order

/dev/sdd   
/dev/sdc   
/dev/sdb  
.
.

example from fdisk command

# fdisk -l | grep sd
Disk /dev/sda: 161.1 GB, 161061273600 bytes, 314572800 sectors
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   314572799   156773376   8e  Linux LVM
Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sde: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sdf: 2147 MB, 2147483648 bytes, 4194304 sectors

example from sfdisk command command

#  sfdisk -s
/dev/sda: 157286400
/dev/sdd:   2097152
/dev/sdc:   2097152
/dev/sdb:   2097152
/dev/sde:   2097152
/dev/sdf:   2097152
/dev/mapper/vg00-lv_root:  20496384
/dev/mapper/vg00-lv_swap:  16351232
/dev/mapper/vg00-lv_var: 104857600
 total: 309477376 blocks

but from lsblk we see the right order

#  lsblk
NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
fd0                2:0    1     4K  0 disk
sda                8:0    0   150G  0 disk
├─sda1             8:1    0   500M  0 part /boot
└─sda2             8:2    0 149.5G  0 part
├─vg00-lv_root 253:0    0  19.6G  0 lvm  /
├─vg00-lv_swap 253:1    0  15.6G  0 lvm  [SWAP]
└─vg00-lv_var  253:2    0   100G  0 lvm  /var
sdb                8:16   0     2G  0 disk
sdc                8:32   0     2G  0 disk
sdd                8:48   0     2G  0 disk /db_info
sde                8:64   0     2G  0 disk
sdf                8:80   0     2G  0 disk
sr0               11:0    1  1024M  0 rom

so please advice why we get different order disks from sfdisk and fdisk ? but from lsblk we get the right order

this issue is very important to us because we have scripts that take the input from the commands sfdisk / fdisk , and if scripts get the disks with wrong order then scripts created the filesystem with the wrong disks

shalom
  • 461
  • 13
  • 29
  • 1
    The manual pages of both programs don't mention any particular order for the listings, therefore you should not assume that the output *has* an order. If the order is important for your scripts, then filter the output and sort yourself. – Sven Nov 13 '17 at 09:24
  • yes I except your note , but on all other machines we get the right order & only on specific this machine we get this very strange order , this cause me to suspects if other issues can be appears – shalom Nov 13 '17 at 09:37

0 Answers0