Skip to contentSkip to conversation

does util-linux have a 'report sector size' util?

DISCUSSION L A Walsh 3 participants 7 messages Mar 11, 2019 – Mar 15, 2019 Util-Linux package

lore
Share & tools
lore

L A Walsh

author
#0 lore raw

Trying to track down why my 4K drives no longer display 4K in sysfs (/sys) and don't seem to show individual disk drive information. When I first got the drives, linux displayed the correct physical disk size, but when I look now, I only see 512.

I just checked with MegaCLI, and it can still display all the data (harddisk manuf. in each bah, and physical sector size).

So I'm wonder if util-linux has something in its blk library about this?

#1 lore raw
Quoted 7 lines · * L A Walsh ([email protected]) wrote:

Trying to track down why my 4K drives no longer display 4K in sysfs (/sys) and don't seem to show individual disk drive information. When I first got the drives, linux displayed the correct physical disk size, but when I look now, I only see 512.

Quoted 5 lines

I just checked with MegaCLI, and it can still display all the data (harddisk manuf. in each bah, and physical sector size).

So I'm wonder if util-linux has something in its blk library about this?

Is this one of the PHY-SEC or LOG-SEC fields that lsblk can print?

[dg@major ~]$ lsblk -o "NAME,PHY-SEC,LOG-SEC"
NAME PHY-SEC LOG-SEC
sda 512 512

Dave

Quoted 1 line
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
author
#2 lore raw
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 5 lines · * L A Walsh ([email protected]) wrote:

Trying to track down why my 4K drives no longer display 4K in sysfs (/sys) and don't seem to show individual disk drive information. When I first got the drives, linux displayed the correct physical disk size, but when I look now, I only see 512.

Quoted 5 lines

Is this one of the PHY-SEC or LOG-SEC fields that lsblk can print?

[dg@major ~]$ lsblk -o "NAME,PHY-SEC,LOG-SEC"
NAME PHY-SEC LOG-SEC
sda 512 512

---
It would be, if it was correct. Megacli displays:

Sector Size: 512
Logical Sector Size: 512
Physical Sector Size: 4096

But lsblk displays 512 for everything. The disk says it uses a 512e format with the 'e' meaning it emulates 512 even if not 512.

---
I'm also seeing the linkspeed, NCQ setting, drive temperature and Manufacturers serial number -- all things I would expect out of the kernel. I thought I remembered seeing temps displayed in linux as well. Hmmmm.

Thanks for the pointer & response!

Quoted 3 lines

Dave

maintainer
#3 lore raw
Quoted 16 lines · L A Walsh
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 5 lines · * L A Walsh ([email protected]) wrote:

Trying to track down why my 4K drives no longer display 4K in sysfs (/sys) and don't seem to show individual disk drive information. When I first got the drives, linux displayed the correct physical disk size, but when I look now, I only see 512.

Quoted 5 lines

Is this one of the PHY-SEC or LOG-SEC fields that lsblk can print?

[dg@major ~]$ lsblk -o "NAME,PHY-SEC,LOG-SEC"
NAME PHY-SEC LOG-SEC
sda 512 512

---
It would be, if it was correct. Megacli displays:

Quoted 6 lines

Sector Size: 512
Logical Sector Size: 512
Physical Sector Size: 4096

But lsblk displays 512 for everything. The disk says it uses a 512e format with the 'e' meaning it emulates 512 even if not 512.

lsblk, fdisk, blockdev, ... but all of the utils read the information from kernel. So, it depends how the device reports topology to the kernel.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
author
#4 lore raw
Quoted 25 lines · Karel Zak
Quoted 23 lines · L A Walsh
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 6 lines · * L A Walsh ([email protected]) wrote:

Trying to track down why my 4K drives no longer display 4K in sysfs (/sys) and don't seem to show individual disk drive information. When I first got the drives, linux displayed the correct physical disk size, but when I look now, I only see 512.

Quoted 6 lines

Is this one of the PHY-SEC or LOG-SEC fields that lsblk can print?

[dg@major ~]$ lsblk -o "NAME,PHY-SEC,LOG-SEC"
NAME PHY-SEC LOG-SEC
sda 512 512

---
It would be, if it was correct. Megacli displays:

