linux查看磁盘及磁盘类型

2021/6/17 7:32:28

本文主要是介绍linux查看磁盘及磁盘类型,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1.查看磁盘

使用df -h,查看当前硬盘信息,但不会显示未挂载的磁盘

[root@node1 ~]# df -h
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root  1.1T   80G  971G    8% /
devtmpfs                 126G     0  126G    0% /dev
tmpfs                    126G     0  126G    0% /dev/shm
tmpfs                    126G  3.3M  126G    1% /run
tmpfs                    126G     0  126G    0% /sys/fs/cgroup
/dev/sde3                1.8T   25G  1.7T    2% /data12
/dev/sdd4                1.8T  109G  1.6T    7% /data9
/dev/sdc1                1.8T  1.4T  338G   81% /data3
/dev/sdc2                1.8T  1.5T  306G   83% /data4
/dev/sdd3                1.8T  126G  1.6T    8% /data8
/dev/sdb1                1.8T  1.5T  243G   87% /data1
/dev/sdd2                1.8T  117G  1.6T    7% /data7
/dev/sdb2                1.8T  1.5T  249G   86% /data2
/dev/sdd1                1.8T  881G  861G   51% /data6
/dev/sde2                1.8T   16G  1.7T    1% /data11
/dev/sde1                1.8T   20G  1.7T    2% /data10
/dev/sde4                1.8T   95G  1.7T    6% /data5
/dev/mapper/centos-home  2.6T  1.1T  1.5T   43% /home
/dev/sda2               1014M  214M  801M   22% /boot
/dev/sda1                200M   11M  189M    6% /boot/efi
tmpfs                     26G     0   26G    0% /run/user/0
cm_processes             126G  8.0G  118G    7% /run/cloudera-scm-agent/process
.....

使用fdisk -l,查看所有磁盘信息,显示未挂载的磁盘

[root@node1 ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

磁盘 /dev/sde:8001.6 GB, 8001563222016 字节,15628053168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:gpt
Disk identifier: 7602EB92-8E94-4926-83AC-239615E1127A


#         Start          End    Size  Type            Name
 1           34   3906250000    1.8T  Microsoft basic primary
Partition 1 does not start on physical sector boundary.
 2   3906250752   7812499455    1.8T  Microsoft basic primary
 3   7812499456  11718750207    1.8T  Microsoft basic primary
 4  11718750208  15625000959    1.8T  Microsoft basic primary
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

磁盘 /dev/sdd:8001.6 GB, 8001563222016 字节,15628053168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:gpt
Disk identifier: D6DD4D62-3760-43B8-84E2-C2E1EA58F25B


#         Start          End    Size  Type            Name
 1           34   3906250000    1.8T  Microsoft basic primary
Partition 1 does not start on physical sector boundary.
 2   3906250752   7812499455    1.8T  Microsoft basic primary
 3   7812499456  11718750207    1.8T  Microsoft basic primary
 4  11718750208  15625000959    1.8T  Microsoft basic primary
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

磁盘 /dev/sda:4000.8 GB, 4000787030016 字节,7814037168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:gpt
Disk identifier: BF2C7713-20A2-4993-9067-F44F0C957290


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic 
 3      2508800   7814035455    3.7T  Linux LVM       
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

磁盘 /dev/sdc:4000.8 GB, 4000787030016 字节,7814037168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:gpt
Disk identifier: 47F028E4-71B5-45EA-8550-0DA97E0C2D60


#         Start          End    Size  Type            Name
 1         2048   3907018751    1.8T  Microsoft basic primary
 2   3907018752   7814035455    1.8T  Microsoft basic primary
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

磁盘 /dev/sdb:4000.8 GB, 4000787030016 字节,7814037168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:gpt
Disk identifier: 7CC7B9DF-1EEC-4B3F-8296-B9F4D3E6EDFF


#         Start          End    Size  Type            Name
 1         2048   3907018751    1.8T  Microsoft basic primary
 2   3907018752   7814035455    1.8T  Microsoft basic primary

........

2.查看磁盘类型

使用cat /sys/block/sda/queue/rotational,命令中的sda是磁盘名称。
返回结果:
返回0:SSD盘(固态硬盘)
返回1:SATA盘(使用SATA口的机械硬盘)

[root@node1 ~]# cat /sys/block/sda/queue/rotational
1

3.SSD盘和SATA盘优缺点

SATA机械硬盘:

  • 优点:容量大,价格低,技术成熟,存储可靠。
  • 缺点:速度相对于固态较慢,介质越到边缘速度越慢,安全性不高(发生断电、碰撞容易坏),读取数据有轻微响声。

SSD固体硬盘:

  • 优点:无噪音,体积小,速度快,更省电 ,重量轻 ,发热小。
  • 缺点:容量相对小 ,价格昂贵。


这篇关于linux查看磁盘及磁盘类型的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程