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
Allow printing of queue/add_random attribute which describes
if device adds randomness to kernel RNG pool.
Signed-off-by: Milan Broz <mbroz@redhat.com>
* read WWN from udev DB
* use *_ENC properties from udev DB to get original unmodified
strings (otherwise for example blank space is replaced with '_' in
ID_FS_LABEL)
* always read from udev, libblkid is fallback solution only
Signed-off-by: Karel Zak <kzak@redhat.com>
* '2012wk24' of git://github.com/kerolasa/lelux-utiliteetit: (24 commits)
more: fix pointer wrap around compiler warnings
more: fix search repetition regression
lscpu: values in /proc/bus/pci/devices are always unsigned
scriptreplay: fix compiler format warning
lib/mbsalign: abort() when non-expected case is encountered
mkfs.cramfs: disallow unknown command line options
fsck.cramfs: disallow unknown command line options
setarch: disallow unknown command line options
hexdump: print sensible message when all input file arguments fail
mount: (new) use exclusive_option()
dmesg: use exclusive_option()
wipefs: use exclusive_option()
wdctl: correct manual section reference
wdctl: use exclusive_option()
prlimit: use exclusive_option()
lscpu: use exclusive_option()
losetup: use exclusive_option()
chcpu: use exclusive_option()
lsblk: use exclusive_option()
findmnt: use exclusive_option()
...
This commit fixes exclusions which where meant to happen, but where not
successful. For example
lsblk -r -l # did exclude
lsblk -l -r # did not exclude
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Replace inline version of similar, but less complete, functionality
with the lib/blkdev.c function. The function will inform if a type is
unknown, which appears as hex string value.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Note that lib/tt.c will never truncate columns without TT_FL_TRUNC or
relative column width. So it's fine to set small width for columns
with SIZEs, the defined width is minimal width.
Signed-off-by: Karel Zak <kzak@redhat.com>
$ lsblk --inverse -o NAME /dev/dm-0
NAME
luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0)
└─sda6
└─sda
Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
$ lsblk -P -o NAME /dev/dm-0
NAME="luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0)"
the (dm-0) sucks in the parsable output...
Reported-by: Peter Rajnoha <prajnoha@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
If you mark a column with TT_FL_NOEXTREMES flag then extremely
large fields will no have effect to column width. Foe example:
without the TT_FL_NOEXTREMES flag for the 'AAA' column:
AAA BBB CCC DDD
aa bbb ccc ddd
aaaaaaaaaaa bb ccc ddd
aa bb ccc ddd
aa bb ccc ddd
with the flags:
AAA BBB CCC DDD
aa bbb ccc dddddddddd
aaaaaaaaaaa
bb ccc dddddddd
aa bb ccc dddddd
aa bb ccc ddddddddd
Signed-off-by: Karel Zak <kzak@redhat.com>