工作常用查看塊設備命令lsblk詳解
阿新 • • 發佈:2018-11-19
head local form depend exclude 樹狀 root -a --nodeps lsblk命令可以列出所有可用塊設備的信息,比如我們說的邏輯磁盤,而df -h查看的是文件系統級別的信息。lsblk命令包含在util-linux包中,yum安裝util-linux包即可,util-linux包含多個命令工具。
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 17G 1.2G 16G 7% / devtmpfs 482M 0 482M 0% /dev tmpfs 493M 0 493M 0% /dev/shm tmpfs 493M 6.8M 486M 2% /run tmpfs 493M 0 493M 0% /sys/fs/cgroup /dev/sda1 1014M 125M 890M 13% /boot tmpfs 99M 0 99M 0% /run/user/0 [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sda 8:0 0 20G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 17G 0 lvm / └─centos-swap 253:1 0 2G 0 lvm [SWAP] sdb 8:16 0 20G 0 disk sr0 11:0 1 8.1G 0 rom
lsblk命令默認情況下將以樹狀列出所有塊設備。
lsblk的參數
[root@localhost ~]# lsblk --help Usage: lsblk [options] [<device> ...] Options: -a, --all print all devices #顯示所有塊設備,包括空塊設備 -b, --bytes print SIZE in bytes rather than in human readable format #以bytes方式顯示塊設備大小 -d, --nodeps don‘t print slaves or holders #不顯示salves或holders -D, --discard print discard capabilities -e, --exclude <list> exclude devices by major number (default: RAM disks) #排除設備 -I, --include <list> show only devices with specified major numbers -f, --fs output info about filesystems #顯示文件系統信息 -h, --help usage information (this) #顯示幫助信息 -i, --ascii use ascii characters only -m, --perms output info about permissions #顯示權限信息 -l, --list use list format output #使用列表格式顯示 -n, --noheadings don‘t print headings #不顯示標題 -o, --output <list> output columns #輸出列 -p, --paths print complate device path -P, --pairs use key="value" output format #使用key=”value”格式顯示 -r, --raw use raw output format #使用原始格式顯示 -s, --inverse inverse dependencies -t, --topology output info about topology #顯示拓撲結構信息 -S, --scsi output info about SCSI devices -h, --help display this help and exit -V, --version output version information and exit #顯示util-linux版本信息
lsblk欄目詳解
[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT fd0 2:0 1 4K 0 disk sda 8:0 0 20G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 17G 0 lvm / └─centos-swap 253:1 0 2G 0 lvm [SWAP] sdb 8:16 0 20G 0 disk sr0 11:0 1 8.1G 0 rom
1、NAME:塊設備名
2、MAJ:MIN:本欄顯示主要和次要設備號
3、RM:顯示可移動設備。0表示非移動設備,1表示可移動設備
4、SIZE:塊設備的空間大小
5、RO:是否只讀,0表示非只讀,1表示只讀
6、TYPE:塊設備類型,比如disk磁盤,part分區,lvm邏輯卷,rom只讀存儲
7、MOUNTPOINT:設備掛載點
工作常用查看塊設備命令lsblk詳解