lllm3090.storage#

Which physical disk backs a path, and whether a faster one is going spare.

Where the checkpoints live is not a detail. A cold load reads the whole file before the engine answers, and on the reference machine the same 18.2 GB checkpoint takes 62 s from a SATA SSD and 15-26 s from a Gen4 NVMe – with a floor of about 10 s that is dequantisation and the VRAM upload and that no disk can help with.

That gap is invisible from inside the program: ~/models looks the same on either, df reports the same free space, and the symptom is “switching models feels slow” with nothing in the log. So it is checked at setup, once, when there is still a decision to make.

Everything here reads /sys rather than shelling out to lsblk or findmnt, so it works in a container that has neither.

lllm3090.storage.SYS_DEV_BLOCK = PosixPath('/sys/dev/block')#

Where the kernel maps device numbers to devices.

lllm3090.storage.SYS_BLOCK = PosixPath('/sys/block')#

Where whole disks are listed.

lllm3090.storage.nearest_existing(path: Path | str) → Path | None[source]#

The closest ancestor of path that exists, or path itself.

A directory that has not been created yet still has a filesystem: it is whichever one holds its parent. Without this the check is useless in the only situation it was written for – a fresh install, where ~/models does not exist, every question about it answers “cannot tell”, and the warning stays silent on exactly the machine that needed it.

lllm3090.storage.backing_disk(path: Path | str, sys_root: Path | None = None) → str | None[source]#

Kernel name of the whole disk behind path – nvme0n1, sda.

A path that does not exist yet is classified by the nearest ancestor that does, because that is the filesystem it will be created on.

None when there is no block device to name: a network mount, a tmpfs, or a path with no existing ancestor at all. Callers must treat that as “cannot tell” rather than as “slow”, because refusing to proceed on a filesystem this cannot classify would break every container and NFS home directory.

lllm3090.storage.is_nvme(disk: str | None) → bool[source]#

Whether a disk name is an NVMe device.

lllm3090.storage.nvme_disks(sys_root: Path | None = None) → list[str][source]#

Every NVMe whole-disk this machine has.

lllm3090.storage.writable_mount_on(disk: str, sys_root: Path | None = None) → Path | None[source]#

A directory the user can write to that is backed by disk.

Used only to make the advice actionable – naming a device is no help if the reader then has to work out where it is mounted. Returns the first candidate that is on the right disk, preferring one already writable.

lllm3090.storage.free_gb(path: Path | str) → float[source]#

Free space on the filesystem that holds – or will hold – path.

lllm3090.storage.slow_disk_warning(models_dir: Path, sys_root: Path | None = None) → str | None[source]#

Why this models directory is on the wrong disk, or None if it is fine.

Fine means any of: it is already on an NVMe, the machine has no NVMe to move to, or the filesystem cannot be classified at all. Only a machine that has a faster disk and is not using it has a problem worth stopping for.