磁盘阵列上的文件访问不了--原因是lvm不能activate,解决办法
描述:
系统布局如上图,
现,虚拟机上的centos系统突然不能访问磁盘阵列上的文件。
原有设计如下:
虚拟机上的centos系统挂载磁盘阵列上的两个磁盘,multipath成一个设备,用lvm创建逻辑卷组,再创建两个文件系统,一个为GFS,一个为ext3。
以前运行好好的,前天突然,两个磁盘都找不到。
用fdsik -l 查看,发现
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2349 18763920 8e Linux LVM
/dev/sda3 2350 2610 2096482+ 82 Linux swap / Solaris
Disk /dev/sdb: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Device Boot Start End Blocks Id System
Disk /dev/sdc: 2186.1 GB, 2186137829376 bytes
255 heads, 63 sectors/track, 265782 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 2186.1 GB, 2186137829376 bytes
255 heads, 63 sectors/track, 265782 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 20 MB, 20971520 bytes
1 heads, 40 sectors/track, 1024 cylinders
Units = cylinders of 40 * 512 = 20480 bytes
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/dm-1: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Disk /dev/sdf: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Device Boot Start End Blocks Id System
Disk /dev/sdg: 2186.1 GB, 2186137829376 bytes
255 heads, 63 sectors/track, 265782 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdg doesn't contain a valid partition table
Disk /dev/sdh: 2186.1 GB, 2186137829376 bytes
255 heads, 63 sectors/track, 265782 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdh doesn't contain a valid partition table
Disk /dev/sdi: 20 MB, 20971520 bytes
1 heads, 40 sectors/track, 1024 cylinders
Units = cylinders of 40 * 512 = 20480 bytes
Disk /dev/sdi doesn't contain a valid partition table
Disk /dev/dm-2: 2186.1 GB, 2186137829376 bytes
255 heads, 63 sectors/track, 265782 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-2 doesn't contain a valid partition table
Disk /dev/dm-3: 2186.1 GB, 2186137829376 bytes
255 heads, 63 sectors/track, 265782 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-3 doesn't contain a valid partition table
查看/etc/fstab结果:
/dev/VolG_VMCentOS/LogVol_Root / ext3 defaults 1 1
LABEL=/boot /boot ext2 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
/dev/volg_public_data/lvol_ftp /var/ftp gfs2 defaults,lockproto=lock_nolock 0 0
/dev/volg_samba_users_data/lvol_samba_users_data /home/EMBEDDED ext3 defaults 0 0
# Beginning of the block added by the VMware software
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0
# End of the block added by the VMware software
在/dev下没有volg_public_data跟volg_samba_users_data这两个文件夹。
命令 fsck.gfs2 /dev/mapper/Public_Data_1
Initializing fsck
Either the super block is corrupted, or this is not a GFS2 filesystem
fsck.ext3 /dev/mapper/Public_Data_1
e2fsck 1.39 (29-May-2006)
Couldn't find ext2 superblock, trying backup blocks...
fsck.ext3: Bad magic number in super-block while trying to open /dev/mapper/Public_Data_1
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
fsck.ext3 /dev/mapper/samba_users_data
e2fsck 1.39 (29-May-2006)
Couldn't find ext2 superblock, trying backup blocks...
fsck.ext3: Bad magic number in super-block while trying to open /dev/mapper/samba_users_data
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
不知道是什么问题
============================================================
经研究发现,前面的分析方法有误:
/dev/mapper/Public_Data_1 上面加了一层lvm,不能直接用fsck来检查,可以用pvck来检查,/dev/mapper/Public_Data_1存在而没有/dev/volg_public_data/lvol_ftp目录文件是因为改逻辑卷组没有activate,可以用vgdisplay查看到/dev/mapper/Public_Data_1上的lvm系统是完好的,这时可以用vgchange -ay来activate它,在使用vgchange -ay命令时发现有Skipping clustered volume group volg_public_data这样的字符串出现,解决办法是把/etc/lvm/lvm.conf 文件中的locking_type设置为 0,然后,再用vgchange 命令activate即可。
BTW:若删除一个ISCSI磁盘,在client的multipath下还是可以看到的,类似于下面的结果,multipath -ll
sdf: checker msg is "tur checker reports path is down"
sdg: checker msg is "tur checker reports path is down"
web_backup (36001c23000d1a0cf000024e54854a62c) dm-1 DELL,MD3000i
[size=100G][features=0][hwhandler=0]
\_ round-robin 0 [prio=2][active]
\_ 2:0:0:0 sdd 8:48 [active][ready]
\_ 1:0:0:0 sdb 8:16 [active][ready]
mpath5 (1_) dm-3 DELL,MD3000i
[size=1.0G][features=0][hwhandler=0]
\_ round-robin 0 [prio=0][enabled]
\_ 1:0:0:1 sdf 8:80 [active][faulty]
\_ 2:0:0:1 sdg 8:96 [active][faulty]
可以用
echo 1 > /sys/bus/scsi/devices/2\:0\:0\:1/delete
echo 1 > /sys/bus/scsi/devices/1\:0\:0\:1/delete
multipath -F
命令把他删掉,再用multipath -ll就没有了
类似的还有echo 1 > /sys/bus/scsi/devices/2\:0\:0\:1/rescan重新扫描,
举一反三。。。