Skip to contentSkip to conversation

what should blockdev getbpsz return 4k disks w/512e?

DISCUSSION L A Walsh 2 participants 4 messages Nov 4, 2017 – Nov 14, 2017 Util-Linux package

lore
Share & tools
lore

L A Walsh

author
#0 lore raw

I just tried blockdev on a HW raid device (/dev/sdb) composed of 4K disks that can (w/performance penalty) emulate 512 byte disk (i.e. have the 512e feature). It is returning 512.

If the disk is composed of 4K disks, shouldn't the raid show 4K as well? Otherwise, how do utils know what alignment to use or not to use 512 due to penalty costs? For my formatted disks, I use 4K allocation units, so for those, I shouldn't see problems, but some other disk subsystems or raw-disk using progs also need to know to allocate on 4K boundaries.

Any idea where this info should be showing up?

Thanks!
-linda

maintainer
#1 lore raw
Quoted 5 lines · L A Walsh

I just tried blockdev on a HW raid device (/dev/sdb) composed of 4K disks that can (w/performance penalty) emulate 512 byte disk (i.e. have the 512e feature). It is returning 512.

Quoted 8 lines

If the disk is composed of 4K disks, shouldn't the raid show 4K as well? Otherwise, how do utils know what alignment to use or not to use 512 due to penalty costs? For my formatted disks, I use 4K allocation units, so for those, I shouldn't see problems, but some other disk subsystems or raw-disk using progs also need to know to allocate on 4K boundaries.

Any idea where this info should be showing up?

Try

--getiomin get minimum I/O size
--getioopt get optimal I/O size

or

  lsblk --topology

It's possible that RAID (or another stacked device) uses 512 addressing, but for partitioning or mkfs-like tools we care about minimal and optimal I/O.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
author
#2 lore raw
Quoted 6 lines · Karel Zak
Quoted 4 lines · L A Walsh

I just tried blockdev on a HW raid device (/dev/sdb) composed of 4K disks that can (w/performance penalty) emulate 512 byte disk (i.e. have the 512e feature). It is returning 512.

Quoted 8 lines
Quoted 2 lines

Any idea where this info should be showing up?

Try

--getiomin get minimum I/O size
--getioopt get optimal I/O size

----

Quoted 1 line

sudo blockdev --getiomin /dev/sdb

512

Quoted 1 line

sudo blockdev --getioopt /dev/sdb

0

Quoted 4 lines

or

  lsblk --topology

-----
(some lines deleted for brevity):

NAME ALIGN IO:MIN OPT PHYSEC LOGSEC ROT SCHED RQSZ RA WSAME
sda 0 512 0 512 512 1 bfq 256 512 0B

└─sda1                 0    512    0     512    512   1   bfq  256   512    0B
 └─Backup-Media       0    512    0     512    512   1        128   
128    0B
sdb                    0    512    0     512    512   1   bfq  256   512    0B
└─sdb1                 0    512    0     512    512   1   bfq  256   512    0B
 ├─Data-Home          0    512    0     512    512   1        128   
128    0B
 └─Data-Edge          0    512    0     512    512   1        128   
128    0B
sdc                    0    512    0     512    512   1   bfq  256   512    0B
├─sdc1                 0    512    0     512    512   1   bfq  256   512    0B
└─sdc10                0    512    0     512    512   1   bfq  256   512    0B
Quoted 4 lines

It's possible that RAID (or another stacked device) uses 512 addressing, but for partitioning or mkfs-like tools we care about minimal and optimal I/O.

----
Nothing but the RAID controller seems to know about the 4096
physical size.
(attached jpg from disk controller SW -- can see size under physical
on right).

If anything used a 512 byte offset anywhere, it would really impact
performance, thus my concern about how or where a util would be able to read it...

maintainer
#3 lore raw
Quoted 56 lines · L A Walsh
Quoted 11 lines · Karel Zak
Quoted 5 lines · L A Walsh

I just tried blockdev on a HW raid device (/dev/sdb) composed of 4K disks that can (w/performance penalty) emulate 512 byte disk (i.e. have the 512e feature). It is returning 512.

Any idea where this info should be showing up?

Try

--getiomin get minimum I/O size
--getioopt get optimal I/O size

----

Quoted 1 line

sudo blockdev --getiomin /dev/sdb

512

Quoted 1 line

sudo blockdev --getioopt /dev/sdb

0

Quoted 3 lines

or

  lsblk --topology

-----
(some lines deleted for brevity):

NAME ALIGN IO:MIN OPT PHYSEC LOGSEC ROT SCHED RQSZ RA
WSAME
sda 0 512 0 512 512 1 bfq 256 512
0B
└─sda1 0 512 0 512 512 1 bfq 256 512
0B
└─Backup-Media 0 512 0 512 512 1 128 128
0B
sdb 0 512 0 512 512 1 bfq 256 512
0B
└─sdb1 0 512 0 512 512 1 bfq 256 512
0B
├─Data-Home 0 512 0 512 512 1 128 128
0B
└─Data-Edge 0 512 0 512 512 1 128 128
0B
sdc 0 512 0 512 512 1 bfq 256 512
0B
├─sdc1 0 512 0 512 512 1 bfq 256 512
0B
└─sdc10 0 512 0 512 512 1 bfq 256 512
0B

Quoted 3 lines

It's possible that RAID (or another stacked device) uses 512 addressing, but for partitioning or mkfs-like tools we care about minimal and optimal I/O.

----
Nothing but the RAID controller seems to know about the 4096 physical
size.
(attached jpg from disk controller SW -- can see size under physical on
right).

Quoted 3 lines

If anything used a 512 byte offset anywhere, it would really impact
performance, thus my concern about how or where a util would be able to read it...

Unfortunately userspace tools cannot play any usable role in this story if your system (kernel) does not provide relevant information. For mkfs and partitioning tools it's 512-bytes based devices...

Let's ask kernel developers.

Karel

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