lsblk
Ubuntu 系統 lsblk 指令,列出系統所有區塊裝置(Block Device)
列出系統所有區塊裝置(Block Device)
區塊裝置類型
會列出的裝置類型
- 硬碟
- USB 隨身碟
- DVD-ROM
不會列出的裝置類型
- RAM disk
lsblk
列出區塊裝置的樹狀資訊
Ubuntu 16.04
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 3.7T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 3.7T 0 part /
└─sda3 8:3 0 4G 0 part [SWAP]
AWS Ubuntu 16.04
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 33.3M 1 loop /snap/amazon-ssm-agent/3552
loop1 7:1 0 32.3M 1 loop /snap/snapd/12704
loop2 7:2 0 55.5M 1 loop /snap/core18/2074
loop3 7:3 0 70.3M 1 loop /snap/lxd/21029
loop4 7:4 0 25M 1 loop /snap/amazon-ssm-agent/4046
loop6 7:6 0 55.4M 1 loop /snap/core18/2128
loop7 7:7 0 67.6M 1 loop /snap/lxd/20326
loop9 7:9 0 32.3M 1 loop /snap/snapd/12398
nvme0n1 259:0 0 300G 0 disk
└─nvme0n1p1 259:1 0 300G 0 part /
lsblk -a
列出所有區塊裝置的樹狀資訊
預設不會列出空的區塊裝置,加上 -a
參數可以列出全部的裝置,包含空的區塊裝置
Ubuntu 16.04
$ lsblk -a
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 3.7T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 3.7T 0 part /
└─sda3 8:3 0 4G 0 part [SWAP]
loop0 7:0 0 0 loop
loop1 7:1 0 0 loop
loop2 7:2 0 0 loop
loop3 7:3 0 0 loop
loop4 7:4 0 0 loop
loop5 7:5 0 0 loop
loop6 7:6 0 0 loop
loop7 7:7 0 0 loop
AWS Ubuntu 16.04
$ lsblk -a
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 33.3M 1 loop /snap/amazon-ssm-agent/3552
loop1 7:1 0 32.3M 1 loop /snap/snapd/12704
loop2 7:2 0 55.5M 1 loop /snap/core18/2074
loop3 7:3 0 70.3M 1 loop /snap/lxd/21029
loop4 7:4 0 25M 1 loop /snap/amazon-ssm-agent/4046
loop5 7:5 0 1 loop
loop6 7:6 0 55.4M 1 loop /snap/core18/2128
loop7 7:7 0 67.6M 1 loop /snap/lxd/20326
loop8 7:8 0 1 loop
loop9 7:9 0 32.3M 1 loop /snap/snapd/12398
loop10 7:10 0 0 loop
md0 9:0 0 0 md
nvme0n1 259:0 0 300G 0 disk
└─nvme0n1p1 259:1 0 300G 0 part /
lsblk -m
列出區塊裝置擁有者
Ubuntu 16.04
$ lsblk -m
NAME SIZE OWNER GROUP MODE
sda 3.7T root disk brw-rw----
├─sda1 1M root disk brw-rw----
├─sda2 3.7T root disk brw-rw----
└─sda3 4G root disk brw-rw----
AWS Ubuntu 16.04
$ lsblk -m
NAME SIZE OWNER GROUP MODE
loop0 33.3M root disk brw-rw----
loop1 32.3M root disk brw-rw----
loop2 55.5M root disk brw-rw----
loop3 70.3M root disk brw-rw----
loop4 25M root disk brw-rw----
loop6 55.4M root disk brw-rw----
loop7 67.6M root disk brw-rw----
loop9 32.3M root disk brw-rw----
nvme0n1 300G root disk brw-rw----
└─nvme0n1p1 300G root disk brw-rw----