之前也多多少少的了解过linux的磁盘管理,包括硬盘,逻辑盘,lvm等,但不系统,但昨天在检查linux数据库的时候还是遇到了很多的问题和困惑,就顺便又复习了一下相关知识。首先看一下磁盘的情况:df -k文件系统 1K-块 已用 可用 已用% 挂载点/dev/mapper/vg_sspdb1-lv_root 51606140 2754580 46230120 6% /tmpfs 32984140 0 32984140 0% /dev/shm/dev/sda1 495844 38042 432202 9% /boot/dev/mapper/vg_sspdb1-lv_home 777577944 201368 737877824 1% /home/dev/mapper/ssp-data 1078031100 206080 1023064216 1% /opt/sspdata看了这个后感觉分区不太合理,于是又查了磁盘的情况:fdisk -lDisk /dev/sda: 897.0 GB, 896998047744 bytes255 heads, 63 sectors/track, 109053 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0007306b注:这块磁盘分了两个区,一个是linux分区,一个是lvm分区 Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 64 109054 875461632 8e Linux LVM注:下面的三个分区是linux了lv分区,就是vg下面的lv分区Disk /dev/mapper/vg_sspdb1-lv_root: 53.7 GB, 53687091200 bytes255 heads, 63 sectors/track, 6527 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/vg_sspdb1-lv_swap: 33.8 GB, 33848033280 bytes255 heads, 63 sectors/track, 4115 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/vg_sspdb1-lv_home: 808.9 GB, 808934440960 bytes255 heads, 63 sectors/track, 98347 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sdb: 1121.5 GB, 1121501315072 bytes255 heads, 63 sectors/track, 136348 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sdc: 1121.5 GB, 1121501315072 bytes255 heads, 63 sectors/track, 136348 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000这个分区很奇怪当时看起来很一直没有搞懂,看名字也很奇怪,不像是vg或者lv分区,后面明白了,后面会继续解释的。Disk /dev/mapper/ssp-data: 1121.5 GB, 1121501315072 bytes255 heads, 63 sectors/track, 136348 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000先查一下pv信息,可以知道pv是由第一个硬盘的第二个盘构成的:pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name vg_sspdb1 PV Size 834.91 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 213735 Free PE 0 Allocated PE 213735 PV UUID JIOUSx-HSBm-L1uJ-roee-DARr-BMRw-XfgeRP然后再查vg信息:vgdisplay --- Volume group --- VG Name vg_sspdb1 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 1 Act PV 1 VG Size 834.90 GiB PE Size 4.00 MiB Total PE 213735 Alloc PE / Size 213735 / 834.90 GiB Free PE / Size 0 / 0 VG UUID 5fmSVl-1ZfR-Z01F-Ktx0-qeKg-rB97-wxk27c 然后再查询lv验证上面的疑问:lvdisplay --- Logical volume --- LV Path /dev/vg_sspdb1/lv_root LV Name lv_root VG Name vg_sspdb1 LV UUID gxYyXJ-KdQY-XivF-ZfH8-ET7H-gX5Y-WjAVak LV Write Access read/write LV Creation host, time ssp-db-1, 2014-12-05 17:42:41 +0800 LV Status available # open 1 LV Size 50.00 GiB Current LE 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Path /dev/vg_sspdb1/lv_home LV Name lv_home VG Name vg_sspdb1 LV UUID NprKvy-Uc76-JjHf-oZo2-LxBR-NS59-ima9VJ LV Write Access read/write LV Creation host, time ssp-db-1, 2014-12-05 17:42:46 +0800 LV Status available # open 1 LV Size 753.38 GiB Current LE 192865 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2 --- Logical volume --- LV Path /dev/vg_sspdb1/lv_swap LV Name lv_swap VG Name vg_sspdb1 LV UUID hD9Hx9-EonS-RpBH-Qiv0-s4kY-PeXv-Z6RaNG LV Write Access read/write LV Creation host, time ssp-db-1, 2014-12-05 17:43:52 +0800 LV Status available # open 1 LV Size 31.52 GiB Current LE 8070 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1通过上面的查询得知,大概了解了,里面的关系,但有个问题就是/dev/mapper/ssp-data,这个磁盘信息一直不知道从哪里来的:然后看一下硬盘信息,通过此信息可以知道lv和dm的对应关系 Block device 253:1和下面的major minor有关系:cat /proc/partitionsmajor minor #blocks name 8 0 875974656 sda 8 1 512000 sda1 8 2 875461632 sda2 253 0 52428800 dm-0 253 1 33054720 dm-1 253 2 789975040 dm-2 8 16 1095216128 sdb 8 32 1095216128 sdc 253 3 1095216128 dm-3 然后查询 /dev/mapper/的详细信息,看到这个上面的名字和fdisk-l的名字很像了吧,下面的就是lv名字和硬盘的对应关系,所以我们从df-k看到的就是vg_sspdb1-lv_home这种名字,其实就是个快捷链接:ll /dev/mapper/总用量 0crw-rw----. 1 root root 10, 58 12月 22 11:35 controllrwxrwxrwx. 1 root root 7 12月 22 11:45 ssp-data -> ../dm-3lrwxrwxrwx. 1 root root 7 12月 22 11:35 vg_sspdb1-lv_home -> ../dm-2lrwxrwxrwx. 1 root root 7 12月 22 11:35 vg_sspdb1-lv_root -> ../dm-0lrwxrwxrwx. 1 root root 7 12月 22 11:35 vg_sspdb1-lv_swap -> ../dm-1但是还不知道ssp-data是从哪里来的。然后再看一下存储设备及其文件系统的信息:cat /etc/fstab/dev/mapper/vg_sspdb1-lv_root / ext4 defaults 1 1UUID=1f705c1d-fc2c-43ee-87af-4900830a3ec0 /boot ext4 defaults 1 2/dev/mapper/vg_sspdb1-lv_home /home ext4 defaults 1 2/dev/mapper/vg_sspdb1-lv_swap swap swap defaults 0 0tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0/dev/mapper/ssp-data /opt/sspdata ext4 _netdev 0 0从上面的分析发现一个不一致的地方,就是ssp-data的类型是_netdev,从名字是上来看是和网络相关的。我们在接着查询。查看一下iscsi存储情况,表示此期间启用了存储。 ps -ef|grep iscsiroot 2074 1972 10 14:24 pts/0 00:00:00 grep iscsi[root@justin Packages]# chkconfig --list|grep iscsiiscsi 0:off 1:off 2:off 3:on 4:on 5:on 6:offiscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off查看一下iscsi的信息 more /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.1994-05.com.redhat:4ef28aa338b5显示磁盘阵列:iscsiadm -m node10.11.102.2:3260,9 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C1P0查看文件信息:ls /var/lib/iscsi/nodes/ iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C1P0然后查询,表示有多路径进行启动:ps -ef|grep multipathdroot 2726 1 0 2014 ? 00:01:50 /sbin/multipathdroot 10379 10358 0 11:26 pts/1 00:00:00 grep multipathd然后查看:multipath -llssp-data (3600000e00d10000000100846001f0000) dm-3 FUJITSU,ETERNUS_DX400size=1.0T features='1 queue_if_no_path' hwhandler='0' wp=rw|-+- policy='round-robin 0' prio=130 status=active| `- 14:0:0:0 sdb 8:16 active ready running`-+- policy='round-robin 0' prio=10 status=enabled `- 13:0:0:0 sdc 8:32 active ready running然后这个名字和fdisk -l中的名字对应上了。
(以上内容不代表本站观点。) --------------------------------- |