Skip to content

fix(macos): keep mounted disk images out of both disks and volumes - #3

Merged
kerwin2046 merged 2 commits into
mainfrom
fix/macos-disk-image-filter
Sep 29, 2026
Merged

kerwin2046 merged 2 commits into
mainfrom
fix/macos-disk-image-filter

Conversation

@yuxino

@yuxino yuxino commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #2

Problem

On macOS, systeminformation reports mounted disk images — installed app DMGs, the Xcode / iOS Simulator volume, any open .dmg — alongside real drives. They come back with type: "Disk Image" and were treated as hardware, so a single-SSD Mac was drawn with nine drives and the app warned about disks that do not exist.

3D view before/after

Annotated — every red box is a phantom entry, in the 3D view and in the parts list:

annotated

Change

diskLayout is filtered once, and that same set of devices is reused to skip the matching filesystems in fsSize:

const DISK_IMAGE_TYPE = "Disk Image";

// ... keep them out of the 3D scene and the parts list
.filter((d) => d.type !== DISK_IMAGE_TYPE)

// ... and out of `volumes`, which drives the insights panel
const diskImageDevices = (data.diskLayout as si.Systeminformation.DiskLayoutData[])
  .filter((d) => d.type === DISK_IMAGE_TYPE && d.device)
  .map((d) => `/dev/${d.device}`);
...
if (diskImageDevices.some((dev) => fs.fs === dev || fs.fs.startsWith(`${dev}s`))) continue;

The devices line up exactly: a diskLayout entry with device: "disk6" corresponds to the fsSize entry /dev/disk6s1, which is the iOS Simulator volume.

The right-hand panel

The first commit here only filtered diskLayout. That fixed the 3D view and the parts list, but the "System check" panel kept complaining, because it is driven by volumes, which was untouched:

System check before/after

volumes goes from 18 to 10 on this machine, and the five "is running out of space" warnings disappear. (The paths in the BEFORE panel are blacked out because they name the local apps that were mounted.)

Tested

  • macOS — disks 9 → 1, volumes 18 → 10; /Volumes/, CoreSimulator and running out of space no longer appear anywhere in the rendered page.
  • pnpm typecheck passes.
  • Windows / Linux — type: "Disk Image" never occurs there, so both filters match nothing and behaviour is unchanged.

systeminformation's diskLayout also returns mounted disk images on macOS
(DMG app volumes, the iOS Simulator volume, open .dmg files) with
type "Disk Image". Every entry became an SSD in the 3D scene, so a
single-SSD Mac was drawn with nine drives.

Filter those entries out where the disk list is built. No rendering code
changes; on Windows/Linux the filter matches nothing.

Refs #2
Filtering diskLayout fixed the 3D scene and the parts list, but the
insights panel is driven by volumes, which still held every mounted disk
image — so the right-hand "System check" panel warned about disks that
do not exist.

diskLayout already tells us which /dev nodes are disk images, so reuse
that to skip the matching filesystems.
@yuxino yuxino changed the title fix(macos): don't render mounted disk images as physical drives fix(macos): keep mounted disk images out of both disks and volumes Sep 29, 2026
@kerwin2046
kerwin2046 merged commit e695c49 into main Sep 29, 2026
0 of 2 checks passed
@kerwin2046

Copy link
Copy Markdown
Owner

@yuxino Thanks a lot for taking the time to investigate this and submit a fix! 🙌

Really appreciate the detailed investigation and testing, especially the part about filtering both diskLayout and fsSize. This makes PC·XRAY much more accurate on macOS.

Thanks for contributing to the project! 🚀

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.

macOS: mounted disk images (DMGs, Simulator volumes) show up as extra drives

2 participants