linux学习笔记二:硬盘信息查询
在linux管理中,硬盘管理是很重要的一部分。包括阵列,分区,逻辑卷等操作,在对硬盘操作前,需要充分的了解硬盘的信息。常用的硬盘查询有以下几种:
1.df 查看文件系统空间使用情况;
linux-lszd-db:~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 809262496 37615092 770825244 5% /
udev 8076412 164 8076248 1% /dev
tmpfs 8076412 980 8075432 1% /dev/shm
/dev/sda4 167752 11776 155976 8% /boot/efi
linux-lszd-db:~ #
[root@LSZDDB1 ~]# df
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/mapper/vg_gdyctdhis-LogVol00
255880708 52738552 190144116 22% /
tmpfs 16430728 328 16430400 1% /dev/shm
/dev/mapper/mpathap1 198337 82790 105307 45% /boot
/dev/mapper/vgdb2inst2-lvdb2app
154302476 10129308 136335064 7% /opt/db2
/dev/mapper/vgdbdata-dbdata01
619261704 34735152 553069888 6% /dbdata
[root@LSZDDB1 ~]#
2.df -lh 是最常用的命令,-h以容易理解的方式打印出来;-l计算了包含所有硬链接的大小;
linux-lszd-db:~ # df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 772G 36G 736G 5% /
udev 7.8G 164K 7.8G 1% /dev
tmpfs 7.8G 980K 7.8G 1% /dev/shm
/dev/sda4 164M 12M 153M 8% /boot/efi
linux-lszd-db:~ #
3.fdisk -l 列出所有分区,包含没有挂载的设备和usb设备:
linux-lszd-db:~ # fdisk -l
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sda‘! The util fdisk doesn‘t support GPT. Use GNU Parted.
Disk /dev/sda: 897.0 GB, 896998047744 bytes
255 heads, 63 sectors/track, 109053 cylinders, total 1751949312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x540841cb
Device Boot Start End Blocks Id System
/dev/sda1 1 1751949311 875974655+ ee GPT
Partition 1 does not start on physical sector boundary.
linux-lszd-db:~ #
4.cfdisk
linux-lszd-db:~ # cfdisk
cfdisk (util-linux 2.19.1)
Disk Drive: /dev/sda
Size: 896998047744 bytes, 896.9 GB
Heads: 255 Sectors per Track: 63 Cylinders: 109053
Name Flags Part Type FS Type [Label] Size (MB)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
sda1 NC Primary GPT 896998.05 *
[ Bootable ] [ Delete ] [ Help ] [ Maximize ] [ Print ] [ Quit ] [ Type ] [ Units ] [ Write ]
Quit program without writing partition table
5.hdparm -i /dev/hda 查看硬盘型号信息,实际操作,在suse和centos中都不支持此命令;
6.smartctl可以查看生产厂商、型号、序列号、容量、是否支持SMART、开启否。