https://blog.51cto.com/songxj/269661
linux下使用新硬盘安装系统,安装好以后再挂载原来的硬盘,分区格式全为系统默认分区,系统默认使用的是lvm格式,并且默认的卷都是 VolGroup00
使用 pvs 查看显示如下:
1
2
3
4
| [root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 136.62G 0
/dev/sdb2 VolGroup00 lvm2 a- 136.62G 0
|
发现可以正确认别到两个VG,但是同名,如何挂载呢?
解决办法是,将原来的VG更名,解决冲突即可挂载。
重命名格式为:
1
| vgrename VolGroup00 VolGroup01
|
此时会提示:
1
2
| [root@localhost ~]# vgrename VolGroup00 VolGroup01
Found more than one VG called VolGroup00. Please supply VG uuid.
|
原因是存在两个 VolGroup00,修改的方法他已经提示了要指定 VG uuid即可。
查看VG uuid的命令为:
1
2
3
4
5
6
7
| [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 1 2 0 136.62G 0 dcHa6G-abU2-Xfq8-EPBm-jBLj-sf18-O5uH0U
VolGroup00 wz--n- 32.00M 1 2 0 136.62G 0 OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9
|
查到VG uuid以后,再次执行改名:
1
2
| [root@localhost ~]# vgrename OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9 VolGroup01
Volume group "VolGroup00" still has active LVs
|
修改成功以后,再执行:lvscan
1
2
3
4
5
| [root@localhost ~]# lvscan
inactive '/dev/VolGroup01/LogVol00' [130.84 GB] inherit
inactive '/dev/VolGroup01/LogVol01' [5.78 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol00' [130.84 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.78 GB] inherit
|
可以看到新修改的VolGroup01是inactive状态。
再使用vgchange 加载 VolGroup01
1
2
| [root@localhost ~]# vgchange -ay /dev/VolGroup01
2 logical volume(s) in volume group "VolGroup01" now active
|
最后 mount 就可以
1
| [root@localhost ~]# mount /dev/VolGroup01/LogVol00 /mnt/old
|
至此,全部完成。