2021-04-09 10:36:42 -07:00
|
|
|
[Home](https://kellyjonbrazil.github.io/jc/)
|
2022-01-25 17:07:47 -08:00
|
|
|
<a id="jc.parsers.blkid"></a>
|
2020-07-30 16:20:24 -07:00
|
|
|
|
2020-02-27 20:21:02 -08:00
|
|
|
# jc.parsers.blkid
|
2022-01-25 17:07:47 -08:00
|
|
|
|
2022-03-04 13:27:39 -08:00
|
|
|
jc - JSON Convert `blkid` command output parser
|
2020-02-27 20:21:02 -08:00
|
|
|
|
2020-08-05 13:31:52 -07:00
|
|
|
Usage (cli):
|
2020-02-27 20:21:02 -08:00
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
$ blkid | jc --blkid
|
2020-08-05 16:51:58 -07:00
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
or
|
2020-08-05 16:51:58 -07:00
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
$ jc blkid
|
2020-02-27 20:21:02 -08:00
|
|
|
|
2020-08-05 13:31:52 -07:00
|
|
|
Usage (module):
|
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
import jc
|
|
|
|
result = jc.parse('blkid', blkid_command_output)
|
2022-01-18 14:18:12 -08:00
|
|
|
|
2021-04-08 11:24:02 -07:00
|
|
|
Schema:
|
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"device": string,
|
|
|
|
"uuid": string,
|
|
|
|
"type": string,
|
|
|
|
"usage": string,
|
|
|
|
"part_entry_scheme": string,
|
|
|
|
"part_entry_type": string,
|
|
|
|
"part_entry_flags": string,
|
|
|
|
"part_entry_number": integer,
|
|
|
|
"part_entry_offset": integer,
|
|
|
|
"part_entry_size": integer,
|
|
|
|
"part_entry_disk": string,
|
|
|
|
"id_fs_uuid": string,
|
|
|
|
"id_fs_uuid_enc": string,
|
|
|
|
"id_fs_version": string,
|
|
|
|
"id_fs_type": string,
|
|
|
|
"id_fs_usage": string,
|
|
|
|
"id_part_entry_scheme": string,
|
|
|
|
"id_part_entry_type": string,
|
|
|
|
"id_part_entry_flags": string,
|
|
|
|
"id_part_entry_number": integer,
|
|
|
|
"id_part_entry_offset": integer,
|
|
|
|
"id_part_entry_size": integer,
|
|
|
|
"id_iolimit_minimum_io_size": integer,
|
|
|
|
"id_iolimit_physical_sector_size": integer,
|
|
|
|
"id_iolimit_logical_sector_size": integer,
|
|
|
|
"id_part_entry_disk": string,
|
|
|
|
"minimum_io_size": integer,
|
|
|
|
"physical_sector_size": integer,
|
|
|
|
"logical_sector_size": integer
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
$ blkid | jc --blkid -p
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"device": "/dev/sda1",
|
|
|
|
"uuid": "05d927ab-5875-49e4-ada1-7f46cb32c932",
|
|
|
|
"type": "xfs"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"device": "/dev/sda2",
|
|
|
|
"uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
|
|
|
"type": "LVM2_member"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"device": "/dev/mapper/centos-root",
|
|
|
|
"uuid": "07d718ff-950c-4e5b-98f0-42a1147c77d9",
|
|
|
|
"type": "xfs"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"device": "/dev/mapper/centos-swap",
|
|
|
|
"uuid": "615eb89a-bcbf-46fd-80e3-c483ff5c931f",
|
|
|
|
"type": "swap"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
$ sudo blkid -o udev -ip /dev/sda2 | jc --blkid -p
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
|
|
|
"id_fs_uuid_enc": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
|
|
|
"id_fs_version": "LVM2\\x20001",
|
|
|
|
"id_fs_type": "LVM2_member",
|
|
|
|
"id_fs_usage": "raid",
|
|
|
|
"id_iolimit_minimum_io_size": 512,
|
|
|
|
"id_iolimit_physical_sector_size": 512,
|
|
|
|
"id_iolimit_logical_sector_size": 512,
|
|
|
|
"id_part_entry_scheme": "dos",
|
|
|
|
"id_part_entry_type": "0x8e",
|
|
|
|
"id_part_entry_number": 2,
|
|
|
|
"id_part_entry_offset": 2099200,
|
|
|
|
"id_part_entry_size": 39843840,
|
|
|
|
"id_part_entry_disk": "8:0"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
$ sudo blkid -ip /dev/sda1 | jc --blkid -p -r
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"devname": "/dev/sda1",
|
|
|
|
"uuid": "05d927bb-5875-49e3-ada1-7f46cb31c932",
|
|
|
|
"type": "xfs",
|
|
|
|
"usage": "filesystem",
|
|
|
|
"minimum_io_size": "512",
|
|
|
|
"physical_sector_size": "512",
|
|
|
|
"logical_sector_size": "512",
|
|
|
|
"part_entry_scheme": "dos",
|
|
|
|
"part_entry_type": "0x83",
|
|
|
|
"part_entry_flags": "0x80",
|
|
|
|
"part_entry_number": "1",
|
|
|
|
"part_entry_offset": "2048",
|
|
|
|
"part_entry_size": "2097152",
|
|
|
|
"part_entry_disk": "8:0"
|
|
|
|
}
|
|
|
|
]
|
2022-01-25 17:07:47 -08:00
|
|
|
|
|
|
|
<a id="jc.parsers.blkid.parse"></a>
|
|
|
|
|
2022-03-05 12:15:14 -08:00
|
|
|
### parse
|
2022-01-25 17:07:47 -08:00
|
|
|
|
2020-02-27 20:21:02 -08:00
|
|
|
```python
|
2022-01-25 17:07:47 -08:00
|
|
|
def parse(data, raw=False, quiet=False)
|
2020-02-27 20:21:02 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
Main text parsing function
|
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
Parameters:
|
2020-02-27 20:21:02 -08:00
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
data: (string) text data to parse
|
|
|
|
raw: (boolean) unprocessed output if True
|
|
|
|
quiet: (boolean) suppress warning messages if True
|
2020-02-27 20:21:02 -08:00
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
Returns:
|
2020-02-27 20:21:02 -08:00
|
|
|
|
2022-01-25 18:03:34 -08:00
|
|
|
List of Dictionaries. Raw or processed structured data.
|
2020-02-27 20:21:02 -08:00
|
|
|
|
2022-01-25 19:18:54 -08:00
|
|
|
### Parser Information
|
2021-04-09 10:36:42 -07:00
|
|
|
Compatibility: linux
|
|
|
|
|
2022-07-16 20:52:19 -07:00
|
|
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|