常用的硬盘分区及空间信息查看命令
lsblk: 列出所有的block设备, 但是只显示大小不显示使用率,还可以显示为挂在的设备
[root@centosgpt grub2]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 2M 0 part
├─sda2 8:2 0 1G 0 part /boot
├─sda3 8:3 0 59G 0 part
│ ├─centos-root 253:0 0 50G 0 lvm /
│ ├─centos-swap 253:1 0 4G 0 lvm [SWAP]
│ └─centos-home 253:4 0 5G 0 lvm /home
├─sda5 8:5 0 1G 0 part
│ └─md0 9:0 0 2G 0 raid5
│ └─raidvg-raidlv 253:2 0 1.5G 0 lvm /srv/raidlvm
sdb 8:16 0 20G 0 disk
├─sdb1 8:17 0 1M 0 part
├─sdb2 8:18 0 1G 0 part
└─sdb3 8:19 0 19G 0 part
└─ubuntu--vg-ubuntu--lv 253:3 0 4G 0 lvm
sr0 11:0 1 748M 0 rom
blkid 列出设备的属性比如uuid或者使用文件系统类型
[root@centosgpt grub2]# blkid
/dev/sr0: UUID="2019-04-16-20-20-34-00" LABEL="Ubuntu-Server 19.04 amd64" TYPE="iso9660" PTTYPE="dos"
/dev/sdb1: PARTUUID="5bb86b73-7f4f-42c3-8a8c-d9bd1744ffee"
/dev/sda1: PARTUUID="da862574-be0e-4364-b954-ac2e2ff51659"
lshw 打印硬件信息
[root@centosgpt ~]# lshw -class disk
*-cdrom
description: DVD-RAM writer
product: VMware IDE CDR10
vendor: NECVMWar
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/cdrom
logical name: /dev/sr0
version: 1.00
capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
configuration: ansiversion=5 status=ready
*-medium
physical id: 0
logical name: /dev/cdrom
capabilities: partitioned partitioned:dos
configuration: signature=73a9f942
*-disk:0
description: SCSI Disk
product: VMware Virtual S
vendor: VMware,
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 1.0
size: 100GiB (107GB)
capabilities: 7200rpm gpt-1.00 partitioned partitioned:gpt
configuration: ansiversion=2 guid=6f9e1f55-c4aa-4230-a765-601e0ce4953f logicalsectorsize=512 sectorsize=512
fdisk/gdisk:格式化硬盘分区工具
[root@centosgpt ~]# fdisk -l /dev/sda
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: gpt
Disk identifier: 6F9E1F55-C4AA-4230-A765-601E0CE4953F
# Start End Size Type Name
1 2048 6143 2M BIOS boot
2 6144 2103295 1G Microsoft basic
3 2103296 125843455 59G Linux LVM
5 125843456 127940607 1G Linux RAID Linux RAID
6 127940608 130037759 1G Linux RAID Linux RAID
7 130037760 132134911 1G Linux RAID Linux RAID
parted: 分区工具
[root@centosgpt ~]# parted /dev/sda print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot
Number Start End Size File system Name Flags
1 1049kB 3146kB 2097kB bios_grub
2 3146kB 1077MB 1074MB xfs
3 1077MB 64.4GB 63.4GB lvm
5 64.4GB 65.5GB 1074MB Linux RAID raid
6 65.5GB 66.6GB 1074MB Linux RAID raid
7 66.6GB 67.7GB 1074MB Linux RAID raid
df:可以显示文件系统及使用情况
[root@centosgpt ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/centos-root 52403200 4505552 47897648 9% /
devtmpfs 920572 0 920572 0% /dev
tmpfs 932652 0 932652 0% /dev/shm
tmpfs 932652 9788 922864 2% /run
tmpfs 932652 0 932652 0% /sys/fs/cgroup
/dev/sda2 1038336 207620 830716 20% /boot
/dev/mapper/raidvg-raidlv 1558528 33072 1525456 3% /srv/raidlvm
/dev/mapper/centos-home 5232640 132072 5100568 3% /home
tmpfs 186532 0 186532 0% /run/user/0
lsscsi:显示SCSI设备信息
[root@centosgpt ~]# lsscsi
[0:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
[0:0:1:0] disk VMware, VMware Virtual S 1.0 /dev/sdb
[2:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0
[root@centosgpt ~]#
mount 挂在,卸载,显示挂载文件系统
[root@centosgpt ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=920572k,nr_inodes=230143,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
参考:
9 commands to check hard disk partitions and disk space on Linux
Be First to Comment