Sector Size: 512
Logical Sector Size: 512
Physical Sector Size: 4096

Quoted 8 lines
Quoted 3 lines

But lsblk displays 512 for everything. The disk says it uses a 512e format with the 'e' meaning it emulates 512 even if not 512.

lsblk, fdisk, blockdev, ... but all of the utils read the information from kernel. So, it depends how the device reports topology to the kernel.

Well, that's what I would think but I can't see why the device driver would have been purposely changed to hide the actual physical size or the temperature. That said, megacli has to be reading those values from somewhere -- and I'd tend to think it was accessing the driver as well, but that begs the question -- where is it getting the temperature and physical size from>?

It can even read the serial numbers off the disks.

I'm not sure if it is opensource or not.
*sigh*

Quoted 3 lines

Karel

#5 lore raw
Quoted 34 lines · * L A Walsh ([email protected]) wrote:
Quoted 25 lines · Karel Zak
Quoted 23 lines · L A Walsh
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 6 lines · * L A Walsh ([email protected]) wrote:

Trying to track down why my 4K drives no longer display 4K in sysfs (/sys) and don't seem to show individual disk drive information. When I first got the drives, linux displayed the correct physical disk size, but when I look now, I only see 512.

Quoted 6 lines

Is this one of the PHY-SEC or LOG-SEC fields that lsblk can print?

[dg@major ~]$ lsblk -o "NAME,PHY-SEC,LOG-SEC"
NAME PHY-SEC LOG-SEC
sda 512 512

---
It would be, if it was correct. Megacli displays:

Sector Size: 512
Logical Sector Size: 512
Physical Sector Size: 4096

Quoted 8 lines
Quoted 3 lines

But lsblk displays 512 for everything. The disk says it uses a 512e format with the 'e' meaning it emulates 512 even if not 512.

lsblk, fdisk, blockdev, ... but all of the utils read the information from kernel. So, it depends how the device reports topology to the kernel.

Quoted 8 lines

Well, that's what I would think but I can't see why the device driver would have been purposely changed to hide the actual physical size or the temperature. That said, megacli has to be reading those values from somewhere -- and I'd tend to think it was accessing the driver as well, but that begs the question -- where is it getting the temperature and physical size from>?

It can even read the serial numbers off the disks.

I think that's an easy one :-)

Quoted 2 lines

I'm not sure if it is opensource or not.
*sigh*

megacli is a special for LSI RAID controllers isn't it?
If so, then perhaps the RAID controller is hiding some info depending on how it's configured and using a special to get the info from the controller.

How about trying one of the SCSI utils, like sginfo -a ?

Dave

Quoted 5 lines
Quoted 4 lines

Karel

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
author
#6 lore raw

Re:why would 4k size for phys sector size read in kernel, go away?

Quoted 8 lines · Dr. David Alan Gilbert

megacli is a special for LSI RAID controllers isn't it?
If so, then perhaps the RAID controller is hiding some info depending on how it's configured and using a special to get the info from the controller.

How about trying one of the SCSI utils, like sginfo -a ?

It didn't show anything about blocksize logical or physical.

The only thing I see Megacli doing s searching through /sys/, it seems to find the name of the controller,

then opening (FD3)
"/dev/megaraid_sas_ioctl_node

then issuing a bunch of

ioctl(3, MCE_GET_RECORD_LEN or MEMGETINFO or MTRRIOC_SET_ENTRY, 0x7cb9e0)

calls after which it dumps all the info about the disks in the RAIDS. Of note.. these are disks in external enclosures that are connected via the LSI controller.

Also of note, I am certain that the physical size of the blocks for the 4K blocks used to show 4096 bytes as I had written scripts to pull this information.

I also am fairly sure I remember seeing the temperatures listed somewhere, but I didn't write a supporting script to display that info.

While megacli does seem to use an ioctl of the device, (haven't looked at source of driver yet) that doesn't negate that sysfs USED to display the correct blocksize. My minor concern is that if the kernel doesn't know the real size of the blocks, no way disk utils will know and have concerns about something eventually getting it off by 1 or such. Depending on what disk it is, I might not notice it until it was a large pain to reformat it correctly.

FWIW, I've been unable to find a source for megacli...