[dm-crypt] Alignment issue with 4K disk

Sven Eschenberg sven at whgl.uni-frankfurt.de
Sun Jan 10 20:13:00 CET 2016


Hi Eugen,

Quoting a document on IO-Hintig:

'Storage vendors can also supply "I/O hints" about a device's preferred
minimum unit for random I/O ('minimum_io_size') and streaming I/O
('optimal_io_size').  For example, these hints may correspond to a RAID
device's chunk size and stripe size respectively.'

Of course a RAIDs layout parameters and preferred IO sizes are 
semantically completely different things.

As for your case:
Ignore the warning. I think the optimal IO size as in 'preferred size 
for sequential streaming IO' is indeed correct and must not necessarily 
be a multiple of physical sector size. The optimal IO size is owed to 
the transport layer (USB protocol) constraints, to max out the BUS 
bandwidth.

Cutting it down to a simple example:
Consider each frame in the transport layer can hold 1.9 physical 
sectors. Stuffing only 1 sector into the frame (to keep the multiple 
physical sector constraint) will lead to a significant rise in number of 
frames/packets and thus overhead. And I am not even talking about 
transport layers with fixed frame size where you'll loose nearly 50% of 
bandwidth and therefore transfer rate.

Anyway, in your case everything seems properly aligned. I tried to find 
a way to influence 'optimal_io_size', could not find anything. Changing 
the parameters via sysfs does not work, maybe there are IOCTLs and a 
suiting utility...


Regards

-Sven



Am 10.01.2016 um 18:22 schrieb Eugen Rogoza:
>> My personal opinion is: The test is semantically wrong in different
>> aspects. May I ask what drive you are using and what interface it uses?
>>
>> Regards
>>
>> -Sven
>
> Hi Sven,
>
> drive info below:
>
>
> root at nuc:~> hdparm -I /dev/sdc
> /dev/sdc:
>
> ATA device, with non-removable media
>          Model Number:       WDC WD60EZRX-00MVLB1
>          Serial Number:      WD-WX41D94RNKAX
>          Firmware Revision:  80.00A80
>          Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
> Standards:
>          Used: unknown (minor revision code 0x001f)
>          Supported: 9 8 7 6 5
>          Likely used: 9
> Configuration:
>          Logical         max     current
>          cylinders       16383   16383
>          heads           16      16
>          sectors/track   63      63
>          --
>          CHS current addressable sectors:   16514064
>          LBA    user addressable sectors:  268435455
>          LBA48  user addressable sectors:11721045168
>          Logical  Sector size:                   512 bytes
>          Physical Sector size:                  4096 bytes
>          device size with M = 1024*1024:     5723166 MBytes
>          device size with M = 1000*1000:     6001175 MBytes (6001 GB)
>          cache/buffer size  = unknown
>          Nominal Media Rotation Rate: 5700
> Capabilities:
>          LBA, IORDY(can be disabled)
>          Queue depth: 32
>          Standby timer values: spec'd by Standard, with device specific minimum
>          R/W multiple sector transfer: Max = 16  Current = 0
>          DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
>               Cycle time: min=120ns recommended=120ns
>          PIO: pio0 pio1 pio2 pio3 pio4
>               Cycle time: no flow control=120ns  IORDY flow control=120ns
> Commands/features:
>          Enabled Supported:
>             *    SMART feature set
>                  Security Mode feature set
>             *    Power Management feature set
>             *    Write cache
>             *    Look-ahead
>             *    Host Protected Area feature set
>             *    WRITE_BUFFER command
>             *    READ_BUFFER command
>             *    NOP cmd
>             *    DOWNLOAD_MICROCODE
>                  Power-Up In Standby feature set
>             *    SET_FEATURES required to spinup after power up
>                  SET_MAX security extension
>             *    48-bit Address feature set
>             *    Device Configuration Overlay feature set
>             *    Mandatory FLUSH_CACHE
>             *    FLUSH_CACHE_EXT
>             *    SMART error logging
>             *    SMART self-test
>             *    General Purpose Logging feature set
>             *    64-bit World wide name
>             *    WRITE_UNCORRECTABLE_EXT command
>             *    {READ,WRITE}_DMA_EXT_GPL commands
>             *    Segmented DOWNLOAD_MICROCODE
>             *    Gen1 signaling speed (1.5Gb/s)
>             *    Gen2 signaling speed (3.0Gb/s)
>             *    Gen3 signaling speed (6.0Gb/s)
>             *    Native Command Queueing (NCQ)
>             *    Host-initiated interface power management
>             *    Phy event counters
>             *    NCQ priority information
>             *    unknown 76[15]
>                  DMA Setup Auto-Activate optimization
>                  Device-initiated interface power management
>             *    Software settings preservation
>             *    SMART Command Transport (SCT) feature set
>             *    SCT Write Same (AC2)
>             *    SCT Features Control (AC4)
>             *    SCT Data Tables (AC5)
>                  unknown 206[12] (vendor specific)
>                  unknown 206[13] (vendor specific)
>             *    DOWNLOAD MICROCODE DMA command
>             *    WRITE BUFFER DMA command
>             *    READ BUFFER DMA command
> Security:
>          Master password revision code = 65534
>                  supported
>          not     enabled
>          not     locked
>          not     frozen
>          not     expired: security count
>                  supported: enhanced erase
> Logical Unit WWN Device Identifier: 50014ee20b2a3e40
>          NAA             : 5
>          IEEE OUI        : 0014ee
>          Unique ID       : 20b2a3e40
> Checksum: correct
>
>
> It is an internal 3,5" SATA-drive put into a USB3-enclosure and connected via USB3 in UAS mode:
>
>
> Jan 10 01:13:26 nuc kernel: usb 2-4: new SuperSpeed USB device number 2 using xhci_hcd
> Jan 10 01:13:26 nuc kernel: usb 2-4: New USB device found, idVendor=174c, idProduct=55aa
> Jan 10 01:13:26 nuc kernel: usb 2-4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
> Jan 10 01:13:26 nuc kernel: usb 2-4: Product: ASM1153E
> Jan 10 01:13:26 nuc kernel: usb 2-4: Manufacturer: asmedia
> Jan 10 01:13:26 nuc kernel: usb 2-4: SerialNumber: 1234567891C4
> Jan 10 01:13:26 nuc kernel: scsi host4: uas
> Jan 10 01:13:26 nuc kernel: usbcore: registered new interface driver uas
> Jan 10 01:13:26 nuc kernel: scsi 4:0:0:0: Direct-Access     ASMT     2115             0    PQ: 0 ANSI: 6
> Jan 10 01:13:26 nuc kernel: sd 4:0:0:0: Attached scsi generic sg2 type 0
> Jan 10 01:13:26 nuc kernel: sd 4:0:0:0: [sdc] Spinning up disk...
> Jan 10 01:13:27 nuc kernel: ............ready
> Jan 10 01:13:38 nuc kernel: sd 4:0:0:0: [sdc] 11721045168 512-byte logical blocks: (6.00 TB/5.45 TiB)
> Jan 10 01:13:38 nuc kernel: sd 4:0:0:0: [sdc] 4096-byte physical blocks
> Jan 10 01:13:38 nuc kernel: sd 4:0:0:0: [sdc] Write Protect is off
> Jan 10 01:13:38 nuc kernel: sd 4:0:0:0: [sdc] Mode Sense: 43 00 00 00
> Jan 10 01:13:38 nuc kernel: sd 4:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> Jan 10 01:13:38 nuc kernel:  sdc: sdc1 sdc2 sdc3 sdc4
> Jan 10 01:13:38 nuc kernel: sd 4:0:0:0: [sdc] Attached SCSI disk
>
>
> As a side note: sdc4 was a dm-crypt/LUKS-encrypted partition before. To my knowledge the device mapper warnings started to appear after migration to VeraCrypt.
>
> Cheers,
>
> Eugen
> _______________________________________________
> dm-crypt mailing list
> dm-crypt at saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
>


More information about the dm-crypt mailing list