Re: Detection of Advanced Format drives

From: Mark Knecht
Date: Tue Sep 27 2011 - 16:10:33 EST


On Tue, Sep 27, 2011 at 11:59 AM, Martin K. Petersen
<martin.petersen@xxxxxxxxxx> wrote:
>>>>>> "Arun" == Arun Â<engineerarun@xxxxxxxxx> writes:
>
> Arun> Should I suppose that it is an already available piece of
> Arun> information to the userland?
>
> Yes, in the sysfs locations Mike mentioned:
>
> Â/sys/block/foo/queue/physical_block_size
>
> Or you can use the BLKPBSZGET ioctl.
>
>
> Arun> Or do I need to modify the hdparm/fdisk code to get this piece of
> Arun> info?
>
> Recent hdparm versions will also report the right thing:
>
> # hdparm -I /dev/sdc | grep Sector
> Â Â Â ÂLogical ÂSector size: Â Â Â Â Â Â Â Â Â 512 bytes
> Â Â Â ÂPhysical Sector size: Â Â Â Â Â Â Â Â Â4096 bytes
> Â Â Â ÂLogical Sector-0 offset: Â Â Â Â Â Â Â Â512 bytes
>
> --
> Martin K. Petersen   ÂOracle Linux Engineering

As someone else pointed out earlier, not every drive with 4K sectors
will tell you it has 4K sectors, at least not using hdparm. This is a
WD 1TB drive circa early last year for which I've not updated
firmware. (If there is an update)

gandalf ~ # hdparm -I /dev/sda | grep Sector
Logical/Physical Sector size: 512 bytes
gandalf ~ #

gandalf ~ # cat /sys/block/sda/queue/physical_block_size
512
gandalf ~ #

- Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/