Difference between revisions of "Lsblk"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<code>lsblk</code><ref>http://man7.org/linux/man-pages/man8/lsblk.8.html</ref>, included in [[w:util-linux|util-linux]] package, list block devices including [[Hard disk drive]] and [[SDD]] devices.
+
{{lc}}
 +
<code>lsblk</code><ref>http://man7.org/linux/man-pages/man8/lsblk.8.html</ref>, included in <code>[[util-linux]]</code> package, list block devices including [[Hard disk drive]] and [[SDD]] devices.
  
 +
lsblk
 +
lsblk -io KNAME,TYPE,SIZE,MODEL,[[UUID]]
 +
lsblk -io KNAME,TYPE,SIZE,MODEL,[[UUID]],[[LABEL]]
 +
lsblk -S
 +
 +
== Examples ==
 
<pre>
 
<pre>
 
lsblk
 
lsblk
Line 10: Line 17:
 
sr0      11:0    1  52K  0 from
 
sr0      11:0    1  52K  0 from
 
</pre>
 
</pre>
 +
 +
lsblk
 +
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
 +
nvme0n1      259:0    0  200G  0 disk
 +
├─nvme0n1p1  259:2    0  200G  0 part /
 +
└─nvme0n1p128 259:3    0    1M  0 part
 +
nvme1n1      259:1    0  500G  0 disk /mnt/ext
 +
  
 
<pre>
 
<pre>
Line 36: Line 51:
  
  
<pre>
 
lsblk -S
 
NAME HCTL      TYPE VENDOR  MODEL            REV TRAN
 
sda  0:0:0:0    disk ATA      CT210MX501SSD4  023  sata
 
sdb  1:0:0:0    disk ATA      WDC WDS100T2B0A- 90WD sata
 
sdc  3:0:0:0    disk ATA      WDC WDS100T2B0A- 90WD sata
 
sdd  6:0:0:0    disk WD      My Book 15xE    4004 usb
 
  
lsblk -S
+
lsblk -S
NAME HCTL      TYPE VENDOR  MODEL            REV TRAN
+
NAME HCTL      TYPE VENDOR  MODEL            REV TRAN
sdb  2:1:0:0    disk HPE      LOGICAL VOLUME  1.66 sas
+
sda  0:0:0:0    disk ATA      CT210MX501SSD4  023  [[sata]]
sdc  2:1:0:1    disk HPE      LOGICAL VOLUME  1.66 sas
+
sdb  1:0:0:0    disk ATA      WDC WDS100T2B0A- 90WD sata
sdd  1:0:0:0    disk NETAPP  LUN C-Mode      9600 fc
+
sdc  3:0:0:0    disk ATA      WDC WDS100T2B0A- 90WD sata
sde  1:0:0:1    disk NETAPP  LUN C-Mode      9600 fc
+
sdd  6:0:0:0    disk WD      My Book 15xE    4004 usb
 +
 
 +
lsblk -S
 +
NAME HCTL      TYPE VENDOR  MODEL            REV TRAN
 +
sdb  2:1:0:0    disk HPE      LOGICAL VOLUME  1.66 [[sas]]
 +
sdc  2:1:0:1    disk HPE      LOGICAL VOLUME  1.66 sas
 +
sdd  1:0:0:0    disk NETAPP  LUN C-Mode      9600 fc
 +
sde  1:0:0:1    disk NETAPP  LUN C-Mode      9600 fc
  
 
-S, --scsi Output info about SCSI devices only
 
-S, --scsi Output info about SCSI devices only
Line 83: Line 98:
 
  lsblk -o NAME,[[ROTA]]
 
  lsblk -o NAME,[[ROTA]]
  
 
+
<pre>
 +
lsblk
 +
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
 +
sda            8:0    1  14.9G  0 disk
 +
└─sda1          8:1    1  14.9G  0 part
 +
nvme0n1      259:0    0 465.8G  0 disk
 +
├─nvme0n1p1  259:1    0    1M  0 part
 +
├─nvme0n1p2  259:2    0  244M  0 part /boot/efi
 +
├─nvme0n1p3  259:3    0  488M  0 part /boot
 +
└─nvme0n1p4  259:4    0  465G  0 part
 +
  ├─main-root 253:0    0  11.2G  0 lvm  /
 +
  ├─main-swap 253:1    0  1.9G  0 lvm  [SWAP]
 +
  └─main-srv  253:2    0  452G  0 lvm  /srv
 +
</pre>
  
 
== Activitites ==
 
== Activitites ==
Line 92: Line 120:
 
== Related commands ==
 
== Related commands ==
 
* <code>[[wipefs]]</code>
 
* <code>[[wipefs]]</code>
 +
* <code>[[blkid]]</code>
 +
* <code>[[ssacli ctrl all show config]]</code>
 +
* <code>[[mkfs]]</code>
 +
* [[swap]]
 +
* [[mount]], <code>[[/etc/fstab]]</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 11:48, 25 October 2024

