Linux命令之查看设备信息

Linux命令之查看设备信息

fdisk,lsblk,df,blkidlspci

命令提示符为root@hollowman-F117:~# :在优麒麟20.10/ubuntu20.10中以hollowman用户登录,打开终端后切换到root用户进行测试
命令提示符为[root@hollowman ~]# :在RHEL8/CentOS8中直接以root用户登录并进行测试

1.fdisk -l

查看硬盘分区信息,除了查看,fdisk命令还能管理硬盘分区,包括删除分区、创建分区、格式化分区等。

root@hollowman-F117:~# fdisk -l
Disk /dev/sda:238.47 GiB,256060514304 字节,500118192 个扇区
Disk model: LITEON CV5-8Q256
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:gpt
磁盘标识符:0C4465B6-3A2E-4D5F-BA11-30C5E5E04EB4

设备           起点      末尾      扇区   大小 类型
/dev/sda1      2048    976895    974848   476M EFI 系统
/dev/sda2    976896  16601087  15624192   7.5G Linux swap
/dev/sda3  16601088 500117503 483516416 230.6G Linux 文件系统
[root@hollowman ~]# fdisk -l
Disk /dev/nvme0n1: 22 GiB, 23622320128 bytes, 46137344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x012f51fc

Device         Boot   Start      End  Sectors Size Id Type
/dev/nvme0n1p1 *       2048  2099199  2097152   1G 83 Linux
/dev/nvme0n1p2      2099200 46137343 44038144  21G 8e Linux LVM


Disk /dev/mapper/rhel-root: 19 GiB, 20346568704 bytes, 39739392 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/rhel-swap: 2 GiB, 2197815296 bytes, 4292608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

2.lsblk

list block,列出块设备信息

root@hollowman-F117:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238.5G  0 disk 
├─sda1   8:1    0   476M  0 part /boot/efi
├─sda2   8:2    0   7.5G  0 part [SWAP]
└─sda3   8:3    0 230.6G  0 part /
[root@hollowman ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0            11:0    1  6.6G  0 rom  /media/RHEL8iso
nvme0n1       259:0    0   22G  0 disk 
├─nvme0n1p1   259:1    0    1G  0 part /boot
└─nvme0n1p2   259:2    0   21G  0 part 
  ├─rhel-root 253:0    0   19G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]

3.df

disk free,显示磁盘使用情况

root@hollowman-F117:~# df -h
文件系统        容量  已用  可用 已用% 挂载点
tmpfs           1.6G  3.7M  1.6G    1% /run
/dev/sda3       231G   25G  207G   11% /
tmpfs           7.8G   16K  7.8G    1% /dev/shm
tmpfs           5.0M  4.0K  5.0M    1% /run/lock
tmpfs           4.0M     0  4.0M    0% /sys/fs/cgroup
/dev/sda1       476M  7.8M  468M    2% /boot/efi
tmpfs           1.6G  176K  1.6G    1% /run/user/1000
[root@hollowman ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               889M     0  889M   0% /dev
tmpfs                  904M     0  904M   0% /dev/shm
tmpfs                  904M  9.7M  894M   2% /run
tmpfs                  904M     0  904M   0% /sys/fs/cgroup
/dev/mapper/rhel-root   19G  4.0G   15G  21% /
/dev/sr0               6.7G  6.7G     0 100% /media/RHEL8iso
/dev/nvme0n1p1        1014M  169M  846M  17% /boot
tmpfs                  181M   16K  181M   1% /run/user/42
tmpfs                  181M  3.5M  178M   2% /run/user/0

4.blkid

block id,查看块设备id等信息

root@hollowman-F117:~# blkid
/dev/sda2: UUID="c6ff6200-b9e0-43fb-a1a5-8780cc8904c0" TYPE="swap" PARTUUID="32743170-9f38-4aec-83df-c86cede793b5"
/dev/sda3: UUID="9a8c0f9b-81d6-4518-a389-3ab635485bea" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="1e2e065c-f13c-48fe-a32c-5a06505fd1e1"
/dev/sda1: UUID="1365-F283" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="91090036-2e44-4093-b714-580122c1b5a1"
[root@hollowman ~]# blkid
/dev/mapper/rhel-root: UUID="548acdcb-e21f-4d21-8c4d-3dcdc6f39414" TYPE="xfs"
/dev/nvme0n1p2: UUID="wfT7j1-2usS-WcEw-HZ03-iwMT-L7Xk-W0Xyfw" TYPE="LVM2_member" PARTUUID="012f51fc-02"
/dev/nvme0n1: PTUUID="012f51fc" PTTYPE="dos"
/dev/nvme0n1p1: UUID="44a8c1aa-0178-474f-8964-7949983bd5b7" TYPE="xfs" PARTUUID="012f51fc-01"
/dev/sr0: UUID="2019-04-04-08-40-23-00" LABEL="RHEL-8-0-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="0da1aba4" PTTYPE="dos"
/dev/mapper/rhel-swap: UUID="57af1f4d-6974-4fe3-99c9-87229a43a6ea" TYPE="swap"

5.lspci

查看所有的pci设备,如主板、显卡、声卡等,lspci -v 可以查看每个pci设备的详细信息
此外:cpu详细信息存储在/proc/cpuinfo文件,内存信息存储着/proc/meminfo

root@hollowman-F117:~# lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 05)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation 100 Series/C230 Series Chipset Family Thermal Subsystem (rev 31)
00:16.0 Communication controller: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 (rev 31)
00:17.0 SATA controller: Intel Corporation HM170/QM170 Chipset SATA Controller [AHCI Mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #4 (rev f1)
00:1c.4 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #5 (rev f1)
00:1f.0 ISA bridge: Intel Corporation HM175 Chipset LPC/eSPI Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller (rev 31)
00:1f.3 Audio device: Intel Corporation CM238 HD Audio Controller (rev 31)
00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset Family SMBus (rev 31)
01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
03:00.0 Network controller: Intel Corporation Wireless 3165 (rev 81)

猜你喜欢

转载自blog.csdn.net/ymz641/article/details/113277966
今日推荐