statblk
Gather disk and partition information for block devices and print it as a table or JSON.
Supports Linux and macOS.
Install
From PyPI:
pip install statblk
From a clone of this repository:
pip install .
Optional shell tab completion:
pip install 'statblk[completion]'
Requires Python 3.6+. statblk carries a copy of multiCMD (1.70): an installed multiCMD is used when it is at least as new, the copy otherwise.
Quick start
statblk
statblk -j # JSON output (rows, header first)
statblk -J # JSON objects with numeric sizes/rates
statblk -o NAME,SIZE,MOUNTPOINT
statblk sda nvme # filter rows matching sda or nvme
statblk 2 # refresh every 2 seconds (watch mode)
Output columns
By default every column that has data is shown (a column that is empty for every row, such as LABEL when nothing is labelled, is hidden from the table):
| Column | Description |
|---|---|
NAME |
Block device name (device-mapper devices show their /dev/mapper name, e.g. pve-root) |
FSTYPE |
Filesystem type |
SIZE |
Device or filesystem size |
FSUSE% |
Filesystem space used (mounted entries); TIMEOUT for a mount that didn't answer (e.g. dead NFS server), ERROR for one whose statvfs failed (e.g. EIO, a directory you cannot search): both have no SIZE |
MOUNTPOINT |
Mount path |
SMART |
SMART health: OK, STANDBY (spun-down drive, not woken), a failure such as FAILED!, TIMEOUT (smartctl stuck, or an earlier one on the disk still is), or why it couldn't be read (NO SMARTCTL, DENIED, UNKNOWN). Blank for devices without SMART (loop, dm, md, zram, nbd) |
LABEL |
Volume label |
UUID |
Filesystem UUID |
MODEL |
Drive model (from udev via lsblk, sysfs fallback) |
SERIAL |
Drive serial (from udev via lsblk, sysfs fallback) |
DISCARD |
TRIM / discard support |
READ |
Read throughput: the device's since-boot average on the first query, the live rate on later watch refreshes (see READ / WRITE numbers) |
WRITE |
Write throughput, same as READ |
Use -o / --output to select columns (comma-separated) or -x / --exclude to omit columns. Columns named with -o are always shown, even when empty; --show_empty_columns keeps empty columns in the default view. JSON output (-j / -J) always includes every selected column.
READ / WRITE numbers
The first query (a single run, or the first refresh of watch mode) does not show a real-time rate. It shows each device's average since boot: bytes read (or written) since boot divided by the time the kernel spent on reads (or writes) since boot. Idle time is left out, so the number describes the device's work pattern, how fast it typically moves data when it is working, rather than what it is doing at this moment. For example:
- a parity drive that mostly does long sequential syncs and scrubs shows a high READ (e.g. 150 MiB/s) even while it sits idle;
- a snap or disk image written once at install time can show a very high WRITE (e.g. 1 GiB/s), because all of its writes happened in one short burst;
- a device with no I/O since boot shows
0 B/s, so-Aon a single run lists the devices that have done any I/O since boot.
The kernel counts the time of every request separately, so a device with many requests in flight at once (e.g. NVMe under load) reports more busy time than wall-clock time, and its average reads lower than its real transfer speed.
From the second watch refresh on, READ / WRITE are live rates: bytes transferred during the last interval divided by the wall-clock time of that interval. -J gives the same values as bytes per second. READ / WRITE are blank (null in -J) where statblk has none to read: on macOS, for a -P filesystem (it has no device), for a device whose stat cannot be read, and, for the direction whose counter went back (the other keeps its rate), for one refresh after the counter went back between two samples of the device (it was removed and added again under its name in between, or the counter wrapped). A device that /sys/class/block stops listing for one refresh starts over when it returns: it shows its since-boot average again, as the first query does. A device the table only hides keeps its counter: it shows the rate over the last interval (-A and patterns still sample it). -M does not sample an unmounted device: when it is mounted again it shows the rate over the whole gap since its last sample, or its since-boot average if it was never sampled. -D hides a device for the whole run.
Options
Output format
| Flag | Description |
|---|---|
-j, --json |
Print JSON instead of a table (list of rows, header first; values as displayed) |
-J, --json_objects |
Print JSON as a list of objects: SIZE/READ/WRITE in bytes and FSUSE% as an integer (null when unavailable) |
-b, --bytes |
Print sizes and throughput as raw byte counts |
-H, --si |
Use powers of 1000 (SI) instead of 1024 for sizes |
-R, --full |
Do not truncate long values to terminal width |
-o, --output |
Columns to include (default: all with data) |
-x, --exclude |
Columns to omit |
--show_empty_columns |
Keep columns that are empty for every row in the table |
Filtering
| Flag | Description |
|---|---|
filter_patterns … |
Show rows matching any pattern (regex) |
-D, --match_devname_only |
Apply patterns to the device's names only, not to the other cells: its path, its kernel name and the name NAME shows (/dev/sda and sda; a device-mapper device /dev/dm-0, dm-0, /dev/mapper/<name> and <name>): -D sda matches the disk and its partitions, -D '^sda$' and -D '^/dev/sda$' the disk only |
-v, --invert_match |
Invert pattern match: keep the rows where no cell matches (with no pattern, or one that matches every cell such as '' or .*, only the header is left; --check then exits 3) |
-F, -fo, --formated_only |
Only entries with a filesystem type (one whose type could not be read stays, FSTYPE blank) |
-M, -mo, --mounted_only |
Only mounted devices |
-B, -bo, --best_only |
Shortest mount point per device |
-A, -ao, --active_only |
Only devices with read/write activity (since boot on the first query, during the last interval on later watch refreshes); a row whose READ or WRITE could not be read stays (every row on macOS, a -P filesystem, a device whose stat cannot be read or whose counter just went back), and so does a mount whose FSUSE% is ERROR or TIMEOUT |
-P, --pseudo |
Include pseudo filesystems (tmpfs, nfs, cifs, …) |
--show_zero_size_devices |
Include zero-size devices |
--show_squashfs |
Include squashfs images on loop devices (snaps, AppImages), hidden by default |
Runtime
| Flag | Description |
|---|---|
-t, --timeout |
Time budget per refresh in seconds for lsblk, smartctl and statvfs; on macOS, how long diskutil and mount may each go without output (default: 2; fractions allowed; 0: no limit). A command it stops (lsblk, diskutil, mount) is named on stderr, with what it leaves missing, and so is one that is not found or fails (with --check, only when the run exits 1 or 3) |
-w, --watch SECONDS |
Repeat output every SECONDS (watch mode; fractions allowed, e.g. 0.5) |
--check |
Health check: print only the rows that need attention (exit 1 problem, 3 unknown), or print nothing (-j: the header row, -J: []) and exit 0 when healthy; a run left nothing to judge exits 3 with why on stderr (see Health check) |
--max_use PCT |
FSUSE% at or above which --check reports a filesystem (default: 90) |
--sudo |
Run external commands via sudo (needed for SMART on many systems). smartctl is also looked up in /usr/sbin, /sbin, /usr/local/sbin when it isn't on PATH |
--debug |
Print suppressed exceptions to stderr |
-V, --version |
Show version and exit |
Watch mode
Prefer -w / --watch, which also takes fractions. A trailing integer positional still works the same as before (whole seconds only, so a pattern like 0.5 stays a filter):
statblk -w 5 # update every 5 seconds
statblk -w 0.5 # twice a second
statblk 5 # same (trailing integer)
statblk sda 3 # filter to sda, refresh every 3 seconds
statblk -w 3 sda # same with explicit flag (flag wins if both are given)
Each table refresh starts with a watch(1)-style header, Every 2s on <hostname>: <date time>. On a terminal the screen is redrawn in place; when output is piped or redirected every refresh is kept, so the log reads top to bottom. With -j / -J, watch mode prints one compact JSON document per line (NDJSON) so a reader can parse each refresh as it arrives; single-run JSON stays indented.
The first table shows each device's since-boot READ / WRITE average and later refreshes show live rates (see READ / WRITE numbers). After the first refresh, --active_only is enabled automatically so only busy devices are shown (with the rows it keeps anyway: every row on macOS, the -P filesystems, a row whose READ or WRITE could not be read, a mount whose FSUSE% is ERROR or TIMEOUT), unless you gave filter patterns: devices you named stay on screen even while idle. Each refresh re-reads mounts, labels, UUIDs, sizes, and per-drive sysfs info such as model/serial, so hot-swapped drives show up correctly (a device listed at every refresh keeps its live rate; one that /sys/class/block stops listing for a refresh starts over when it returns, see READ / WRITE numbers). Press Ctrl-C to stop (exit status 130).
If a filter pattern looks like a number, append 0 so it is not treated as the refresh interval (or use -w and keep the number as a filter):
statblk nvme0 0 # match nvme0, single run (no watch)
statblk -w 0 nvme0 # same via flag
Health check
--check runs once and prints only the rows that need attention; when everything is healthy it prints nothing (with -j, the header row alone; with -J, []; as in 1.61), so cron only mails on trouble. Exit status:
| Exit | Meaning |
|---|---|
0 |
Healthy (no rows printed). A STANDBY drive counts as healthy: it is checked on the next run that finds it awake |
1 |
Problem: FSUSE% at or above --max_use (default 90) or TIMEOUT (hung mount), or SMART reporting a failure — FAILED!, a vendor failure string, or TIMEOUT (smartctl stuck on the disk) |
3 |
Unknown: no problem found, but SMART couldn't be read on a disk — NO SMARTCTL (install smartmontools), DENIED (run as root or with --sudo) or UNKNOWN (no verdict, e.g. a disk behind a RAID controller) — or a mount's FSUSE% is ERROR (its disk's SMART still counts: a failing one is a problem), or a command that can hide what the check reads did not answer in full (see below), or nothing could be checked: -x leaves out both FSUSE% and SMART, or the table has no row to judge (the filters leave none, or no block device is listed or shown), or no row holds a value in FSUSE% or SMART (said on stderr) |
A problem beats an unknown, and both kinds of rows are listed. A command that did not answer in full (stopped by --timeout, not found, or failed) counts only when the check depends on it: mount on macOS (FSUSE%, and with -M which disks are mounted: the disks it did not list are missing from the table too), or any command when a pattern (not -D) filters the rows (lsblk only when FSTYPE, UUID, MODEL or SERIAL is collected). It is named on stderr, after the rows, only when the run exits 1 or 3. Exit 3 exists so that a check that could not look, or was left nothing to judge, never looks like "healthy" in a sweep. The table decides, not the filters: when no data row is left to judge, the run says Nothing was checked: ... on stderr and exits 3, and the line names the filters in use (-v, a pattern, a -D pattern, -M, -F, -A) or says that no block device is listed or shown. That covers -v with no pattern or one that matches every row (-v "$SKIP" with SKIP empty, -v '.*', -v .: NAME is never blank), a pattern that matches nothing on this host (a typo, -D nvme where there is no NVMe, a disk that is gone), -M with nothing mounted, -A with every device idle, and a host whose /sys/class/block lists no device or cannot be read; -P adds the mounts of pseudo and network filesystems to the table, so each of them is a row to judge, except a mount with zero blocks (/proc, /sys, cgroups), which stays hidden unless --show_zero_size_devices. For a space-only check use -x SMART; to skip a device that has no SMART at all (an SD card, a USB stick) filter it out, e.g. statblk --check -D -v mmcblk. FSUSE% and SMART are always added to the shown columns so you can see why a row failed; excluding one with -x turns that check off, and excluding both leaves nothing to check (exit 3). Filters (-A, -B, -F, -M, -v and patterns) and JSON output (-j / -J) work as usual, but filters narrow what is checked: -M skips disks with no mount of their own (md/LVM/ZFS/Ceph members, extra btrfs pool devices), a pattern skips a disk none of whose rows it matches (-v: a disk all of whose rows it matches), -F skips a disk with no filesystem type (the Mac's own SSD, say), -A skips a device with no read or write activity since boot, so a disk none of whose rows is active goes unjudged, and -B checks each device's FSUSE% at its shortest mount point only, so cluster sweeps should run plain --check. A whole disk that reports a size of zero and has no partition row to show is hidden, and so not checked, unless --show_zero_size_devices (a known limitation, docs/limitations.md; when it is the only device the run exits 3). A row is judged by its values: one whose FSUSE% and SMART are both blank (an unmounted loop, zram or device-mapper device, which has no SMART) is not, so a table where no row holds a value (a host or a filter that leaves only such rows, -x SMART with nothing mounted) says Nothing was checked: no row holds a value in FSUSE% or SMART. (with -x, the one column left) and exits 3; a row with a value beside them (a disk's SMART, a mount's FSUSE%) is judged as before. --check can't be combined with watch mode.
In every mode, Ctrl-C exits 130, and when the reader closes the pipe before statblk has written everything (statblk -w 2 | head) the run ends quietly with 141 (128 + SIGPIPE).
statblk --check || mail -s "disk alert on $(hostname)" ops@example.com # cron
statblk --check -x SMART --max_use 80 # space only
mssh 'nodes[1-64]' 'statblk --check' # whole cluster via multiSSH3
Platform notes
Linux
Uses sysfs, /proc/self/mountinfo, lsblk, and optionally smartctl.
- SMART requires
smartctl(smartmontools). Use--sudoif permission is denied. It only runs against hardware-backed disks (not loop, dm, md, zram, nbd). smartctl runs with-n standby, so spun-down drives are not woken (not even by watch mode); they showSTANDBYuntil they're next awake (also for a SAS disk'sSTANDBY BY TIMER,STANDBY BY COMMANDorLOW POWER). This is verified for SATA drives on the kernel's libata driver; drives behind USB enclosures or some RAID/SAS controllers may still spin up, because smartctl's device-type probe goes through the bridge. On a hardware disk where SMART can't be read the column says why (NO SMARTCTL,DENIED,UNKNOWN;UNKNOWNalso for a disk that/syslists but that has no/devnode, as in a container that sees the host's/sys); it is blank for virtual devices. A smartctl stuck in uninterruptible I/O on a dying disk can't be killed and outlives the refresh (and statblk); while one older than--timeoutis still running on a disk, statblk starts no new one and showsTIMEOUTfor that disk at once, so-wand repeated runs leave at most one per disk (a few for a disk hidden by-Mor a-Dfilter, which statblk never waits on). With--timeout 0this check is off. It sees only processes in statblk's own/proc: withhidepidas a non-root user (--sudo), or in a fresh container, it can't see an earlier stuck smartctl, so run statblk as root on the host, or in hidepid'sgid=group (docs/limitations.md). - squashfs on loop devices (snap packages, AppImages) is hidden by default: these images are read-only and always 100% full. Use
--show_squashfsto list them. Other loop devices, such as a mounted disk image, are always shown. - autofs trigger mounts are ignored (stat-ing them would trigger the automount); the real filesystem appears once mounted.
- READ / WRITE come from
/sys/class/block/*/stat(always 512-byte sector units): a since-boot average on the first query, live rates on later watch refreshes (see READ / WRITE numbers).
macOS
Uses diskutil and mount, found in /usr/sbin and /sbin too when PATH lacks them (cron's does). READ and WRITE are blank (null in -J): macOS has no per-device throughput to read, so -A filters nothing. APFS snapshot nodes such as the sealed system volume (disk3s1s1 on /) are listed. Every device is listed, mounted or not, except one whose size reads 0 (shown with --show_zero_size_devices). DISCARD is diskutil's Solid State.
Upgrading to 1.67 from 1.66
- A spun-down SCSI/SAS disk reads
STANDBYinSMART, and counts as healthy in--check, for each low-power answer smartctl gives under-n standby(STANDBY BY TIMER,STANDBY BY COMMAND,STANDBY_Y BY TIMER,STANDBY_Y BY COMMAND,LOW POWER). 1.66 showedUNKNOWN, so--checkexited 3. - A hardware disk that
/syslists but that has no/devnode here (a container that sees the host's/sysbut none of its device nodes, Docker's default) readsUNKNOWNinSMART, as do its partitions, so--checklists them and exits 3. 1.66 left them blank, which counted as healthy: with-P, or a bind mount that gave a disk anFSUSE%row, the run exited 0 though no disk's SMART was read. A container that checks only its own space runsstatblk --check -x SMART(with-Pfor its overlay root); one given a disk's node and the rights smartctl needs (--device /dev/sda --cap-add SYS_RAWIOfor SATA,--cap-add SYS_ADMINfor NVMe) reads that disk's SMART, for its partitions too, which 1.66 left blank (--check -Mdid not judge the disk).
Upgrading to 1.66 from 1.65
-Dalso matches the nameNAMEshows, not only the device path:-D '^sda$'now finds the disk (1.65 searched/dev/sdaonly, so it found nothing and--checkexited 3),-D '^pve-root$'the device-mapper device. Every pattern that matched in 1.65 still matches; a-D -vpattern can now drop a row that 1.65 kept:-D -v '^s'kept every row (no path starts withs) and now leaves outsdaand its partitions. Under--checka row left out is not judged: such a run can exit 0 where 1.65 reported that disk.--checkexits 3, withNothing was checked: no row holds a value in FSUSE% or SMART.(with-x, the one column left) on stderr, when the table has rows but none holds a value in a checked column: a host, or a filter, that leaves only unmounted loop, zram or device-mapper devices, or-x SMARTwith nothing mounted. 1.65 exited 0. A row with a value beside them (a disk'sSMART, a mount'sFSUSE%) is judged as before. A container lists the host's block devices but, without their/devnodes, reads no SMART (from 1.67 it showsUNKNOWN); to judge its own mounts, add-x SMART -P.
Upgrading to 1.65 from 1.64
--checkexits 3, with a line on stderr (Nothing was checked: ...), when it is left nothing to judge:-xleaves out bothFSUSE%andSMART(whatever-onames), or the table has no row left after the filters (-vwith no pattern or one that matches every row, such as'',.*,.or.+, since NAME is never blank;-Mwith nothing mounted;-Awith every device idle), or no block device is listed or shown (/sys/class/blockempty or not readable, or only a whole disk of size zero;-Padds the mounts of pseudo and network filesystems that have blocks to the table, so each is judged). 1.64 exited 0 without saying that nothing was checked. A pattern that matches nothing on this host (a typo, a disk that is gone) now exits 3 too: 1.64 exited 0.-jand-Jprint what they print for a healthy run (-jthe header row,-J[];[]for-jtoo when-xand-oleave no valid column).- In watch mode, READ or WRITE is blank (
nullin-J) for one refresh after the device's counter went back (the device was removed and added again under its name, or the counter wrapped), where 1.64 showed a negative rate (-Jalready gavenull). A device that/sys/class/blockstops listing for one refresh shows its since-boot average again when it returns, as in 1.64. statblk -w 2 2>>logon a terminal writes a command's note (stopped, not found or failed) to the log once per run, where 1.64 wrote it on every refresh. With stderr on the terminal too, the note still follows each redrawn table.-o ALL(any case) is read as-o all; 1.64 read it as an unknown column and printed an empty table.- The embedded multiCMD is now 1.70. Nothing statblk shows changes.
- Library callers:
get_read_write_rate_throughput_iter()yields None for a direction whose counter went back.
Upgrading to 1.64 from 1.63
- A command that is not found or fails is now named on stderr, with what it leaves missing, and counts in
--checkas one--timeoutstopped does (1.63 counted only a stop):lsblkon Linux,diskutilandmounton macOS. A healthy--checkthat 1.63 passed with exit 0 can now exit 3: on macOS whenmountfails (FSUSE% was not read), and with a pattern (not-D) whenlsblkordiskutilis missing or fails. With--sudo, a missinglsblkreadslsblk failed (exit 1), sudo's own status. The "lsblk not found" note now also shows with-Fand when no row is left. - macOS:
diskutilandmountare also looked up in/usr/sbinand/sbin, which cron'sPATH(/usr/bin:/bin) lacks. Under cron, 1.63 found neither: no SIZE, FSTYPE, UUID or LABEL fromdiskutil, no mounted filesystem, and--checkread no FSUSE%. - macOS: FSTYPE is the word
mountprints (apfs,msdos,exfat,hfs) for unmounted volumes too, where 1.63 showeddiskutil'sAPFSorMS-DOS FAT32, so a pattern matches mounted and unmounted volumes alike. READ and WRITE are blank (nullin-J), not a0 B/sstatblk never measured, so the default table hides them. -F,-Aand the size filters no longer drop a row on a value statblk could not read: on Linux a sysfs size or stat that cannot be read (a device that vanished mid-run) leaves SIZE, or READ and WRITE, blank (nullin-J).-Akeeps the-Prows on Linux, and-A(so watch mode after its first refresh) keeps a mount whose FSUSE% isERRORorTIMEOUT. A failing disk 1.63 hid this way is reported by--check(exit 1).- On Linux a hidden NVMe multipath path node (
nvme3c3n1: no device number, no/devnode, and its namespacenvme3n1is the same disk) is no longer a row, aslsblkdoes not list it. - Mount points: on macOS a
-Pshare whose source has a space is listed, and a volume whose mount point holds " (" gets its FSUSE% (1.63:ERROR, so--checkexited 3); on Linux so does a mount point that is not UTF-8, or not ASCII under Python 3.6 in the C locale (EL8's). An SMB or CIFS source shows as//server/share(1.63:/server/share). - The embedded multiCMD is now 1.68. On a terminal that reports no size (0 columns:
scriptwith no terminal of its own, some CI runners) the table fits 80 columns, orCOLUMNS; 1.63 cut every column to its heading's width there. Through a pipe nothing changes. - Library callers:
get_drives_info()takesunanswered=, a dict that gets each command that did not answer in full with its return code (124 stopped, 127 not found, other failed);cut=still gets the stopped ones.parseMount()takesunanswered=in place ofcut=,get_macos_diskutil_info()in place ofcut=andfailed=,find_smartctl()isfind_command(name),SMARTCTL_FALLBACK_DIRSisSBIN_DIRS, andLSBLK_MISSING_NOTEis gone.
Upgrading to 1.63 from 1.62
- macOS: every device is listed, mounted or not (except one whose size reads 0), with the SIZE and FSTYPE of an unmounted device, and the UUID, LABEL and DISCARD, from
diskutil. On macOS 26, 1.62 read only the first of the sectionsdiskutil info -allprints for each device, so a disk with no mounted filesystem (such as the internal SSD'sdisk0) was not listed, and--checkdid not see its SMART.--checknow judges it: one whose SMART cannot be read (an unmounted USB disk, a disk image) exits 3 where 1.62 did not list it. - A row is no longer dropped on a value statblk could not read (not run, stopped or failed), except
-Mwith a stoppedmount(the disks it did not list go, and stderr says so) and the cases in docs/limitations.md, where a source that failed without being stopped, or a size that reads 0, still hides a row. On macOS a devicediskutilgave no size is listed with SIZE blank (a size of 0 still hides it), and-Afilters nothing (1.62 listed no device).-Fkeeps a device whose filesystem type could not be read (nolsblk, a stopped or failedlsblkordiskutil, a stoppedmount), with FSTYPE blank. A mount whosestatvfsfails (EIO, a directory you cannot search) is listed with SIZE blank and FSUSE%ERROR(-J:null), where 1.62 dropped it as a size of 0. --checkexit codes: a failing disk 1.62 hid that way is reported (exit 1, where 1.62 gave 0 or 3). A mount with FSUSE%ERRORexits 3, or 1 when its disk's SMART fails. A stoppeddiskutil, or a stoppedlsblkwith-F, no longer turns a healthy run unknown: it exits 0 and prints nothing, where 1.62 exited 3. A stoppedmounton macOS, and any stopped command with a pattern (not-D), still count as before.- On macOS the LABEL and UUID, and the FSTYPE of an unmounted device, now come from
diskutil, so a pattern matches more text than in 1.62: it can keep rows 1.62 dropped, and-vcan drop rows 1.62 kept. - The stderr notes for a stopped
diskutiland for a missing or stoppedlsblksay what is left blank.
Upgrading to 1.62 from 1.61
- The embedded multiCMD is now 1.67. It runs whenever the installed multiCMD is older than 1.67, missing, or fails to import. Nothing statblk shows changes.
- A command
--timeoutstopped is now named on stderr, after the table or JSON and once per run in-w(under each table when it is redrawn on a terminal):lsblk(Linux, when FSTYPE, UUID, MODEL or SERIAL is shown, or-Fneeds FSTYPE),diskutilormount(macOS), with what it leaves missing. 1.61 said nothing. In--check, one that can hide what the check reads makes a run with no problem exit 3, where 1.61 exited 0 (Health check says which); a healthy run exits and prints as in 1.61, and a run that exits 1 or 3 also names each stopped command. - On Python 3.6 (EL7, EL8), a Ctrl-C that landed just as statblk started a filesystem's statvfs thread could hang
statblk -wfor good. It now exits 130. - pip no longer installs multiCMD for statblk. With pip 9 (EL7, EL8) and multiCMD 1.57 or older installed,
pip3 install -U statblkstopped withconfigparser.DuplicateOptionError. A multiCMD installed only for statblk can stay or go.
Upgrading to 1.61 from 1.60
- On macOS,
-t 0now givesdiskutilandmountno limit, as it already did forsmartctlandstatvfs. Before,diskutilgot 4 s andmount1 s, so a slow one left SIZE, FSTYPE, MOUNTPOINT and other columns blank. - On macOS, a non-zero
-tnow limitsmounttoo. It gets--timeout(2 s by default), where it always got 1 s.diskutilgets--timeout, as before. Both limits count time without output. - Library callers:
get_drives_info()with notimeoutnow waits without limit for every command. In 1.60 it printed aTypeErrortraceback and left the lsblk columns blank on Linux, and on macOS gavediskutil4 s andmount1 s. - The embedded multiCMD is now 1.61. It runs whenever the installed multiCMD is older than 1.61, so multiCMD itself need not be upgraded.
- On Python 3.6 to 3.10, a Ctrl-C that stops a command just as it starts no longer crashes the Python that starts it. On 3.6 and 3.7 that crash left a core dump, which abrt or systemd-coredump then reported.
- On Python 3.6 to 3.10, a Ctrl-C while
diskutilormountstarts on macOS no longer leaves that command running after statblk ends. - A first Ctrl-C that lands in the few milliseconds when statblk starts
lsblkorsmartctlis now dropped a little more often (about 1 in 700 of those, against 1 in 1,400). Python prints "Exception ignored". Press Ctrl-C again.
Upgrading to 1.60 from 1.59
-t 0now waits forlsblkwith no limit, as it already did forsmartctl. Before, it did not wait at all, so a slowlsblkcould leave SERIAL and otherlsblkcolumns blank. With a limit,lsblknow gets what is left of the refresh's--timeout, not a fresh--timeoutof its own.- The embedded multiCMD is now 1.58: no change to how commands run. The embedded copy also runs when the installed multiCMD fails to import in any way, not only when it is older or missing. multiCMD itself need not be upgraded.
Upgrading to 1.59 from 1.58
- The embedded multiCMD is now 1.57. It runs whenever the installed multiCMD is older, so multiCMD itself need not be upgraded.
- Faster command starts on Python 3.6 - 3.10, where the embedded multiCMD 1.57 imports only built-in modules in the wrapper that puts each command in its own process group (about 7 ms to 3.5 ms of CPU per command on Python 3.6.8). Nothing else about starting a command changes.
Upgrading to 1.58 from 1.57
- On Linux, a disk whose earlier smartctl is still stuck (older than
--timeout, from a previous refresh, run, cron job or another tool) now showsTIMEOUTat once and gets no new smartctl.statblk -wand repeated runs leave at most one stuck smartctl per disk instead of one per refresh (a few for a disk hidden by-Mor a-Dfilter, which statblk never waits on), and the refresh no longer waits out--timeoutfor that disk. macOS and--timeout 0are unchanged.
Upgrading to 1.57 from 1.56
- multiCMD 1.56 or newer is required (the embedded copy is 1.56).
- With no
lsblkinstalled, the "lsblk not found" note now goes to stderr after the table, not before it: once per run, and under every table while-wredraws a terminal, so it no longer vanishes at once. It also shows with--sudonow. - A reader that closes the pipe early (
statblk | head) now ends the run with exit status 141 (128 + SIGPIPE), not 1, so it can't be mistaken for--check's "problem". --debugno longer prints the "smartctl not found" hint; the SMART column already saysNO SMARTCTL.- Library callers:
get_drives_infono longer prints the lsblk note, andcache_decorator,clear_cachesanddebug_msgare gone.
Development
Install test deps:
pip install -r requirements-dev.txt
Run unit tests (default; live excluded) and embedded doctests:
pytest
python -m doctest statblk.py -v
python statblk.py --doctest
Optional live checks:
pytest -m live # soft smoke on this host
pytest -m live_strict # compare FSUSE% and names to df/lsblk
License
GPLv3+ — Yufei Pan (pan@zopyr.us)
Project home: github.com/yufei-pan/statblk
Metadata
Release files for statblk 1.67
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| statblk-1.67.tar.gz | 134.5 kB | Without provenance | Details for statblk-1.67.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| statblk-1.67-py3-none-any.whl | Python 3 | none | any | Details for statblk-1.67-py3-none-any.whl |
Total release size: 204.1 kB
Release files / statblk-1.67.tar.gz
| Download URL | statblk-1.67.tar.gz |
|---|---|
| Size | 134.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d70f4d4356ac600f36c9e1bf29a2f66fcd7009656ab8ed51d39976bee8215654
|
|
BLAKE2b-256 checksum How to use checksums |
01c27117fecbbbaeca90d4b26b45df781a07e5ea1bab9a641944808128f25419
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / statblk-1.67-py3-none-any.whl
| Download URL | statblk-1.67-py3-none-any.whl |
|---|---|
| Size | 69.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb1fbb2ca696fd6c4fe6d7cfdf4c96a572da6285baf9d03d3282a41443caba0e
|
|
BLAKE2b-256 checksum How to use checksums |
3d6c3d8a6f3db6c9d12849da07a7966646837e6054576d9eb2eb339eda7a8824
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for statblk 1.67
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.