ls>命令,lss命令
lsblk 命令用于显示块设备信息关键应用场景: 获取wwnid、获取块设备列表、获取块设备类型(ssd、hdd)、获取块设备大小等信息数据源: /sys/dev/block返回码:
0: 成功1: 失败32: 未找到所有指定设备64: 找到了部分设备,但某些设备未找到类似命令:
findmnt、blkid、ls : 的帮助信息
~ lsblk --helpUsage: lsblk [可选] [ .] 列出有关块设备的信息。选项: -a, --all 打印所有设备-b, --bytes 以字节为单位打印SIZE,而不是人类可读的格式-d, --nodeps 不打印从设备或持有者-D, --discard 打印丢弃功能-e, --exclude 按主设备号排除设备(默认: RAM 磁盘) -f, --fs 打印有关文件系统的信息-i, --ascii 仅使用ASCII 字符-I, --include 仅显示具有指定主设备号的设备- J, --json 使用JSON 输出格式-l, --list 列表格式使用输出-m, --perms 打印有关权限的信息-n , --noHeadings 不打印标题-o, --output 输出列-O, --output-all 打印所有列输出-p, --paths 打印完整的设备路径-P, --pairs 使用key='value' 输出格式-r, --raw 使用原始输出格式-s, --inverse 逆dependency -S, --scsi 输出有关SCSI 设备的信息-t, --topologyoutput 有关拓扑的信息-x, --sort 排序输出- h, --help 显示此帮助并退出-V, --version 版本信息并退出可用列(对于--output) : NAME 设备名称KNAME 内部内核设备名称MAJ:MIN 主设备: 次设备编号FSTYPE 文件系统类型MOUNTPOINT 设备安装位置LABEL 文件系统LABEL UUID 文件系统UUID PARTTYPE 分区类型UUID PARTLABEL 分区LABEL PARTUUID 分区UUID PARTFLAGS 分区标志RA 预读设备RO 只读设备RM 可移动设备HOTPLUG 可移动或热插拔设备(usb、pcmcia.)MODEL 设备标识符SERIAL 磁盘序列号SIZE 设备大小STATE 设备状态OWNER 用户名GROUP 组名称MODE 设备节点权限ALIGNMENT 对齐偏移量MIN-IO 最小I/O 大小OPT-IO 最佳I/O 大小PHY-SEC 物理扇区大小LOG-SEC 逻辑扇区大小ROTA 旋转设备,0 为不可旋转(ssd),1 为可旋转(硬盘) SCHED I/O 调度程序名称RQ-SIZE 请求队列大小TYPE 设备类型DISC-ALN 丢弃对齐偏移量DISC-GRAN 丢弃粒度DISC-MAX 丢弃最大字节数DISC-ZERO 丢弃零数据WSAME 写入相同最大字节数WWN 唯一存储标识符RAND 添加随机性PKNAME 内部父内核设备名称HCTL Host:Channel:Target:SCSI TRAN 设备Lun 传输类型SUBSYSTEMS 重复数据删除子系统链REV 设备修订版VENDOR 设备Vendorlsblk 命令输出默认参数是-a、--all
~ lsblkNAME MAJ:MIN RM 大小RO 类型挂载点loop1 7:1 0 55.8M 1 循环/snap/kata-containers/288sdd 8:48 0 1.8T 0 磁盘sdd1 8:49 0 1.8T 0 部分sdb 83336 016 0 11 9 .2G 0盘 sdb2 8:18 0 915M 0 部分sdb1 8:17 0 118.4G 0 部分循环4 7:4 0 69.8M 1 循环/snap/kata-containers/352sr0 11:0 1 1024M 0 rom 循环2 73336 0 2 0 89.4M 1 循环/snap/core/6818loop 0 7:0 0 88.4M 1 个循环/snap/core/6964sde 8:64 0 1.8T 0 磁盘sde2 8:66 0 1.8T 0 部分sde1 8:65 0 128M 0 部分sdc 8:32 0 47 7G 0磁盘sdc2 8: 34 0 372G 0 份/homesdc5 8:37 0 9.5G 0 部分[SWAP]sdc3 8:35 0 1K 0 部分sdc1 8:33 0 95.4G 0 部分/loop3 7:3 0 89.3M 1 循环/snap/core/6673lsblk -b , --bytes 为输出单位字节
~ lsblk -bNAME MAJ:MIN RM 大小RO 类型MOUNTPOINTloop1 7:1 0 58478592 1 循环/snap/kata-containers/288sdd 8:48 0 2000398934016 0 磁盘sdd1 8:49 0 200039 7 79 5328 0 部分sdb 8:16 0 128035676160 0 磁盘sdb2 8:18 0 959447040 0 部分sdb1 8:17 0 127071901696 0 部分循环4 7:4 0 73129984 1 循环/snap/kata-containers/352sr0 11:0 1 1073741312 0 rom 循环2 7:2 0 937 20576 1 循环/捕捉/核心/6818 循环0 7:0 0 92733440 1 循环/snap/core/6964sde 8:64 0 2000398934016 0 磁盘sde2 8:66 0 2000263577600 0 部分sde1 8:65 0 134217728 0 部分sdc 8:32 0 5121 101905 92 0 磁盘sdc2 8:34 0 399469707264 0 部分/home sdc5 8:37 0 10239344640 0 part [SWAP] sdc3 8:35 0 1024 0part sdc1 8:33 0 102398689280 0part /loop3 7:3 0 93581312 1loop /snap/core/6673lsblk -D , --discard, 废弃函数输出一个列表(详细不详已检查)
~ lsblk -DNAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZEROloop1 0 4K4G 0sdd 0 4K2G 0sdd1 0 4K2G 0sdb 0 512B2G 0sdb2 0 512B2G 0sdb1 0 512B2G 0loop4 0 4 K4 G 0sr0 0 0B0B 0循环2 0 4K4G 0loop0 0 4K4G 0sde 0 0B0B 0 sde2 0 0B0B 0sde1 0 0B0B 0sdc 0 512B2G 0 sdc2 0 512B2G 0sdc5 0 512B2G 0sdc3 0 512B2 G 0s dc1 0 512B2G 0 Loop 3 0 4K4G 0lsblk -d [/dev/sdx], --nodeps,打印指定设备信息或打印所有设备信息
~ lsblk -dNAME MAJ:MIN RM 大小RO 类型挂载点loop1 7:1 0 55.8M 1 循环/snap/kata-containers/288sdd 8:48 0 1.8T 0 磁盘sdb 8:16 0 119.2G 0 磁盘循环4 7:4 0 69。 8M 1 循环/snap/katacontainer/352sr0 11:0 1 1024M 0 ROM 循环2 7:2 0 89.4M 1 循环/snap/core/6818loop0 7:0 0 88.4M 1 循环/snap/core/6964sde 8:64 0 1 .8T 0盘sdc 8:3 2 0 477G 0 磁盘循环3 7:3 0 89.3M 1 循环/snap/core/6673 ~ lsblk -d /dev/sdcNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsdc 8:32 0 477G 0 Disclsblk -e, --exclude 列表,排除主要ID 列表
~ lsblk -e 7NAME MAJ:MIN RM 大小RO 类型安装点sdd 8:48 0 1.8T 0 磁盘sdd1 8:49 0 1.8T 0 零件sdb 8:16 0 119.2G 0 磁盘sdb2 83336 018 0 915M 0 件sdb1 8:17 0 118.4G 0副本sr0 11:0 1 1024M 0 rom sde 8:64 0 1.8T 0 磁盘sde2 8:66 0 1.8T 0 部分sde1 8:65 0 128M 0 部分sdc 8:32 0 477G 0 磁盘sdc2 8:34 0 372G 0 部分/homesdc5 8:37 0 9.5G 0 部分[SWAP] sdc3 8:35 0 1K 0 部分sdc1 8:33 0 95.4G 0 部分/~ lsblk -e 7,8NAME MAJ:MIN RM 尺寸RO 类型安装点sr0 11:0 1 1 0 24M 0 ROM lsblk -f, -- fs,输出设备的文件系统信息与lsblk -o NAME, FSTYPE, LABEL, UUID, MOUNTPOINT相同
~ lsblk -fNAME FSTYPE 标签UUID MOUNTPOINTloop1 squashfs /snap/kata-containers/288sdd sdd1 ntfs Volume2 CA9015A6901599D1sdb sdb2 ntfs30EAC3FEEAC3BE7A sdb1 ntfs OS_WIN10 06 0 0EC5 800EC4 FEBloop4 squashfs /snap/kata-containers/352sr0loop2 squashfs /snap/core/6818loop0 squashfs /snap/core/6964sde sde2 ntfs 私有存储B6D47A52D47A1539 正 sde1sdc sdc2 ext453842090-4ad6-4472-ad35-53b4d7b33bf8 /homesdc5 swap382e4b22 -5 0 3e-4911-bf2f-1167af3f3cda [交换] sdc3 sdc1 ext46b5618d0-a2b0-41f3-a3a5-9eb5a524b0a8 /loop3 squashfs /snap/core/6673lsblk -I , --include list , 输出主要ID 列表
~ lsblk -I 7,8NAME MAJ:MIN RM 大小RO 类型MOUNTPOINTloop1 7:1 0 55.8M 1 循环/snap/kata-containers/288sdd 8:48 0 1.8T 0 磁盘sdd1 8:49 0 1.8T 0 部分sdb 83 33 60 16 0 119.2G 0磁盘sdb2 8:18 0 915M 0部分sdb1 8:17 0 118.4G 0部分loop4 7:4 0 69.8M 1个循环/snap/kata-containers/352loop2 7:2 0 89.4M 1个循环/snap/core/681 8loop0 7:0 0 88.4M 1循环/快照/核心/6964sde 8:64 0 1.8T 0 磁盘sde2 8:66 0 1.8T 0 部分sde1 8:65 0 128M 0 部分sdc 8:32 0 477G 0 磁盘sdc2 833 36034 0 372G 0 部分/homesdc5 8:37 0 9.5 G 0 部分[SWAP]sdc3 8:35 0 1K 0 部分sdc1 8:33 0 95.4G 0 部分/loop3 7:3 0 89.3M 1 循环/snap/core/6673lsblk -i , --ascii ,使用的字符至做。输出信息的ASCII码打印
~ lsblk -iNAME MAJ:MIN RM 大小RO 类型挂载点loop1 7:1 0 55.8M 1 循环/snap/kata-containers/288sdd 8:48 0 1.8T 0 磁盘`-sdd1 8:49 0 1.8T 0 部分sdb 83336 016 0 119.2 G 0 盘| - sdb2 8:18 0 915M 0 部分`-sdb1 8:17 0 118.4G 0 部分循环4 7:4 0 69.8M 1 循环/snap/kata-containers/352sr0 11:0 1 1024M 0 rom 循环2 73 33602 0 89.4M 1 循环/快照/核心/6818循环0 7:0 0 88.4M 1循环/snap/core/6964sde 8:64 0 1.8T 0磁盘|-sde2 8:66 0 1.8T 0部分`-sde1 8:65 0 128M 0部分sdc 8:32 0 4 77G 0盘|-sdc2 8:34 0 3 72G 0 部分/home|-sdc5 8:37 0 9.5G 0 部分[SWAP]|-sdc3 8:35 0 1K 0 部分`-sdc1 8:33 0 95.4G 0 部分/loop3 7:3 0 89.3M 1 循环/snap/core/6673ls blk-J, --json 以json格式输出
~ lsblk -J{ 'blockdevices': [ {'name': 'loop1', 'maj:min': '7:1', 'rm': '0', 'size': '55.8M', 'ro': '1 ', '类型': '循环', '安装点': '/snap/kata-containers/288'}, {'名称': 'sdd', 'maj:min': '8:48', 'rm': '0' , '大小': '1.8T', 'ro': '0', '类型': '磁盘', '挂载点': null, '孩子': [ {'name': 'sdd1', 'maj:min': '8:49', 'rm': '0', '尺寸': '1.8T', 'ro': '0', '类型': '部分', '挂载点': null} ] }, {'name ' : 'sdb', 'maj:min' : '8:16', 'rm': '0', '大小' : '119.2G', 'ro': '0', '类型' : '磁盘', '挂载点': null,'孩子': [{'名称':'sdb2','maj:min':'8:18','rm':'0','大小':'915M','ro':'0', 'type ': '部分', '挂载点': null}, {'name': 'sdb1', 'maj:min': '8:17', 'rm': '0', 'size': '118.4G', 'ro' : '0', '类型': '部分', '挂载点': null} ] }, {'name': 'loop4', 'maj:min': '7:4', 'rm': '0', '大小':'69.8M','ro':'1','类型':'循环','挂载点':'/snap/kata-containers/352'},{'名称':'sr0', 'maj:min' : '11:0', 'rm': '1', '大小': '1024M', 'ro': '0', '类型': 'rom', '挂载点': null}, {'名称':'循环2','maj:min':'7:2','rm':'0','大小':'89.4M','ro':'1','类型':'循环','挂载点':'/snap/core/6818'}, {'name': 'loop0', 'maj:min': '7:0', 'rm': '0', 'size': '88.4M', 'ro ': '1', '类型': '循环', '挂载点': '/snap/core/6964'}, {'name': 'sde', 'maj:min': '8:64', 'rm': '0', '大小' : '1.8T', 'ro': '0', '类型': '磁盘', '挂载点': null, '孩子': [ {'name': 'sde2', ' maj:min':'8:66','rm':'0','尺寸':'1.8T','ro':'0','类型':'部分','mo
untpoint": null}, {"name": "sde1", "maj:min": "8:65", "rm": "0", "size": "128M", "ro": "0", "type": "part", "mountpoint": null} ] }, {"name": "sdc", "maj:min": "8:32", "rm": "0", "size": "477G", "ro": "0", "type": "disk", "mountpoint": null, "children": [ {"name": "sdc2", "maj:min": "8:34", "rm": "0", "size": "372G", "ro": "0", "type": "part", "mountpoint": "/home"}, {"name": "sdc5", "maj:min": "8:37", "rm": "0", "size": "9.5G", "ro": "0", "type": "part", "mountpoint": "[SWAP]"}, {"name": "sdc3", "maj:min": "8:35", "rm": "0", "size": "1K", "ro": "0", "type": "part", "mountpoint": null}, {"name": "sdc1", "maj:min": "8:33", "rm": "0", "size": "95.4G", "ro": "0", "type": "part", "mountpoint": "/"} ] }, {"name": "loop3", "maj:min": "7:3", "rm": "0", "size": "89.3M", "ro": "1", "type": "loop", "mountpoint": "/snap/core/6673"} ]}lsblk -l, --list , 打印一个表格格式的输出 ➜ ~ lsblk -lNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTloop1 7:1 0 55.8M 1 loop /snap/kata-containers/288sdd 8:48 0 1.8T 0 disk sdd1 8:49 0 1.8T 0 part sdb 8:16 0 119.2G 0 disk sdb2 8:18 0 915M 0 part sdb1 8:17 0 118.4G 0 part loop4 7:4 0 69.8M 1 loop /snap/kata-containers/352sr0 11:0 1 1024M 0 rom loop2 7:2 0 89.4M 1 loop /snap/core/6818loop0 7:0 0 88.4M 1 loop /snap/core/6964sde 8:64 0 1.8T 0 disk sde2 8:66 0 1.8T 0 part sde1 8:65 0 128M 0 part sdc 8:32 0 477G 0 disk sdc2 8:34 0 372G 0 part /homesdc5 8:37 0 9.5G 0 part [SWAP]sdc3 8:35 0 1K 0 part sdc1 8:33 0 95.4G 0 part /loop3 7:3 0 89.3M 1 loop /snap/core/6673lsblk -m, --perms , 输出设备的权限,属主属组信息同lsblk -o NAME,SIZE,OWNER,GROUP,MODE ➜ ~ lsblk -mNAME SIZE OWNER GROUP MODEloop1 55.8M root disk brw-rw----sdd 1.8T root disk brw-rw----└─sdd1 1.8T root disk brw-rw----sdb 119.2G root disk brw-rw----├─sdb2 915M root disk brw-rw----└─sdb1 118.4G root disk brw-rw----loop4 69.8M root disk brw-rw----sr0 1024M root cdrom brw-rw----loop2 89.4M root disk brw-rw----loop0 88.4M root disk brw-rw----sde 1.8T root disk brw-rw----├─sde2 1.8T root disk brw-rw----└─sde1 128M root disk brw-rw----sdc 477G root disk brw-rw----├─sdc2 372G root disk brw-rw----├─sdc5 9.5G root disk brw-rw----├─sdc3 1K root disk brw-rw----└─sdc1 95.4G root disk brw-rw----loop3 89.3M root disk brw-rw----lsblk -n, --noheadings, 不打印标题 ➜ ~ lsblk -nloop1 7:1 0 55.8M 1 loop /snap/kata-containers/288sdd 8:48 0 1.8T 0 disk └─sdd1 8:49 0 1.8T 0 part sdb 8:16 0 119.2G 0 disk ├─sdb2 8:18 0 915M 0 part └─sdb1 8:17 0 118.4G 0 part loop4 7:4 0 69.8M 1 loop /snap/kata-containers/352sr0 11:0 1 1024M 0 rom loop2 7:2 0 89.4M 1 loop /snap/core/6818loop0 7:0 0 88.4M 1 loop /snap/core/6964sde 8:64 0 1.8T 0 disk ├─sde2 8:66 0 1.8T 0 part └─sde1 8:65 0 128M 0 part sdc 8:32 0 477G 0 disk ├─sdc2 8:34 0 372G 0 part /home├─sdc5 8:37 0 9.5G 0 part [SWAP]├─sdc3 8:35 0 1K 0 part └─sdc1 8:33 0 95.4G 0 part /loop3 7:3 0 89.3M 1 loop /snap/core/6673lsblk -o , --output list, 打印指定字段细腻系,或者lsblk -o +UUID, 表示在默认输出的后边加一列字段名为UUID的信息 ➜ ~ lsblk -o +UUIDNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT UUIDloop1 7:1 0 55.8M 1 loop /snap/kata-containers/288 sdd 8:48 0 1.8T 0 disk └─sdd1 8:49 0 1.8T 0 part CA9015A6901599D1sdb 8:16 0 119.2G 0 disk ├─sdb2 8:18 0 915M 0 part 30EAC3FEEAC3BE7A└─sdb1 8:17 0 118.4G 0 part 0600EC5800EC4FEBloop4 7:4 0 69.8M 1 loop /snap/kata-containers/352 sr0 11:0 1 1024M 0 romloop2 7:2 0 89.4M 1 loop /snap/core/6818 loop0 7:0 0 88.4M 1 loop /snap/core/6964 sde 8:64 0 1.8T 0 disk ├─sde2 8:66 0 1.8T 0 part B6D47A52D47A1539└─sde1 8:65 0 128M 0 part sdc 8:32 0 477G 0 disk ├─sdc2 8:34 0 372G 0 part /home53842090-4ad6-4472-ad35-53b4d7b33bf8├─sdc5 8:37 0 9.5G 0 part [SWAP] 382e4b22-503e-4911-bf2f-1167af3f3cda├─sdc3 8:35 0 1K 0 part └─sdc1 8:33 0 95.4G 0 part / 6b5618d0-a2b0-41f3-a3a5-9eb5a524b0a8loop3 7:3 0 89.3M 1 loop /snap/core/6673 lsblk -O, --output-all,输出所有列的信息 ➜ ~ lsblk -ONAME KNAME MAJ:MIN FSTYPE MOUNTPOINT LABEL UUID PARTTYPE PARTLABEL PARTUUID PARTFLAGS RA RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODEALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO WSAME WWN RAND PKNAME HCTLTRAN SUBSYSTEMS REV VENDORloop1 loop1 7:1 squashfs /snap/kata 128 1 00 55.8Mroot disk brw-rw---- 0 512 0 512 512 1 none 128 loop 0 4K4G 0 0B 0 block sdd sdd 8:48 128 0 00 ST2000DM0 WFL10Z4B 1.8T runni root disk brw-rw---- 0 4096 0 4096 512 1 cfq128 disk 0 4K2G 0 0B 0x5000c500be0e12fc 1 2:0:0:0 sata block:scsi:pci│ 0001 ATA └─sdd1 sdd1 8:49 ntfs Volume2 CA9015A6901599D1ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Basic data partition fbbcfa40-06d8-4d43-9b2e-18b04089e30d 128 0 00 1.8Troot disk brw-rw---- 0 4096 0 4096 512 1 cfq128 part 0 4K2G 0 0B 0x5000c500be0e12fc 1 sdd block:scsi:pci sdb sdb 8:16 128 0 00 M4-CT128M 000000001 119.2G runni root disk brw-rw---- 0 512 0 512 512 0 cfq128 disk 0 512B2G 0 0B 0x500a075109112598 0 0:0:0:0 sata block:scsi:pci│ 000F ATA ├─sdb2 sdb2 8:18 ntfs 30EAC3FEEAC3BE7A0x27 4051264b-02 128 0 00 915Mroot disk brw-rw---- 0 512 0 512 512 0 cfq128 part 0 512B2G 0 0B 0x500a075109112598 0 sdb block:scsi:pci│└─sdb1 sdb1 8:17 ntfs OS_WIN10 0600EC5800EC4FEB0x7 4051264b-01 0x80 128 0 00118.4Groot disk brw-rw---- 0 512 0 512 512 0 cfq128 part 0 512B2G 0 0B 0x500a075109112598 0 sdb block:scsi:pci loop4 loop4 7:4 squashfs /snap/kata 128 1 00 69.8Mroot disk brw-rw---- 0 512 0 512 512 1 none 128 loop 0 4K4G 0 0B 0 block sr0 sr0 11:0 128 0 11 DRW-24D3S KSTD3N812 1024M runni root cdrom brw-rw---- 0 512 0 512 512 1 cfq128 rom 0 0B0B 0 0B 0x5001480000000000 1 5:0:0:0 sata block:scsi:pci 1.01 ASUS loop2 loop2 7:2 squashfs /snap/core 128 1 00 89.4Mroot disk brw-rw---- 0 512 0 512 512 1 none 128 loop 0 4K4G 0 0B 0 block loop0 loop0 7:0 squashfs /snap/core 128 1 00 88.4Mroot disk brw-rw---- 0 512 0 512 512 1 none 128 loop 0 4K4G 0 0B 0 block sde sde 8:64 128 0 00 WDC WD20E WD-WCC4ML 1.8T runni root disk brw-rw---- 0 4096 0 4096 512 1 cfq128 disk 0 0B0B 0 0B 0x50014ee2b52d7844 1 4:0:0:0 sata block:scsi:pci│ 0A80 ATA ├─sde2 sde2 8:66 ntfs 专用存储 B6D47A52D47A1539ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Basic data partition│42732d06-bb6d-4e0c-80fc-5e2746300ea7 128 0 00 1.8Troot disk brw-rw---- 0 4096 0 4096 512 1 cfq128 part 0 0B0B 0 0B 0x50014ee2b52d7844 1 sde block:scsi:pci│└─sde1 sde1 8:65 e3c9e316-0b5c-4db8-817d-f92df00215ae Microsoft reserved partition 731fb900-205e-4c54-b9c7-b78946f2ac12 128 0 00 128Mroot disk brw-rw---- 3072 4096 0 4096 512 1 cfq128 part 0 0B0B 0 0B 0x50014ee2b52d7844 1 sde block:scsi:pci sdc sdc 8:32 128 0 00 INTEL SSD BTLA82430 477G runni root disk brw-rw---- 0 512 0 512 512 0 cfq128 disk 0 512B2G 0 0B 0x55cd2e414f7acc09 0 1:0:0:0 sata block:scsi:pci│ 002C ATA ├─sdc2 sdc2 8:34 ext4 /home 53842090-4ad6-4472-ad35-53b4d7b33bf8 0x83 2ab59d7a-02 128 0 00 372Groot disk brw-rw---- 0 512 0 512 512 0 cfq128 part 0 512B2G 0 0B 0x55cd2e414f7acc09 0 sdc block:scsi:pci│├─sdc5 sdc5 8:37 swap [SWAP]382e4b22-503e-4911-bf2f-1167af3f3cda 0x82 2ab59d7a-05 128 0 00 9.5Groot disk brw-rw---- 0 512 0 512 512 0 cfq128 part 0 512B2G 0 0B 0x55cd2e414f7acc09 0 sdc block:scsi:pci│├─sdc3 sdc3 8:35 0x5 2ab59d7a-03 128 0 00 1Kroot disk brw-rw---- 0 512 0 512 512 0 cfq128 part 0 512B2G 0 0B 0x55cd2e414f7acc09 0 sdc block:scsi:pci│└─sdc1 sdc1 8:33 ext4 / 6b5618d0-a2b0-41f3-a3a5-9eb5a524b0a8 0x83 2ab59d7a-01 0x80 128 0 00 95.4Groot disk brw-rw---- 0 512 0 512 512 0 cfq128 part 0 512B2G 0 0B 0x55cd2e414f7acc09 0 sdc block:scsi:pci loop3 loop3 7:3 squashfs /snap/core 128 1 00 89.3Mroot disk brw-rw---- 0 512 0 512 512 1 none 128 loop 0 4K4G 0 0B 0 block lsblk -P, --pairs 打印成html需要的unsafe格式字符 ➜ ~ lsblk -P NAME="loop1" MAJ:MIN="7:1" RM="0" SIZE="55.8M" RO="1" TYPE="loop" MOUNTPOINT="/snap/kata-containers/288"NAME="sdd" MAJ:MIN="8:48" RM="0" SIZE="1.8T" RO="0" TYPE="disk" MOUNTPOINT=""NAME="sdd1" MAJ:MIN="8:49" RM="0" SIZE="1.8T" RO="0" TYPE="part" MOUNTPOINT=""NAME="sdb" MAJ:MIN="8:16" RM="0" SIZE="119.2G" RO="0" TYPE="disk" MOUNTPOINT=""NAME="sdb2" MAJ:MIN="8:18" RM="0" SIZE="915M" RO="0" TYPE="part" MOUNTPOINT=""NAME="sdb1" MAJ:MIN="8:17" RM="0" SIZE="118.4G" RO="0" TYPE="part" MOUNTPOINT=""NAME="loop4" MAJ:MIN="7:4" RM="0" SIZE="69.8M" RO="1" TYPE="loop" MOUNTPOINT="/snap/kata-containers/352"NAME="sr0" MAJ:MIN="11:0" RM="1" SIZE="1024M" RO="0" TYPE="rom" MOUNTPOINT=""NAME="loop2" MAJ:MIN="7:2" RM="0" SIZE="89.4M" RO="1" TYPE="loop" MOUNTPOINT="/snap/core/6818"NAME="loop0" MAJ:MIN="7:0" RM="0" SIZE="88.4M" RO="1" TYPE="loop" MOUNTPOINT="/snap/core/6964"NAME="sde" MAJ:MIN="8:64" RM="0" SIZE="1.8T" RO="0" TYPE="disk" MOUNTPOINT=""NAME="sde2" MAJ:MIN="8:66" RM="0" SIZE="1.8T" RO="0" TYPE="part" MOUNTPOINT=""NAME="sde1" MAJ:MIN="8:65" RM="0" SIZE="128M" RO="0" TYPE="part" MOUNTPOINT=""NAME="sdc" MAJ:MIN="8:32" RM="0" SIZE="477G" RO="0" TYPE="disk" MOUNTPOINT=""NAME="sdc2" MAJ:MIN="8:34" RM="0" SIZE="372G" RO="0" TYPE="part" MOUNTPOINT="/home"NAME="sdc5" MAJ:MIN="8:37" RM="0" SIZE="9.5G" RO="0" TYPE="part" MOUNTPOINT="[SWAP]"NAME="sdc3" MAJ:MIN="8:35" RM="0" SIZE="1K" RO="0" TYPE="part" MOUNTPOINT=""NAME="sdc1" MAJ:MIN="8:33" RM="0" SIZE="95.4G" RO="0" TYPE="part" MOUNTPOINT="/"NAME="loop3" MAJ:MIN="7:3" RM="0" SIZE="89.3M" RO="1" TYPE="loop" MOUNTPOINT="/snap/core/6673"lsblk -p, --paths, 打印设备的全部路径 ➜ ~ lsblk -pNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT/dev/loop1 7:1 0 55.8M 1 loop /snap/kata-containers/288/dev/sdd 8:48 0 1.8T 0 disk └─/dev/sdd1 8:49 0 1.8T 0 part /dev/sdb 8:16 0 119.2G 0 disk ├─/dev/sdb2 8:18 0 915M 0 part └─/dev/sdb1 8:17 0 118.4G 0 part /dev/loop4 7:4 0 69.8M 1 loop /snap/kata-containers/352/dev/sr0 11:0 1 1024M 0 rom /dev/loop2 7:2 0 89.4M 1 loop /snap/core/6818/dev/loop0 7:0 0 88.4M 1 loop /snap/core/6964/dev/sde 8:64 0 1.8T 0 disk ├─/dev/sde2 8:66 0 1.8T 0 part └─/dev/sde1 8:65 0 128M 0 part /dev/sdc 8:32 0 477G 0 disk ├─/dev/sdc2 8:34 0 372G 0 part /home├─/dev/sdc5 8:37 0 9.5G 0 part [SWAP]├─/dev/sdc3 8:35 0 1K 0 part └─/dev/sdc1 8:33 0 95.4G 0 part //dev/loop3 7:3 0 89.3M 1 loop /snap/core/6673lsblk -r, --raw , 裸格式输出 ➜ ~ lsblk -rNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTloop1 7:1 0 55.8M 1 loop /snap/kata-containers/288sdd 8:48 0 1.8T 0 disk sdd1 8:49 0 1.8T 0 part sdb 8:16 0 119.2G 0 disk sdb2 8:18 0 915M 0 part sdb1 8:17 0 118.4G 0 part loop4 7:4 0 69.8M 1 loop /snap/kata-containers/352sr0 11:0 1 1024M 0 rom loop2 7:2 0 89.4M 1 loop /snap/core/6818loop0 7:0 0 88.4M 1 loop /snap/core/6964sde 8:64 0 1.8T 0 disk sde2 8:66 0 1.8T 0 part sde1 8:65 0 128M 0 part sdc 8:32 0 477G 0 disk sdc2 8:34 0 372G 0 part /homesdc5 8:37 0 9.5G 0 part [SWAP]sdc3 8:35 0 1K 0 part sdc1 8:33 0 95.4G 0 part /loop3 7:3 0 89.3M 1 loop /snap/core/6673lsblk -S, --scsi 输出scsi设备(物理设备)的信息 ➜ ~ lsblk -SNAME HCTLTYPE VENDOR MODEL REV TRANsdd 2:0:0:0 disk ATA ST2000DM008-2FR1 0001 satasdb 0:0:0:0 disk ATA M4-CT128M4SSD1 000F satasr0 5:0:0:0 rom ASUS DRW-24D3ST1.01 satasde 4:0:0:0 disk ATA WDC WD20EZRX-00D 0A80 satasdc 1:0:0:0 disk ATA INTEL SSDSC2KW51 002C satalsblk -s, --inverse , 打印分区的依赖设备反序列输出,分区指向设备. ➜ ~ lsblk -sNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTloop1 7:1 0 55.8M 1 loop /snap/kata-containers/288sdd1 8:49 0 1.8T 0 part └─sdd 8:48 0 1.8T 0 disk sdb2 8:18 0 915M 0 part └─sdb 8:16 0 119.2G 0 disk sdb1 8:17 0 118.4G 0 part └─sdb 8:16 0 119.2G 0 disk loop4 7:4 0 69.8M 1 loop /snap/kata-containers/352sr0 11:0 1 1024M 0 rom loop2 7:2 0 89.4M 1 loop /snap/core/6818loop0 7:0 0 88.4M 1 loop /snap/core/6964sde2 8:66 0 1.8T 0 part └─sde 8:64 0 1.8T 0 disk sde1 8:65 0 128M 0 part └─sde 8:64 0 1.8T 0 disk sdc2 8:34 0 372G 0 part /home└─sdc 8:32 0 477G 0 disk sdc5 8:37 0 9.5G 0 part [SWAP]└─sdc 8:32 0 477G 0 disk sdc3 8:35 0 1K 0 part └─sdc 8:32 0 477G 0 disk sdc1 8:33 0 95.4G 0 part /└─sdc 8:32 0 477G 0 disk loop3 7:3 0 89.3M 1 loop /snap/core/6673lsblk -t, --topology 打印块设备的拓扑结构.同 lsblk -o NAME,ALIGN-MENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME. ➜ ~ lsblk -tNAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE RA WSAMEloop1 0 512 0 512 512 1 none 128 128 0Bsdd 0 4096 0 4096 512 1 cfq128 128 0B└─sdd1 0 4096 0 4096 512 1 cfq128 128 0Bsdb 0 512 0 512 512 0 cfq128 128 0B├─sdb2 0 512 0 512 512 0 cfq128 128 0B└─sdb1 0 512 0 512 512 0 cfq128 128 0Bloop4 0 512 0 512 512 1 none 128 128 0Bsr0 0 512 0 512 512 1 cfq128 128 0Bloop2 0 512 0 512 512 1 none 128 128 0Bloop0 0 512 0 512 512 1 none 128 128 0Bsde 0 4096 0 4096 512 1 cfq128 128 0B├─sde2 0 4096 0 4096 512 1 cfq128 128 0B└─sde1 3072 4096 0 4096 512 1 cfq128 128 0Bsdc 0 512 0 512 512 0 cfq128 128 0B├─sdc2 0 512 0 512 512 0 cfq128 128 0B├─sdc5 0 512 0 512 512 0 cfq128 128 0B├─sdc3 0 512 0 512 512 0 cfq128 128 0B└─sdc1 0 512 0 512 512 0 cfq128 128 0Bloop3 0 512 0 512 512 1 none 128 128 0Blsblk -V, --version 查看版本号 ➜ ~ lsblk -Vlsblk,来自 util-linux 2.27.1lsblk -x, --sort colum, 指定字段对输出信息排序 ➜ ~ lsblk -S -x NAMENAME HCTLTYPE VENDOR MODEL REV TRANsdb 0:0:0:0 disk ATA M4-CT128M4SSD1 000F satasdc 1:0:0:0 disk ATA INTEL SSDSC2KW51 002C satasdd 2:0:0:0 disk ATA ST2000DM008-2FR1 0001 satasde 4:0:0:0 disk ATA WDC WD20EZRX-00D 0A80 satasr0 5:0:0:0 rom ASUS DRW-24D3ST1.01 sata应用场景: 确认从磁盘上会否ssdlsblk -d -o +rota➜ ~ lsblk -d -o +rota NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT ROTA loop1 7:1 0 55.8M 1 loop /snap/kata-containers/288 1 sdd 8:48 0 1.8T 0 disk 1 sdb 8:16 0 119.2G 0 disk 0 loop4 7:4 0 69.8M 1 loop /snap/kata-containers/352 1 sr0 11:0 1 1024M 0 rom 1 loop2 7:2 0 89.4M 1 loop /snap/core/6818 1 loop0 7:0 0 88.4M 1 loop /snap/core/6964 1 sde 8:64 0 1.8T 0 disk 1 sdc 8:32 0 477G 0 disk 0 loop3 7:3 0 89.3M 1 loop /snap/core/6673 1天地劫幽城再临归真4-5攻略:第四章归真4-5八回合图文通关教学[多图],天地劫幽城再临归真4-5怎么样八回合内通
2024-03-30