CentOS挂载lvm分区重名问题的解决办法
人气:0
今天一个朋友的服务器硬盘出现问题,换了新硬盘安装好系统后,挂载老硬盘时出现了问题, 在linux下使用新硬盘安装系统,安装好以后再挂载原来的硬盘,分区格式全为系统默认分区,系统默认使用的
是lvm格式,并且默认的卷都是 VolGroup00,好了,知道问题的原因就好办了,下面我们来解决这个问题
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 372.50G 0
/dev/sdb2 VolGroup00 lvm2 a- 136.62G 0
[root@localhost ~]# vgrename VolGroup00 VolGroup01
Found more than one VG called VolGroup00. Please supply VG uuid.
[root@localhost ~]# vgs -v
Finding all volume groups
Finding volume group "VolGroup00"
Finding volume group "VolGroup00"
VG Attr Ext #PV #LV #SN VSize VFree VG UUID
VolGroup00 wz--n- 32.00M 120372.50G 0 dcHa6G-abU2-Xfq8-EPBm-jBLj-sf18-O5uH0U
VolGroup00 wz--n- 32.00M 120136.62G 0 OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9
[root@localhost ~]# vgrename OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9 VolGroup01
Volume group "VolGroup00" still has active LVs
[root@localhost ~]# lvscan
inactive '/dev/VolGroup01/LogVol00' [130.84 GB] inherit
inactive '/dev/VolGroup01/LogVol01' [1.94 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol00' [367.09 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.41 GB] inherit
[root@localhost ~]# vgchange -ay /dev/VolGroup01
2 logical volume(s) in volume group "VolGroup01" now active
再执行 :lvscan
[root@localhost ~]# lvscan
ACTIVE '/dev/VolGroup01/LogVol00' [134.69 GB] inherit
ACTIVE '/dev/VolGroup01/LogVol01' [1.94 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol00' [367.09 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.41 GB] inherit
[root@localhost ~]# mount /dev/VolGroup01/LogVol00 /data/www
是lvm格式,并且默认的卷都是 VolGroup00,好了,知道问题的原因就好办了,下面我们来解决这个问题
使用 pvs 查看显示如下:
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 372.50G 0
/dev/sdb2 VolGroup00 lvm2 a- 136.62G 0
发现可以正确认别到两个VG,但是同名,如何挂载呢?
解决办法是,将原来的VG更名,解决冲突即可挂载。
重命名格式为:vgrename VolGroup00 VolGroup01
此时会提示:
[root@localhost ~]# vgrename VolGroup00 VolGroup01
Found more than one VG called VolGroup00. Please supply VG uuid.
原因是存在两个 VolGroup00,修改的方法他已经提示了要指定 VG uuid即可。
查看VG uuid的命令为:
[root@localhost ~]# vgs -v
Finding all volume groups
Finding volume group "VolGroup00"
Finding volume group "VolGroup00"
VG Attr Ext #PV #LV #SN VSize VFree VG UUID
VolGroup00 wz--n- 32.00M 120372.50G 0 dcHa6G-abU2-Xfq8-EPBm-jBLj-sf18-O5uH0U
VolGroup00 wz--n- 32.00M 120136.62G 0 OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9
查到VG uuid以后,再次执行改名:
[root@localhost ~]# vgrename OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9 VolGroup01
Volume group "VolGroup00" still has active LVs
修改成功以后,再执行:lvscan
[root@localhost ~]# lvscan
inactive '/dev/VolGroup01/LogVol00' [130.84 GB] inherit
inactive '/dev/VolGroup01/LogVol01' [1.94 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol00' [367.09 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.41 GB] inherit
可以看到新修改的VolGroup01是inactive状态。
再使用vgchange 加载 VolGroup01
[root@localhost ~]# vgchange -ay /dev/VolGroup01
2 logical volume(s) in volume group "VolGroup01" now active
再执行 :lvscan
[root@localhost ~]# lvscan
ACTIVE '/dev/VolGroup01/LogVol00' [134.69 GB] inherit
ACTIVE '/dev/VolGroup01/LogVol01' [1.94 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol00' [367.09 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.41 GB] inherit
可以发现VolGroup01已经是ACTIVE状态了。
最后 mount 就可以
[root@localhost ~]# mount /dev/VolGroup01/LogVol00 /data/www
至此,全部完成。
加载全部内容