Skip to content

Allow fixed USB disks to be treated as internal/storage disks #573

Description

@galaxysj

Improve USB HDD classification:

Problem

ZimaOS currently classifies a physical HDD connected through a USB-to-SATA bridge as an external/USB drive even when the disk itself is a fixed, non-removable HDD intended to stay permanently attached to the server.

This prevents such disks from being treated like normal internal storage in parts of the ZimaOS storage UI and storage-related features.

Environment

ZimaOS: v1.7.0
Kernel: 6.18.9
Disk: TOSHIBA MQ04UBF100 1TB HDD
Device: /dev/sdb

lsblk reports:

NAME HCTL    TRAN HOTPLUG SUBSYSTEMS         MODEL
sda  0:0:0:0 sata       0 block:scsi:pci     HYN512
sdb  1:0:0:0 usb        1 block:scsi:usb:pci TOSHIBA MQ04UBF100
└─sdb1                 1 block:scsi:usb:pci

However, the block device itself is explicitly non-removable:

$ cat /sys/block/sdb/removable
0

The underlying device is a real HDD, not a USB flash drive.

udev also correctly identifies the underlying ATA/SATA disk:

ID_ATA=1
ID_BUS=ata
ID_ATA_SATA=1
ID_ATA_ROTATION_RATE_RPM=5400

I also tested explicitly setting:

UDISKS_SYSTEM_INTERNAL=1
UDISKS_IGNORE=0

but ZimaOS still classifies the disk as external storage.

Current behavior

The ZimaOS local-storage service appears to give significant weight to USB transport/interface detection.

As a result, a fixed HDD behind a USB-SATA bridge is classified as an external USB drive even when:

removable=0

and the underlying device is a normal ATA HDD.

This means that TRAN=usb or USB topology effectively overrides the fact that Linux considers the actual disk non-removable.

Requested behavior

Could the storage classification logic distinguish between:

  1. removable USB flash drives, and
  2. fixed HDD/SSD devices connected through a USB-SATA or USB-NVMe bridge?

For example, instead of treating TRAN=usb as sufficient to classify a disk as external, ZimaOS could consider additional signals such as:

  • /sys/block/<device>/removable
  • ATA/SATA detection
  • disk type
  • rotational status (ROTA)
  • model
  • capacity
  • USB bridge vs USB flash-drive detection
  • existing USB flash-drive heuristics
  • whether the user has explicitly configured the device as permanent storage

A device with characteristics such as:

TRAN=usb
removable=0
ID_ATA=1
ID_ATA_SATA=1
physical HDD/SSD behind USB bridge

should be eligible to be treated as fixed storage.

Suggested solution

An ideal solution would be an option in the ZimaOS Storage UI such as:

Treat as internal / fixed storage

This could be available only for USB-connected disks where:

removable=0

so the default USB behavior remains unchanged.

Another option would be to automatically classify USB-connected HDDs/SSDs differently from USB flash drives using the existing disk-detection heuristics.

Why this matters

Many mini PCs and home servers have limited SATA or M.2 expansion but plenty of USB ports.

It is very common to connect:

  • 2.5-inch HDDs
  • 3.5-inch HDDs
  • SATA SSDs
  • NVMe SSD enclosures

through USB adapters and leave them permanently attached.

In this use case, these disks are effectively part of the server's permanent storage pool rather than temporary removable media.

Allowing users to explicitly mark a non-removable USB HDD/SSD as fixed storage would make ZimaOS much more flexible on generic x86 mini PCs and systems without multiple internal SATA bays.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions