lsblk是一个用于列出块设备信息的Linux命令。它能够显示系统中所有的磁盘、分区以及其它块设备的详细信息。
lsblk命令的常用语法如下: lsblk [选项] [设备]
常用选项:
常用示例:
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 3.7T 0 disk
└─sda1 8:1 0 3.7T 0 part
nvme0n1 259:0 0 465.8G 0 disk
├─nvme0n1p1 259:1 0 2G 0 part /boot/efi
├─nvme0n1p2 259:2 0 2G 0 part /boot
└─nvme0n1p3 259:3 0 461.8G 0 part
├─centos00-root 253:0 0 261.8G 0 lvm /
└─centos00-home 253:1 0 200G 0 lvm /home
[root@localhost ~]# lsblk -a
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 3.7T 0 disk
└─sda1 8:1 0 3.7T 0 part
nvme0n1 259:0 0 465.8G 0 disk
├─nvme0n1p1 259:1 0 2G 0 part /boot/efi
├─nvme0n1p2 259:2 0 2G 0 part /boot
└─nvme0n1p3 259:3 0 461.8G 0 part
├─centos00-root 253:0 0 261.8G 0 lvm /
└─centos00-home 253:1 0 200G 0 lvm /home
[root@localhost ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
└─sda1 ext4 55d4f039-b78c-4835-a294-a31146993f90
nvme0n1
├─nvme0n1p1 vfat 0427-214E /boot/efi
├─nvme0n1p2 xfs 6520a70b-7adb-4455-8ff1-07c329bfac1c /boot
└─nvme0n1p3 LVM2_member knGBT6-TZyO-boL3-m2fA-bdAy-VweR-HdclCB
├─centos00-root xfs 0cb5ff2e-1515-48f4-aa75-1379d34be815 /
└─centos00-home xfs 48ed28f1-8e2f-4d70-96b4-0a8646e6c7b5 /home
[root@localhost ~]# lsblk -o name
NAME
sda
└─sda1
nvme0n1
├─nvme0n1p1
├─nvme0n1p2
└─nvme0n1p3
├─centos00-root
└─centos00-home
[root@localhost ~]# lsblk -o name,size
NAME SIZE
sda 3.7T
└─sda1 3.7T
nvme0n1 465.8G
├─nvme0n1p1 2G
├─nvme0n1p2 2G
└─nvme0n1p3 461.8G
├─centos00-root 261.8G
└─centos00-home 200G
[root@localhost ~]# lsblk -o name,MOUNTPOINT
NAME MOUNTPOINT
sda
└─sda1
nvme0n1
├─nvme0n1p1 /boot/efi
├─nvme0n1p2 /boot
└─nvme0n1p3
├─centos00-root /
└─centos00-home /home
[root@localhost ~]# lsblk sda
lsblk: sda: not a block device
[root@localhost ~]# lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 3.7T 0 disk
└─sda1 8:1 0 3.7T 0 part
[root@localhost ~]#