lsblk – list block devices
測試環境為 CentOS 7 x86_64
lsblk 可以列出所有關於區塊設備 (Block devices) 的資訊. lsblk 主要是去讀取 sysfs 的資訊,關於 sysfs 請參考 https://benjr.tw/20857
[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 464G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 463G 0 part ├─cl-root 253:0 0 50G 0 lvm / ├─cl-swap 253:1 0 7.9G 0 lvm [SWAP] └─cl-home 253:2 0 405.1G 0 lvm /home sr0 11:0 1 1024M 0 rom
lsblk 會列出所有 區塊設備 (Block devices) 的資訊,可以使用 -d 參數,顯示主要 區塊設備 (Block devices) 的資訊.
-d, –nodeps
Don’t print slaves or holders.
[root@localhost ~]# lsblk -d NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 464G 0 disk sr0 11:0 1 1024M 0 rom
[root@localhost ~]# lsblk -d /dev/sda NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 464G 0 disk
其他可以用的參數
- -b, –bytes – print SIZE in bytes rather than in human readable format
- -f, –fs – output info about filesystems
- -i, –ascii – use ascii characters only
- -m, –perms – output info about permissions
- -l, –list – use list format output
- -t, –topology – output info about topology
- -S, –scsi – output info about SCSI devices
- -o, –output
-o, –output
Output columns
[root@localhost ~]# lsblk -d -o name,serial,KNAME,MODEL,STATE,type,vendor NAME SERIAL KNAME MODEL STATE TYPE VENDOR sda 220a00015519f2d6 sda ST EX8650 running disk Promise sr0 006080270406 sr0 DVD A DS8A4S running rom Slimtype
–output 可以用的參數
沒有解決問題,試試搜尋本站其他內容