Skip to content
jc-rs
GitHub

lsblk

--lsblkv1.0.0

Converts `lsblk` command output to JSON

Linuxcommandslurpable
$ lsblk | jc-rs --lsblk

A real pair

From the reference corpus (centos-7.7/lsblk.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

lsblkcentos-7.7
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part 
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sr0              11:0    1 1024M  0 rom  
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "name": "sda",
    "maj_min": "8:0",
    "rm": false,
    "size": "20G",
    "ro": false,
    "type": "disk",
    "mountpoint": null,
    "size_bytes": 21474836480
  },
  {
    "name": "sda1",
    "maj_min": "8:1",
    "rm": false,
    "size": "1G",
    "ro": false,
    "type": "part",
    "mountpoint": "/boot",
    "size_bytes": 1073741824
  },
  {
    "name": "sda2",
    "maj_min": "8:2",
    "rm": false,
    "size": "19G",
    "ro": false,
    "type": "part",
    "mountpoint": null,
    "size_bytes": 20401094656
  },
  {
    "name": "centos-root",
    "maj_min": "253:0",
    "rm": false,
    "size": "17G",
    "ro": false,
    "type": "lvm",
    "mountpoint": "/",
    "size_bytes": 18253611008
  },
  {
    "name": "centos-swap",
    "maj_min": "253:1",
    "rm": false,
    "size": "2G",
    "ro": false,
    "type": "lvm",
    "mountpoint": "[SWAP]",
    "size_bytes": 2147483648
  },
  {
    "name": "sr0",
    "maj_min": "11:0",
    "rm": true,
    "size": "1024M",
    "ro": false,
    "type": "rom",
    "mountpoint": null,
    "size_bytes": 1073741824
  }
]

Guides using this parser

Fixture coverage

4/4oracle-valid pairs match under the published structural JSON comparison

Magic syntax

jc-rs lsblkjc-rs runs the command itself and parses what it prints. Recognised for: `lsblk`

Source: crates/jc-rs-parsers/src/disk/lsblk.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare