The code only lists partitions, but ignore another dependencies
on whole-disk device:
$ lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 298.1G 0 disk
└─sdb1 8:17 0 298.1G 0 part
$ ls /sys/block/sdb/holders/
dm-0
fixed version:
$ lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 298.1G 0 disk
├─sdb1 8:17 0 298.1G 0 part
└─mpatha 253:0 0 298.1G 0 mpath
└─mpatha1 253:1 0 298.1G 0 part
Signed-off-by: Karel Zak <kzak@redhat.com>
For multi-path devices kernel defines dependence between the device
and whole-list:
$ ls /sys/block/dm-0/slaves/
sdb
but lsblk inserts partition into the tree:
$ lsblk -s -oNAME,KNAME /dev/dm-1
mpatha1 dm-1
└─mpatha dm-0
└─sdb1 sdb1 <--- !
└─sdb sdb
Signed-off-by: Karel Zak <kzak@redhat.com>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
The current code does not check size of the columns[] array when add
the next on command line specified column. We check the array size for
"-o <columns>" but not for another options.
Old version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
xargs: lsblk: terminated by signal 11
new version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
lsblk: too many columns specified, the limit is 83 columns.
Signed-off-by: Karel Zak <kzak@redhat.com>
Introduced in 642048e4:
$ lsblk -o SIZE /dev/loop1
lsblk: the sort column has to be between output columns.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This implementation allow to sort output by arbitrary output column.
Note that output is always converted to human readable strings, but
sort functions in many cases work with original data (stored as
private data to cells by scols_cell_set_userdata()).
Signed-off-by: Karel Zak <kzak@redhat.com>
Simple command line for gathering information as many as possible is
useful when understanding a system, especially when trouble shooting.
This patch introduces -O option which enables all available columns.
[kzak@redhat.com: - define collisions between options,
- define columns when parse argv[]]
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* rename flags functions to scols_table_enable_*
* rename *_no_foo() functions to _nofoo()
* output formats are mutually exclusive, so don't use flags there
* don't assume symbols in scols_new_table(), use scols_table_set_symbols()
Signed-off-by: Karel Zak <kzak@redhat.com>
The device (for example LVM logical volume) could be renamed and then
the device name from /proc/self/mountinfo does not match with reality.
So, we also need to check devno. Unfortunately we cannot completely
rely on devno, because for example btrfs uses psudo device numbers.
References: https://bugzilla.redhat.com/show_bug.cgi?id=980463
Signed-off-by: Karel Zak <kzak@redhat.com>
Patch adds "SCSI transport layer" similar attribute to "lsscsi -t".
This is useful for script where you want to distinguish e.g. FC, iSCSI
or USB devices from local disks.
Detection logic is quite simplified in comparison to lsscsi but it
should provide the same output (except detailed transport attributes).
Signed-off-by: Milan Broz <mbroz@redhat.com>
For block devices it is sometimes useful to print SCSI device ID"
Host:Channel:Target:LUN.
Patch adds column name HCTL which can be used in lsblk.
Signed-off-by: Milan Broz <mbroz@redhat.com>