using host-managed SMR SATA HDD under linux

i’ve found refurbished host-managed SMR drives from Seagate sale; model ST25000NM000E-3L9103 coming from Exos Xz series. below – notes on what did i discover.

those are not ordinary drives: e.g. they’ll not work under Windows, under linux only some file systems are supported directly or additional layer of dm-zoned is needed. i’ve also found out that, at least with my SATA to USB3 docks, such drives will not work with an external docking station. when connected in this way linux did not show anything in the dmesg or lsblk. drive showed up just fine after connecting directly to SATA controller on motherboard:

[    1.722691] sd 2:0:0:0: [sdb] Host-managed zoned block device
[    1.724585] sd 2:0:0:0: [sdb] 48830087168 512-byte logical blocks: (25.0 TB/22.7 TiB)
[    1.724594] sd 2:0:0:0: [sdb] 4096-byte physical blocks
[    1.724630] sd 2:0:0:0: [sdb] Write Protect is off
[    1.724635] sd 2:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    1.724658] sd 2:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.724697] sd 2:0:0:0: [sdb] Preferred minimum I/O size 4096 bytes
[    2.078504] sd 2:0:0:0: [sdb] 93136 zones of 524288 logical blocks
[    2.132937] sd 2:0:0:0: [sdb] Attached SCSI disk

drives of this type do not work with ordinary file systems like ext4, at least not directly and require additional zone-aware layer.

in Debian 13 / Trixie i can create BTRFS partition directly on such a drive by using mkfs.btrfs /dev/sdb ; it was immediately usable. but i would like to use full disk encryption and that’s not immediately possible:

root@debian:~# cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb

WARNING!
========
This will overwrite data on /dev/sdb irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/sdb:
Verify passphrase:
Zoned device /dev/sdb cannot be used for LUKS header.
Command failed with code -1 (wrong or missing parameters).

first i need to set up virtual device that will handle zoned data storage, then – on top of it – i can create encrypted partition and finally – btrfs file system on top of it. surely less efficient, but more secure for my data.

root@debian:~# apt-get install dm-zoned-tools
[..]
root@debian:~# dmzadm --format /dev/sdb
/dev/sdb: 48830087168 512-byte sectors (23284 GiB)
  Host-managed device
  93136 zones, offset 0
  93136 zones of 524288 512-byte sectors (256 MiB)
  65536 4KB data blocks per zone
Resetting sequential zones
Writing primary metadata set
  Writing mapping table
  Writing bitmap blocks
  Writing super block to sdb block 0
Writing secondary metadata set
  Writing mapping table
  Writing bitmap blocks
  Writing super block to sdb block 196608
Syncing disk
Done.
root@debian:~# dmzadm --start /dev/sdb
/dev/sdb: 48830087168 512-byte sectors (23284 GiB)
  Host-managed device
  93136 zones, offset 0
  93136 zones of 524288 512-byte sectors (256 MiB)
  65536 4KB data blocks per zone
sdb: starting dmz-ZX2123V8, metadata ver. 2, uuid bc9156b0-5ea1-4431-bcde-5f6f9dd42591
root@debian:~# cryptsetup --verbose --verify-passphrase luksFormat /dev/mapper/dmz-ZX2123V8

WARNING!
========
This will overwrite data on /dev/mapper/dmz-ZX2123V8 irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/mapper/dmz-ZX2123V8:
Verify passphrase:
Key slot 0 created.
Command successful.
root@debian:~# cryptsetup luksOpen /dev/mapper/dmz-ZX2123V8 encryptedDisk
Enter passphrase for /dev/mapper/dmz-ZX2123V8:
root@debian:~# mkfs.btrfs /dev/mapper/encryptedDisk
btrfs-progs v6.14
See https://btrfs.readthedocs.io for more information.

NOTE: several default settings have changed in version 5.15, please make sure
      this does not affect your deployments:
      - DUP for metadata (-m dup)
      - enabled no-holes (-O no-holes)
      - enabled free-space-tree (-R free-space-tree)

Label:              (null)
UUID:               6423b836-8311-4a25-8404-31f21f8aa570
Node size:          16384
Sector size:        4096        (CPU page size: 4096)
Filesystem size:    22.73TiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP               1.00GiB
  System:           DUP               8.00MiB
SSD detected:       no
Zoned device:       no
Features:           extref, skinny-metadata, no-holes, free-space-tree
Checksum:           crc32c
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1    22.73TiB  /dev/mapper/encryptedDisk
root@debian:~# mount /dev/mapper/encryptedDisk /mnt/

an alternative approach – without extra dm-zoned layer:

root@debian:~#  cryptsetup open --type plain --key-size 512 --cipher aes-xts-plain64 --hash plain   /dev/sdb encryptedDisk
Enter passphrase for /dev/sdb:
root@debian:~# mkfs.btrfs /dev/mapper/encryptedDisk
btrfs-progs v6.14
See https://btrfs.readthedocs.io for more information.

zoned: /dev/mapper/encryptedDisk: host-managed device detected, setting zoned feature
Resetting device zones /dev/mapper/encryptedDisk (93136 zones) ...
NOTE: several default settings have changed in version 5.15, please make sure
      this does not affect your deployments:
      - DUP for metadata (-m dup)
      - enabled no-holes (-O no-holes)
      - enabled free-space-tree (-R free-space-tree)

Label:              (null)
UUID:               c61db7f6-ea02-432d-b551-32d8ef27673a
Node size:          16384
Sector size:        4096        (CPU page size: 4096)
Filesystem size:    22.74TiB
Block group profiles:
  Data:             single          256.00MiB
  Metadata:         DUP             256.00MiB
  System:           DUP             256.00MiB
SSD detected:       no
Zoned device:       yes
  Zone size:        256.00MiB
Features:           extref, skinny-metadata, no-holes, free-space-tree, zoned
Checksum:           crc32c
Number of devices:  1
Devices:
   ID        SIZE  ZONES  PATH
    1    22.74TiB  93136  /dev/mapper/encryptedDisk

root@debian:~# mount /dev/mapper/encryptedDisk /mnt/

in the same way ext4 or other file system partition can be created on the zoned hdd, also without using the LUKS encryption layer.

related information:

Leave a Reply

Your email address will not be published. Required fields are marked *

(Spamcheck Enabled)