lsblk[1], included in util-linux package, list block devices including Hard disk drive and SDD devices.

lsblk
lsblk -io KNAME,TYPE,SIZE,MODEL,UUID
lsblk -io KNAME,TYPE,SIZE,MODEL,UUID,LABEL
lsblk -S

Examples[edit]

lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda       8:0    0    5G  0 disk
├─sda1    8:1    0  4.9G  0 part /
├─sda14   8:14   0    4M  0 part
└─sda15   8:15   0  106M  0 part /boot/efi
sr0      11:0    1   52K  0 from
lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1       259:0    0  200G  0 disk
├─nvme0n1p1   259:2    0  200G  0 part /
└─nvme0n1p128 259:3    0    1M  0 part
nvme1n1       259:1    0  500G  0 disk /mnt/ext


$ lsblk
NAME                          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                           7:0    0  208M  0 loop
loop1                           7:1    0  456M  0 loop /mnt/rh
sr0                            11:0    1 1024M  0 rom
sda                             8:0    0   60G  0 disk
|-sda1                          8:1    0  512M  0 part /boot
`-sda2                          8:2    0 59.5G  0 part
  |-os_vg-root_lv (dm-0)      253:0    0   16G  0 lvm  /
  |-os_vg-swap_01_lv (dm-1)   253:1    0    4G  0 lvm  [SWAP]
  |-os_vg-tmp_lv (dm-4)       253:4    0    2G  0 lvm  /tmp
  |-os_vg-var_lv (dm-5)       253:5    0   10G  0 lvm  /var
  |-os_vg-hpds_lv (dm-6)      253:6    0    6G  0 lvm  /var/opt/perf/datafiles
  `-os_vg-kickstart_lv (dm-7) 253:7    0    4G  0 lvm  /kickstart
sdd                             8:48   0    2G  0 disk
sdb                             8:16   0   32G  0 disk
`-xfer_vg-lvol1 (dm-3)        253:3    0   32G  0 lvm  /xfer
sdc                             8:32   0   24G  0 disk
`-kdump_vg-kdump_lv (dm-2)    253:2    0   24G  0 lvm
sde                             8:64   0    3G  0 disk

Includes MAJ:MIN information to match to sar -d.


lsblk -S
NAME HCTL       TYPE VENDOR   MODEL             REV TRAN
sda  0:0:0:0    disk ATA      CT210MX501SSD4   023  sata
sdb  1:0:0:0    disk ATA      WDC WDS100T2B0A- 90WD sata
sdc  3:0:0:0    disk ATA      WDC WDS100T2B0A- 90WD sata
sdd  6:0:0:0    disk WD       My Book 15xE     4004 usb
lsblk -S 
NAME HCTL       TYPE VENDOR   MODEL             REV TRAN
sdb  2:1:0:0    disk HPE      LOGICAL VOLUME   1.66 sas
sdc  2:1:0:1    disk HPE      LOGICAL VOLUME   1.66 sas
sdd  1:0:0:0    disk NETAPP   LUN C-Mode       9600 fc
sde  1:0:0:1    disk NETAPP   LUN C-Mode       9600 fc

-S, --scsi Output info about SCSI devices only


$ lsblk -io KNAME,TYPE,SIZE,MODEL
KNAME TYPE   SIZE MODEL
sda   disk 149.1G TOSHIBA MK1637GS
sda1  part  23.3G 
sda2  part    28G 
sda3  part  93.6G 
sda4  part   4.3G 
sr0   rom   1024M CD/DVDW TS-L632M
dm-5  mpath     6T                  
dm-5  mpath     6T                  
dm-5  mpath     6T                 
dm-5  mpath     6T             
dm-7  lvm       6T                 
dm-7  lvm       6T                
dm-7  lvm       6T                  
dm-7  lvm       6T     

-i, --ascii, use ASCII characters for tree formatting       
-o, --output, columns to print      


lsblk -io KNAME,TYPE,SIZE,MODEL,UUID

lsblk -o NAME,ROTA
lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda             8:0    1  14.9G  0 disk
└─sda1          8:1    1  14.9G  0 part
nvme0n1       259:0    0 465.8G  0 disk
├─nvme0n1p1   259:1    0     1M  0 part
├─nvme0n1p2   259:2    0   244M  0 part /boot/efi
├─nvme0n1p3   259:3    0   488M  0 part /boot
└─nvme0n1p4   259:4    0   465G  0 part
  ├─main-root 253:0    0  11.2G  0 lvm  /
  ├─main-swap 253:1    0   1.9G  0 lvm  [SWAP]
  └─main-srv  253:2    0   452G  0 lvm  /srv

Activitites[edit]

  1. Read Linux lsblk Command Tutorial for Beginners: https://www.howtoforge.com/linux-lsblk-command/
  2. Use rescan-scsi-bus.sh --remove to remove unused devices


Related commands[edit]

See also[edit]

  • http://man7.org/linux/man-pages/man8/lsblk.8.html
  • Advertising: