linux 硬盘相关命令学习

summary:

  • 查看硬盘信息:几块硬盘,品牌,容量
  • 查看分区信息

参考资料:

Linux下查看磁盘分区命令详解: http://blog.chinaunix.net/uid-26119273-id-3167576.html

Linux技巧-如何查看系统信息-硬盘、分区信息以及磁盘用量: http://blog.csdn.net/hs794502825/article/details/9029217

lvm介绍(物理卷/卷组/逻辑卷/物理扩展): http://freeloda.blog.51cto.com/2033581/1231089

 

常用命令:

 

  1. df (display fileSystem)

 

   df displays the amount of disk space available on the file system containing each file name argument.  显示磁盘使用空间

机器1:

[root@bo ~]# df -h
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/vg_bo-lv_root   50G   12G   36G  24% /
tmpfs                       16G     0   16G   0% /dev/shm
/dev/sda1                  485M   33M  427M   8% /boot
/dev/mapper/vg_bo-lv_home  852G  231G  578G  29% /home

  /  根目录下有50G

  tmpfs 占用16G (此目录作用?)

  /boot 485M 已用33M 可用427M 

  /home 852G 已用231G 可用578G

机器2:

[root@wellav ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_wellav-lv_root
                       50G   16G   32G  34% /
tmpfs                  32G     0   32G   0% /dev/shm
/dev/sda1             485M   32M  429M   7% /boot
/dev/mapper/vg_wellav-lv_home
                       11T  864G  8.8T   9% /home
/dev/mapper/vg_wellav-lv_tmp
                      197G  191M  187G   1% /tmp
/dev/mapper/vg_wellav-lv_usr
                      197G  1.3G  186G   1% /usr
/dev/mapper/vg_wellav-lv_var
                      197G  1.6G  186G   1% /var

通过机器1,2推测:FileSystem 为文件系统,相当与分区。1块硬盘可做多个分区(好比windows系统的C,D,E盘符)。/dev/sda1 是系统引导盘,系统有1块硬盘总容量大概12T。

/dev/mapper/vg_~ 是分区,机器2,把硬盘分了多个分区:

/dev/mapper/vg_wellav-lv_root
/dev/mapper/vg_wellav-lv_home
/dev/mapper/vg_wellav-lv_tmp
/dev/mapper/vg_wellav-lv_usr
/dev/mapper/vg_wellav-lv_var

2. lsblk

lsblk  lists  information  about all or the specified block devices. 

机器1:

[root@bo sysbench]# lsblk 
NAME                     MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                        8:0    0   931G  0 disk 
├─sda1                     8:1    0   500M  0 part /boot
└─sda2                     8:2    0 930.5G  0 part 
  ├─vg_bo-lv_root (dm-0) 253:0    0    50G  0 lvm  /
  ├─vg_bo-lv_swap (dm-1) 253:1    0  15.7G  0 lvm  [SWAP]
  └─vg_bo-lv_home (dm-2) 253:2    0 864.8G  0 lvm  /home
sr0                       11:0    1  1024M  0 rom  

 机器2:

[root@wellav ~]# lsblk
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                            8:0    0  10.9T  0 disk 
├─sda1                         8:1    0   500M  0 part /boot
└─sda2                         8:2    0  10.9T  0 part 
  ├─vg_wellav-lv_root (dm-0) 253:0    0    50G  0 lvm  /
  ├─vg_wellav-lv_swap (dm-1) 253:1    0  31.5G  0 lvm  [SWAP]
  ├─vg_wellav-lv_var (dm-2)  253:2    0   200G  0 lvm  /var
  ├─vg_wellav-lv_home (dm-3) 253:3    0  10.3T  0 lvm  /home
  ├─vg_wellav-lv_tmp (dm-4)  253:4    0   200G  0 lvm  /tmp
  └─vg_wellav-lv_usr (dm-5)  253:5    0   200G  0 lvm  /usr
sr0                           11:0    1  1024M  0 rom 

 

其中type列:disk, part, lvm, rom; 确定了sda为硬盘,下分为2个分区sda1( boot分区), sda2(系统分区);sda2下分为多个虚拟分区(lvm),挂载到不同目录。
关于磁盘分区,卷组,逻辑卷组,物理扩展,参见参考3

 

3. smartctl -a /dev/sda

查看硬盘厂商等信息,此工具需要单独安装;

 

[root@qa ~]# smartctl -a /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-642.6.2.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

Vendor:               DELL
Product:              PERC H710
Revision:             3.13
User Capacity:        9,999,220,736,000 bytes [9.99 TB]
Logical block size:   512 bytes
Logical Unit id:      0x6c81f660cd7589001d5afbf60f03b0c8
Serial number:        00c8b0030ff6fb5a1d008975cd60f681
Device type:          disk
Local Time is:        Wed Nov 23 11:28:58 2016 UTC
Device does not support SMART

Error Counter logging not supported
Device does not support Self Test logging

 


dell品牌,型号 PERC H710, 容量:9.99TB;

 

 

 

posted @ 2016-11-28 10:39  南坡小枣  阅读(628)  评论(0编辑  收藏  举报