linux-查看硬盘信息下令
Linux查看硬盘信息的几种下令包罗df、du、lsblk、fdisk、smartctl。一、 df下令
df -h 是最常见的磁盘问看下令。它可以表现文件体系的总大小、已用空间、可用空间和挂载点等信息。
# df -h
Filesystem SizeUsed Avail Use% Mounted on
/dev/mapper/centos-root110G 46G 65G42% /
/dev/mapper/centos-data1.9T1.5T389G80% /data
/dev/vda2 1014M196M819M20% /boot
/dev/vdb1 1.0T 14G 1011G 2% /backup
tmpfs 41G 12G 30G29% /dev/shm
tmpfs 32G2.2G 30G 7% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
tmpfs 6.3G 40K6.3G 1% /run/user/0
tmpfs 6.3G 06.3G 0% /run/user/1001
/dev/sr0 4.3G4.3G 0 100% /mnt/cdrom
devtmpfs 32G 0 32G 0% /dev
“Size”表示文件体系总大小,“Used”表示已使用大小,“Avail”表示可用空间linux启动盘制作工具,“Use%”表示已使用百分比
二、du 下令
du下令是用于查看目录或文件占用磁盘空间的下令。
常用下令和选项,统计当前目录下的文件和目录占用空间
# du -sh *
4.0K anaconda-ks.cfg
4.0K Desktop
4.0K Documents
20K Downloads
64K install.log
12K install.log.syslog
11G logs
4.0K Music
4.0K Pictures
4.0K Public
436K soft
-s, --summarize 仅显示总计,只列出最后加总的值。
-h, --human-readable 以K,M,G为单位,提高信息的可读性。
常看指定目录下全部文件的大小(会遍历全部文件)
# du -hapache-tomcat-9.0.36/
6.5M apache-tomcat-9.0.36/webapps/java/applets
16K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado/uploader/resolver
20K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado/uploader
16K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado/view/output
20K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado/view/resolver
48K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado/view
12K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado/web/resolver
16K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado/web
88K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/dorado
36K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/bdf2/export/excel
12K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/bdf2/export/csv
8.0K apache-tomcat-9.0.36/webapps/java/WEB-INF/classes/com/bstek/bdf2/export/pdf/model
将文件从大到小排序
du -sh *|sort -rh
三、lsblk下令
lsblk该下令可以列出体系中全部块设备(如硬盘、SSD 等)的信息,包罗设备名称、容量、挂载点等。通过这个下令可以方便地了解体系硬件配置和磁盘分区环境。
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 558.9G0 disk
|-sda1 8:1 0 500M0 part /boot/efi
|-sda2 8:2 0 500M0 part /boot
`-sda3 8:3 0 557.9G0 part
|-vg_fzctpdb-LogVol00_swap (dm-0) 253:0 0 64G0 lvm
|-vg_fzctpdb-LogVol04_root (dm-1) 253:1 0 453.9G0 lvm/
|-vg_fzctpdb-LogVol03_var (dm-2)253:2 0 20G0 lvm/var
|-vg_fzctpdb-LogVol02_usr (dm-3)253:3 0 10G0 lvm/usr
`-vg_fzctpdb-LogVol01_tmp (dm-4)253:4 0 10G0 lvm/tmp
四、fdisk下令
fdisk 下令可以表现体系中全部硬盘的分区环境,包罗分区范例、容量、起始位置等信息。通过这个下令可以查看体系磁盘的物理结构和分布环境。
# fdisk -l
Disk /dev/sda: 600.1 GB, 600093712384 bytes
255 heads, 63 sectors/track, 72957 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks IdSystem
/dev/sda1 1 72958 586029015+eeGPT
Partition 1 does not start on physical sector boundary.
Disk /dev/mapper/vg_fzctpdb-LogVol00_swap: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_fzctpdb-LogVol04_root: 487.4 GB, 487369736192 bytes
255 heads, 63 sectors/track, 59252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_fzctpdb-LogVol03_var: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_fzctpdb-LogVol02_usr: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_fzctpdb-LogVol01_tmp: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x00000000
五、smartctl下令
smartctl下令是用于检测硬盘健康状态并表现相关信息的下令。它可以表现硬盘的温度、寿命预测、错误记录等信息。
# smartctl -a /dev/sda
smartctl 5.43 2016-09-28 r4347 (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
Vendor: HP
Product: LOGICAL VOLUME
Revision: 5.52
User Capacity: 600,093,712,384 bytes
Logical block size: 512 bytes
Logical Unit id: 0x600508b1001c13ef256161d9825110ea
Serial number: PDNLH0BRH981LP
Device type: disk
Local Time is: Wed Jun 19 10:24:12 2024 CST
Device supports SMART and is Enabled
Temperature Warning Disabled or Not Supported
SMART Health Status: OK
Error Counter logging not supported
Device does not support Self Test logging
https://www.linuxcool.com/lypkjzkmlff
https://zhuanlan.zhihu.com/p/688628108
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]