Re: Writing/reading OD, MD, ID of a disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020/11/01 18:06, Sitsofe Wheeler wrote:
> Hi,
> 
> On Tue, 6 Oct 2020 at 13:40, siha lawrence <sihaj33@xxxxxxxxx> wrote:
>>
>> Hi,
>>
>> What parameters could we use to write/read OD, MD, ID of a disk or
>> specific LBAs?
>>
>> Thanks,
>> Siha
> 
> It seems like OD (Outer Disk), MD (Middle Disk) and ID (Inner Disk)
> are SMR drive terms. I don't know how you explicitly target those...
> maybe someone more familiar with SMR would know? (I've CC'd Dmitry in
> case they know).

OD/MD/ID is not SMR specific. These terms refer to the physical location on the
disk platters of the sectors being accessed. Any HDD, regardless of the
underlying recording technology (PMR, SMR, energy assist or not) will map
logical blocks to a physical block on a particular track on a platter, with the
track located toward the outer diameters of the platter or mid or inner diameters.

Since the number of sectors on a track is not constant and depends on the linear
length of the track, accesses at outer diameters of a disk gives higher
throughput since the tracks there are longer and so more sectors can be
processed with one revolution (8.33ms for a 7200 rpm drive) compared to accesses
to shorter tracks toward the spindle (axis) of the platter.

> If you want to write a specific LBA you will have to get as close to
> the disk as possible. If we're talking Linux you can access the disk's
> raw block device (filename=/dev/<dev>), use direct=1, set blocksize to
> the underlying block size and then you could play back a hand crafted
> iolog (https://fio.readthedocs.io/en/latest/fio_doc.html#cmdoption-arg-read-iolog
> / https://fio.readthedocs.io/en/latest/fio_doc.html#trace-file-format-v2
> ) where the offset would correspond to the LBA.

Correct. But the block size does not need to be the same size as the disk
physical sector size. It can be any value that is a multiple of the physical
block size. E.g. to measure sequential throughput at OD (lba=0), one can simply
run something like:

fio --name=OD --filename=/dev/sdX --ioengine=libaio --iodepth=16 --rw=read
--direct=1 --bs=512K --iosize=some-large-ish-value --offset=0

And to measure at ID.... Well that's where problems start: the
logical-to-physical mapping is not a standard and varies from drive to drive. So
there is no way to tell what the logical block value is for MD and ID. Old-ish
or low capacity drives tend to have a somewhat linear mapping: 0 is OD, mid
capacity is MD and ID is toward the max LBA of the disk. But a *lot* of drives
have different mapping, e.g mid-capacity LBAs are at ID and max capacity LBAs
are at MD.

This is however very easy to discover. Simply run:

fio --name=throughput --filename=/dev/sdX --ioengine=libaio --iodepth=16
--rw=read --direct=1 --bs=512K

To read the entire drive. Add logging of the throughput over time and plot that.
You will clearly see how the throughput varies depending on the LBA being
accessed and the throughput value is directly dependent on the diameter location
of the LBAs accessed.

Note that even LBA 0 == OD is not a given. Some SMR drives with conventional
zones tend to place these zones at MD but they are mapped starting from LBA 0.

Best regards.

-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux