参考此文解决:
http://www.hackbase.com/tech/2011-04-29/63525.html
下面是引用此文的内容:
周末朋友的服务器硬盘出问题了,让IDC的人挂了个IDE硬盘把系统安装好,然后再挂上以前的SATA硬盘,想把数据倒腾出来,结果哥们发现他搞不定,给我打电话求助。我远程上去看了下,发现2块盘系统做的都是LVM分区格式8e,不是ext3的83,难怪他不会挂载,而且还有个问题就是卷组都是默认安装的同一个名字VolGroup00。
[root@locallhost ~]# pvs ##好命令,显示所有的lvm相关的物理卷:PV
PV VG Fmt Attr PSize PFree
/dev/hda2 VolGroup00 lvm2 a- 74.41G 0
/dev/sda2 VolGroup00 lvm2 a- 232.78G 0
hda2是新系统盘74G多,sda2是老数据盘232G多。卷组名称一样,因为2个系统安装的时候都是默认安装的。
[root@locallhost ~]# vgs ##好命令,显示所有的lvm相关的卷组:VG
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 232.78G 0
VolGroup00 1 2 0 wz--n- 74.41G 0
我们先用vgrename改卷组名:
[root@locallhost ~]# vgrename VolGroup00 aaalvm
Found more than one VG called VolGroup00. Please supply VG uuid.
直接报有同名,需要用uuid。查uuid可以用vgdisplay或vgs -v:
[root@locallhost ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 232.78 GB
PE Size 32.00 MB
Total PE 7449
Alloc PE / Size 7449 / 232.78 GB
Free PE / Size 0 / 0
VG UUID bAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR3Ct
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.41 GB
PE Size 32.00 MB
Total PE 2381
Alloc PE / Size 2381 / 74.41 GB
Free PE / Size 0 / 0
VG UUID YHLmkq-b1xS-UzAS-Y3nv-6vaX-2Xou-GScvk0
[root@locallhost ~]# vgs -v
Finding all volume groups
Finding volume group "VolGroup00"
Archiving volume group "VolGroup00" metadata (seqno 3).
Archiving volume group "VolGroup00" metadata (seqno 3).
Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3).
Finding volume group "VolGroup00"
Archiving volume group "VolGroup00" metadata (seqno 3).
Archiving volume group "VolGroup00" metadata (seqno 3).
Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3).
VG Attr Ext #PV #LV #SN VSize VFree VG UUID
VolGroup00 wz--n- 32.00M 1 2 0 232.78G 0 bAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR3Ct
VolGroup00 wz--n- 32.00M 1 2 0 74.41G 0 YHLmkq-b1xS-UzAS-Y3nv-6vaX-2Xou-GScvk0
查到数据盘的uuid是bAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR3Ct,改卷组名的时候用uuid,如下:
[root@locallhost ~]# vgrename bAydq6-rv9e-wCa0-iK2f-zFWn-UBUr-4AR3Ct aaalvm ##根据测试,这个命令可以在系统lvm卷已经挂载上去的时候运行。
Volume group "VolGroup00" successfully renamed to "aaalvm"
ok了,改完再vgs看下:
[root@locallhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 74.41G 0
aaalvm 1 2 0 wz--n- 232.78G 0
没问题了,再lvscan下:
[root@locallhost ~]# lvscan ##好命令
inactive ‘/dev/aaalvm/LogVol00‘ [228.84 GB] inherit
inactive ‘/dev/aaalvm/LogVol01‘ [3.94 GB] inherit
ACTIVE ‘/dev/VolGroup00/LogVol00‘ [70.47 GB] inherit
ACTIVE ‘/dev/VolGroup00/LogVol01‘ [3.94 GB] inherit
已经看到新改名的卷组是inactive了,2个分区LogVol00和LogVol01,用vgchange加载我们该名过的aaalvm卷组:
[root@locallhost ~]# vgchange -ay /dev/aaalvm
2 logical volume(s) in volume group "aaalvm" now active
提示active状态成功,最后mount文件系统:
[root@locallhost ~]# ls /dev/aaalvm/
LogVol00 LogVol01
[root@locallhost ~]# mount /dev/aaalvm/LogVol00 /aaaa/
[root@locallhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
69G 2.7G 63G 5% /
/dev/hda1 99M 12M 82M 13% /boot
tmpfs 1010M 0 1010M 0% /dev/shm
/dev/mapper/aaalvm-LogVol00
222G 111G 100G 53% /aaaa
[root@locallhost ~]# mount /dev/aaalvm/LogVol01 /bbb/
/dev/aaalvm/LogVol01 looks like swapspace - not mounted
mount: you must specify the filesystem type
LogVol01是swap分区,不用挂载。把/bin/mount /dev/aaalvm/LogVol00 /aaaa/写入rc.local里面,让每次开机自动挂载,也可以写到fstab里面,但是如果写错出问题可能导致进不了系统,所以建议写rc.local。
原文:http://www.cnblogs.com/voiphudong/p/3985628.html