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>
For raw output used in scripts it is sometimes necessary
to reconstruct tree of devices.
Parent kernel name (PKNAME) provides needed information
to do that easily.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Partitions are incorrectly marked with 'disk' type on
lsblk output while it should be marked as 'part' type.
Before:
$ lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-sda1 8:1 0 64M 0 disk
With this patch applied:
$ lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-sda1 8:1 0 64M 0 part
Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
As blkid_devno_to_wholedisk returns parent dm device for
a partition mapping, the condition used in lsblk incorrectly
checked the parent-child relationship.
In this particular case, we need to process the dm partition
mapping like any other non-partition device as dm devices always
use proper holders/slaves sysfs hierarchy instead of
/sys/block/<parent>/<name> that is used for real partitions.
Example (test1 is a partition mapping and sdb1 is a real partition):
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-test (dm-0) 253:0 0 128M 0 dm
`-test1 (dm-1) 253:1 0 127M 0 part
sdb 8:16 0 128M 0 disk
`-sdb1 8:17 0 127M 0 disk
Before this patch (test1 skipped!):
$ lsblk -s /dev/mapper/test1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
test (dm-0) 253:0 0 128M 0 dm
`-sda 8:0 0 128M 0 disk
$ lsblk -s /dev/sdb1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb1 8:17 0 127M 0 disk
`-sdb 8:16 0 128M 0 disk
With this patch (test1 processed correctly):
$ lsblk -s /dev/mapper/test1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
test1 (dm-1) 253:1 0 127M 0 part
`-test (dm-0) 253:0 0 128M 0 dm
`-sda 8:0 0 128M 0 disk
$ lsblk -s /dev/sdb1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb1 8:17 0 127M 0 disk
`-sdb 8:16 0 128M 0 disk