* Detection of Advanced Format drives @ 2011-09-26 9:55 Arun 2011-09-26 10:15 ` Alan Cox 0 siblings, 1 reply; 15+ messages in thread From: Arun @ 2011-09-26 9:55 UTC (permalink / raw) To: linux-kernel Is there any way to detect the Advanced Format hard drives with 4K sector size? I understand that above kernel v. 2.6.31 it is supported. But is it possible detect automatically if the drive is an AF drive and how? In case this is not the correct place to ask please redirect me to where I should look for an answer. Thanks, Arun ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-26 9:55 Detection of Advanced Format drives Arun @ 2011-09-26 10:15 ` Alan Cox 2011-09-26 19:48 ` Joshua Scoggins 2011-09-26 21:03 ` Martin K. Petersen 0 siblings, 2 replies; 15+ messages in thread From: Alan Cox @ 2011-09-26 10:15 UTC (permalink / raw) To: Arun; +Cc: linux-kernel On Mon, 26 Sep 2011 15:25:52 +0530 Arun <engineerarun@gmail.com> wrote: > Is there any way to detect the Advanced Format hard drives with 4K > sector size? I understand that above kernel v. 2.6.31 it is supported. > But is it possible detect automatically if the drive is an AF drive > and how? It's in the drive identify data (see the ATA 8 specification documents) ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-26 10:15 ` Alan Cox @ 2011-09-26 19:48 ` Joshua Scoggins 2011-09-26 20:09 ` Mike Snitzer 2011-09-26 21:01 ` Martin K. Petersen 2011-09-26 21:03 ` Martin K. Petersen 1 sibling, 2 replies; 15+ messages in thread From: Joshua Scoggins @ 2011-09-26 19:48 UTC (permalink / raw) To: Alan Cox; +Cc: Arun, linux-kernel Keep in mind that some AF drives will not report their actual sector sizes. I have this issue with the WD AV-25 series. This is to provide compatibility with older operating systems that don't support AF drives. These are called generation 1 devices. Newer drives will directly report their sector size as 4096 through the drive identify data older ones will say 512. At that point you just need to do a google search to see if it's AF or not. -Josh On Mon, Sep 26, 2011 at 3:15 AM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote: > On Mon, 26 Sep 2011 15:25:52 +0530 > Arun <engineerarun@gmail.com> wrote: > >> Is there any way to detect the Advanced Format hard drives with 4K >> sector size? I understand that above kernel v. 2.6.31 it is supported. >> But is it possible detect automatically if the drive is an AF drive >> and how? > > It's in the drive identify data (see the ATA 8 specification documents) > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-26 19:48 ` Joshua Scoggins @ 2011-09-26 20:09 ` Mike Snitzer 2011-09-27 17:59 ` Joshua Scoggins 2011-09-26 21:01 ` Martin K. Petersen 1 sibling, 1 reply; 15+ messages in thread From: Mike Snitzer @ 2011-09-26 20:09 UTC (permalink / raw) To: Joshua Scoggins; +Cc: Alan Cox, Arun, linux-kernel On Mon, Sep 26, 2011 at 3:48 PM, Joshua Scoggins <theoretically.x64@gmail.com> wrote: > Keep in mind that some AF drives will not report their actual sector > sizes. I have this issue with the WD AV-25 series. This is to provide > compatibility with older operating systems that don't support AF > drives. These are called generation 1 devices. Newer drives will > directly report their sector size as 4096 through the drive identify > data older ones will say 512. At that point you just need to do a > google search to see if it's AF or not. Linux should publish the discrepancy with these <disk> specific sysfs files: /sys/block/<disk>/queue/logical_block_size=512 /sys/block/<disk>/queue/physical_block_size=4096 But are you saying you have an AF disk that doesn't publish this discrepancy via the IDENTIFY DEVICE (ATA) or READ CAPACITY 16 (SCSI) command? ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-26 20:09 ` Mike Snitzer @ 2011-09-27 17:59 ` Joshua Scoggins 2011-09-27 18:36 ` Arun 0 siblings, 1 reply; 15+ messages in thread From: Joshua Scoggins @ 2011-09-27 17:59 UTC (permalink / raw) To: Mike Snitzer; +Cc: Alan Cox, Arun, linux-kernel Didn't know about the physical_block_size field. My AV-25 reports the physical_block_size as 4096 and the logical block size as 512. Thanks for the heads up and sorry about the misinformation. Not my intention to spread FUD like that On Mon, Sep 26, 2011 at 1:09 PM, Mike Snitzer <snitzer@gmail.com> wrote: > On Mon, Sep 26, 2011 at 3:48 PM, Joshua Scoggins > <theoretically.x64@gmail.com> wrote: >> Keep in mind that some AF drives will not report their actual sector >> sizes. I have this issue with the WD AV-25 series. This is to provide >> compatibility with older operating systems that don't support AF >> drives. These are called generation 1 devices. Newer drives will >> directly report their sector size as 4096 through the drive identify >> data older ones will say 512. At that point you just need to do a >> google search to see if it's AF or not. > > Linux should publish the discrepancy with these <disk> specific sysfs files: > > /sys/block/<disk>/queue/logical_block_size=512 > /sys/block/<disk>/queue/physical_block_size=4096 > > But are you saying you have an AF disk that doesn't publish this > discrepancy via the IDENTIFY DEVICE (ATA) or READ CAPACITY 16 (SCSI) > command? > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-27 17:59 ` Joshua Scoggins @ 2011-09-27 18:36 ` Arun 2011-09-27 18:59 ` Martin K. Petersen 0 siblings, 1 reply; 15+ messages in thread From: Arun @ 2011-09-27 18:36 UTC (permalink / raw) To: Joshua Scoggins; +Cc: Mike Snitzer, Alan Cox, linux-kernel Mike, Regarding "Linux does, and will bubble this additional information up the stack."... Should I suppose that it is an already available piece of information to the userland? Or do I need to modify the hdparm/fdisk code to get this piece of info? Once again, if this is not the place to ask about userland/hdpark/fdisk etc. please redirect to the correct location. Regards, Arun On Tue, Sep 27, 2011 at 23:29, Joshua Scoggins <theoretically.x64@gmail.com> wrote: > Didn't know about the physical_block_size field. My AV-25 reports the > physical_block_size as 4096 and the logical block size as 512. > > Thanks for the heads up and sorry about the misinformation. Not my > intention to spread FUD like that > > On Mon, Sep 26, 2011 at 1:09 PM, Mike Snitzer <snitzer@gmail.com> wrote: >> On Mon, Sep 26, 2011 at 3:48 PM, Joshua Scoggins >> <theoretically.x64@gmail.com> wrote: >>> Keep in mind that some AF drives will not report their actual sector >>> sizes. I have this issue with the WD AV-25 series. This is to provide >>> compatibility with older operating systems that don't support AF >>> drives. These are called generation 1 devices. Newer drives will >>> directly report their sector size as 4096 through the drive identify >>> data older ones will say 512. At that point you just need to do a >>> google search to see if it's AF or not. >> >> Linux should publish the discrepancy with these <disk> specific sysfs files: >> >> /sys/block/<disk>/queue/logical_block_size=512 >> /sys/block/<disk>/queue/physical_block_size=4096 >> >> But are you saying you have an AF disk that doesn't publish this >> discrepancy via the IDENTIFY DEVICE (ATA) or READ CAPACITY 16 (SCSI) >> command? >> > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-27 18:36 ` Arun @ 2011-09-27 18:59 ` Martin K. Petersen 2011-09-27 19:18 ` Arun 2011-09-27 20:10 ` Mark Knecht 0 siblings, 2 replies; 15+ messages in thread From: Martin K. Petersen @ 2011-09-27 18:59 UTC (permalink / raw) To: Arun; +Cc: Joshua Scoggins, Mike Snitzer, Alan Cox, linux-kernel >>>>> "Arun" == Arun <engineerarun@gmail.com> 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-27 18:59 ` Martin K. Petersen @ 2011-09-27 19:18 ` Arun 2011-09-27 20:10 ` Mark Knecht 1 sibling, 0 replies; 15+ messages in thread From: Arun @ 2011-09-27 19:18 UTC (permalink / raw) To: Martin K. Petersen; +Cc: Joshua Scoggins, Mike Snitzer, Alan Cox, linux-kernel Thanks for confirming "hdparm -I" Martin... I guessed it would resolve my detection problem but was not quite sure as I'm still waiting to get the drive and had some time to get my hands dirty :) Thanks everyone for taking interest in my problem. Regards, Arun On Wed, Sep 28, 2011 at 00:29, Martin K. Petersen <martin.petersen@oracle.com> wrote: >>>>>> "Arun" == Arun <engineerarun@gmail.com> 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 > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-27 18:59 ` Martin K. Petersen 2011-09-27 19:18 ` Arun @ 2011-09-27 20:10 ` Mark Knecht 2011-09-27 21:12 ` Arun 1 sibling, 1 reply; 15+ messages in thread From: Mark Knecht @ 2011-09-27 20:10 UTC (permalink / raw) To: Martin K. Petersen Cc: Arun, Joshua Scoggins, Mike Snitzer, Alan Cox, linux-kernel On Tue, Sep 27, 2011 at 11:59 AM, Martin K. Petersen <martin.petersen@oracle.com> wrote: >>>>>> "Arun" == Arun <engineerarun@gmail.com> 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-27 20:10 ` Mark Knecht @ 2011-09-27 21:12 ` Arun 2011-09-27 21:44 ` Martin K. Petersen 0 siblings, 1 reply; 15+ messages in thread From: Arun @ 2011-09-27 21:12 UTC (permalink / raw) To: Mark Knecht Cc: Martin K. Petersen, Joshua Scoggins, Mike Snitzer, Alan Cox, linux-kernel Mark, I got your point. A quick check of hdparm tells me that it is using the SG_IO ioctl for the ATA_OP_PIDENTIFY command. Maybe I have some hopes of having a correct result with the BLKPBSZGET ioctl. Will check that out. Regards, Arun On Wed, Sep 28, 2011 at 01:40, Mark Knecht <markknecht@gmail.com> wrote: > > On Tue, Sep 27, 2011 at 11:59 AM, Martin K. Petersen > <martin.petersen@oracle.com> wrote: > >>>>>> "Arun" == Arun <engineerarun@gmail.com> 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-27 21:12 ` Arun @ 2011-09-27 21:44 ` Martin K. Petersen 2011-09-28 1:23 ` NamJae Jeon 0 siblings, 1 reply; 15+ messages in thread From: Martin K. Petersen @ 2011-09-27 21:44 UTC (permalink / raw) To: Arun Cc: Mark Knecht, Martin K. Petersen, Joshua Scoggins, Mike Snitzer, Alan Cox, linux-kernel >>>>> "Arun" == Arun <engineerarun@gmail.com> writes: Arun> A quick check of hdparm tells me that it is using the SG_IO ioctl Arun> for the ATA_OP_PIDENTIFY command. Maybe I have some hopes of Arun> having a correct result with the BLKPBSZGET ioctl. Will check that Arun> out. hdparm and the kernel are looking the same place for the physical block size. There should be no discrepancy between what hdparm can see and what's reported in physical_block_size by the kernel. The BLKPBSZGET returns the same topology parameter as sysfs' physical_block_size. -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-27 21:44 ` Martin K. Petersen @ 2011-09-28 1:23 ` NamJae Jeon [not found] ` <CANLaLhagmNFFrNxC88cyPqsx_j+-Y-WaAUCQpkR57z264Bn6Vw@mail.gmail.com> 0 siblings, 1 reply; 15+ messages in thread From: NamJae Jeon @ 2011-09-28 1:23 UTC (permalink / raw) To: Martin K. Petersen Cc: Arun, Mark Knecht, Joshua Scoggins, Mike Snitzer, Alan Cox, linux-kernel 2011/9/28 Martin K. Petersen <martin.petersen@oracle.com>: >>>>>> "Arun" == Arun <engineerarun@gmail.com> writes: > > Arun> A quick check of hdparm tells me that it is using the SG_IO ioctl > Arun> for the ATA_OP_PIDENTIFY command. Maybe I have some hopes of > Arun> having a correct result with the BLKPBSZGET ioctl. Will check that > Arun> out. > > hdparm and the kernel are looking the same place for the physical block > size. There should be no discrepancy between what hdparm can see and > what's reported in physical_block_size by the kernel. The BLKPBSZGET > returns the same topology parameter as sysfs' physical_block_size. > > -- > Martin K. Petersen Oracle Linux Engineering > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > plz remember, There are native 4k and 512B emulate. In case of 512B emulate, you can see logical block size is 512Byte and physical block size is 4KB. Although you can access 512Byte, It should be access per 4KB in order to prevent the loss of performance by RMW penalty. ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <CANLaLhagmNFFrNxC88cyPqsx_j+-Y-WaAUCQpkR57z264Bn6Vw@mail.gmail.com>]
* Re: Detection of Advanced Format drives [not found] ` <CANLaLhagmNFFrNxC88cyPqsx_j+-Y-WaAUCQpkR57z264Bn6Vw@mail.gmail.com> @ 2012-02-16 19:14 ` Martin K. Petersen 0 siblings, 0 replies; 15+ messages in thread From: Martin K. Petersen @ 2012-02-16 19:14 UTC (permalink / raw) To: Arun Cc: NamJae Jeon, Martin K. Petersen, Mark Knecht, Joshua Scoggins, Mike Snitzer, Alan Cox, linux-kernel >>>>> "Arun" == Arun <engineerarun@gmail.com> writes: Arun> [...] couldn't find any direct way of detecting an SSD drive like Arun> an ioctl. Arun> Is there any such direct way of detecting SSD drives yet? I am Arun> working on kernel version 2.6.32-19. You can check /sys/block/foo/queue/rotational. The matching BLKROTATIONAL ioctl didn't go in until very recently. -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-26 19:48 ` Joshua Scoggins 2011-09-26 20:09 ` Mike Snitzer @ 2011-09-26 21:01 ` Martin K. Petersen 1 sibling, 0 replies; 15+ messages in thread From: Martin K. Petersen @ 2011-09-26 21:01 UTC (permalink / raw) To: Joshua Scoggins; +Cc: Alan Cox, Arun, linux-kernel >>>>> "Joshua" == Joshua Scoggins <theoretically.x64@gmail.com> writes: Joshua> Keep in mind that some AF drives will not report their actual Joshua> sector sizes. I have this issue with the WD AV-25 series. This Joshua> is to provide compatibility with older operating systems that Joshua> don't support AF drives. These are called generation 1 Joshua> devices. Newer drives will directly report their sector size as Joshua> 4096 through the drive identify data older ones will say 512. AF drives continue to report a logical block size of 512. There's an additional parameter in IDENTIFY DEVICE that describes the physical block size. Legacy operating systems do not check the physical block size parameter. Linux does, and will bubble this additional information up the stack. There have been a few attempts at switching ATA drives over to 4KB logical blocks as well. We are ready. However, both boot and legacy OS compatibility concerns make this a bit of an uphill battle. As you mention there's one vendor that pretty consistently gets their physical block size reporting wrong. We've pointed this out to them many times. Apparently it's been fixed with the latest green drive firmware... -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Detection of Advanced Format drives 2011-09-26 10:15 ` Alan Cox 2011-09-26 19:48 ` Joshua Scoggins @ 2011-09-26 21:03 ` Martin K. Petersen 1 sibling, 0 replies; 15+ messages in thread From: Martin K. Petersen @ 2011-09-26 21:03 UTC (permalink / raw) To: Alan Cox; +Cc: Arun, linux-kernel >>>>> "Alan" == Alan Cox <alan@lxorguk.ukuu.org.uk> writes: >> Is there any way to detect the Advanced Format hard drives with 4K >> sector size? I understand that above kernel v. 2.6.31 it is >> supported. But is it possible detect automatically if the drive is >> an AF drive and how? Alan> It's in the drive identify data (see the ATA 8 specification Alan> documents) Or: http://oss.oracle.com/~mkp/docs/linux-advanced-storage.pdf -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2012-02-16 19:14 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-26 9:55 Detection of Advanced Format drives Arun
2011-09-26 10:15 ` Alan Cox
2011-09-26 19:48 ` Joshua Scoggins
2011-09-26 20:09 ` Mike Snitzer
2011-09-27 17:59 ` Joshua Scoggins
2011-09-27 18:36 ` Arun
2011-09-27 18:59 ` Martin K. Petersen
2011-09-27 19:18 ` Arun
2011-09-27 20:10 ` Mark Knecht
2011-09-27 21:12 ` Arun
2011-09-27 21:44 ` Martin K. Petersen
2011-09-28 1:23 ` NamJae Jeon
[not found] ` <CANLaLhagmNFFrNxC88cyPqsx_j+-Y-WaAUCQpkR57z264Bn6Vw@mail.gmail.com>
2012-02-16 19:14 ` Martin K. Petersen
2011-09-26 21:01 ` Martin K. Petersen
2011-09-26 21:03 ` Martin K. Petersen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox