系统有如下磁盘空间信息,说明一个boot分区,一个lvm:
[root@gtlions mapper]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/mapper/vg_gtlions-lv_root
2.2T 19G 2.1T 1% /
tmpfs 32G 0 32G 0% /dev/shm
/dev/sda1 485M 59M 401M 13% /boot
通过fdisk查看磁盘,有两块盘,161GB的sda和2336GB的sdb,注意/dev/sda和/dev/sdb显示的都是物理信息,然后接着/dev/mapper/vg_gtlions-lv_root和/dev/mapper/vg_gtlions-lv_swap是lvm逻辑信息:
[root@gtlions mapper]# fdisk -l
Disk /dev/sda: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd7099ee2
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 19582 156773376 8e Linux LVM
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 2336.7 GB, 2336730644480 bytes
255 heads, 63 sectors/track, 284091 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 1 267350 2147483647+ ee GPT
Disk /dev/mapper/vg_gtlions-lv_root: 2427.4 GB, 2427449245696 bytes
255 heads, 63 sectors/track, 295120 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gtlions-lv_swap: 69.8 GB, 69809995776 bytes
255 heads, 63 sectors/track, 8487 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
接着使用sar监控磁盘的时候出现的dev8-0、dev8-16、dev253-0和dev253-1之类的东西又是什么呢?
[root@gtlions mapper]# sar -d 1 1
Linux 2.6.32-279.el6.x86_64 (gtlions) 2014年03月28日 _x86_64_ (32 CPU)
10时08分40秒 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
10时08分41秒 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
10时08分41秒 dev8-16 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
10时08分41秒 dev253-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
10时08分41秒 dev253-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
[root@gtlions mapper]# iostat 1 1
Linux 2.6.32-279.el6.x86_64 (gtlions) 2014年03月28日 _x86_64_ (32 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.01 0.00 0.29 0.23 0.00 99.47
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 19.99 2.04 2727.71 124446 166102906
sdb 289.48 35355.91 32758.29 2152986394 1994804816
dm-0 4575.29 35357.62 35486.00 2153090330 2160907704
dm-1 0.01 0.09 0.00 5592 0
这个其实是磁盘映射逻辑名称的关系,通过下面两个命令可以看的非常清楚,说明dev253-0 对应的是dm-0,:
[root@gtlions mapper]# dmsetup ls
vg_gtlions-lv_swap (253:1)
vg_gtlions-lv_root (253:0)
[root@gtlions mapper]# more /proc/partitions
major minor #blocks name
8 0 157286400 sda
8 1 512000 sda1
8 2 156773376 sda2
8 16 2281963520 sdb
8 17 2281961472 sdb1
253 0 2370555904 dm-0
253 1 68173824 dm-1
或者也可以查看下面信息:
[root@gtlions mapper]# ll /dev/mapper/
总用量 0
crw-rw---- 1 root root 10, 58 3月 27 17:14 control
lrwxrwxrwx 1 root root 7 3月 27 17:14 vg_gtlions-lv_root -> ../dm-0
lrwxrwxrwx 1 root root 7 3月 27 17:14 vg_gtlions-lv_swap -> ../dm-1
[root@gtlions vg_gtlions]# ll /dev/vg_gtlions
总用量 0
lrwxrwxrwx 1 root root 7 3月 27 17:14 lv_root -> ../dm-0
lrwxrwxrwx 1 root root 7 3月 27 17:14 lv_swap -> ../dm-1
还有其他相关的文件也可以查看,比如/dev/disk目录下的文件;
至于lvm和磁盘的映射关系还可以通过lvm的命令pvdisplay来查看。
-EOF-
作者:gtlions 发表于2014-3-28 22:33:20
原文链接