Skip to content

Never pick a USB or removable device automatically while an internal disk exists - #177

Merged
mastacontrola merged 1 commit into
masterfrom
fix/fogproject-778-usb-last
Sep 2, 2026
Merged

Never pick a USB or removable device automatically while an internal disk exists#177
mastacontrola merged 1 commit into
masterfrom
fix/fogproject-778-usb-last

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

For FOGProject/fogproject#778. Replaces #176, which GitHub closed when its stacked base branch was deleted at the merge of #175.

The reporter's screenshot shows the deploy going to /dev/sda on a machine whose OS disk is NVMe, with sgdisk refusing every partition as too big for the disk. That /dev/sda is the Focusrite Scarlett's USB storage, which exposes its driver files as a small disk and enumerates ahead of the NVMe.

getHardDisk() now puts USB-transport and removable devices (lsblk TRAN=usb or RM=1) at the back of the pool and leaves them out of the automatic choice, whether that is first-enumerated, largesize=1 or smallsize=1, unless they are the only disks present. Host Primary Disk still matches them by name, so a deliberate USB target keeps working, and a machine whose only disk is USB or an SD card still images.

  • tests/checks/primary-disk-dedup.sh gains a 32 GB USB device enumerated first and cases for each rule: never chosen automatically, last in the pool, matched by name, chosen when alone. Five of eight cases fail on the old code.
  • Full suite: 20 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_0131h4axUaE3VJZphvKRdDby

…disk exists

A USB audio interface that exposes its driver files as a small disk
enumerated as /dev/sda ahead of the NVMe, so a single-disk deploy with
no Host Primary Disk wrote to it and sgdisk refused every partition as
too big for the disk (fogproject #778).

getHardDisk() now puts USB-transport and removable devices at the back
of the pool and leaves them out of the automatic choice, whether that is
first-enumerated, largesize=1 or smallsize=1, unless they are the only
disks present. Host Primary Disk still matches them by name, so a
deliberate USB target keeps working.

tests/checks/primary-disk-dedup.sh gains a USB device enumerated first
and cases for each rule.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0131h4axUaE3VJZphvKRdDby
@mastacontrola
mastacontrola merged commit a23d8e9 into master Sep 2, 2026
2 checks passed
@mastacontrola
mastacontrola deleted the fix/fogproject-778-usb-last branch September 2, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant