Skip to content

RFC: Default sector size

Ondrej Kozina requested to merge oniko/cryptsetup:default-sector-size into master

I'll add some tests yet but for starters please review the code itself.

The PR has two components:

  1. Adds support for configuring loop device block size when attaching (based on requested dm-crypt encryption sector size)
  2. LUKS2 only: crypt_format now accepts sector_size == 0 (or params == NULL) and it switches library to mode when it tries to find optimal encryption sector size for underlying data device:
  • for image files (put in fs) -> 4K encryption sector size
  • for native 4K devices -> 4K encryption sector size
  • for 4K/512e (4K physical/512 logical) devices -> 4K encryption sector size
  • For 512 -> 512 remains default encryption sector size

EDIT: There are some fallbacks in case detected optimal sector size does not work or could cause errors later. In such case it automatically switches back to 512 encryption sector size.

Edited by Ondrej Kozina

Merge request reports