Archiv für Oktober 7, 2010

Linux下挂载lvm 并解决同名冲突

Linux下挂载lvm 并解决同名冲突
在Linux下使用新硬盘安装系统安装好以后再挂载原来的硬盘分区格式全为系统默认分区系统默认使用的
是lvm格式并且默认的卷都是 VolGroup00
使用 pvs 查看显示如下
[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更名解决冲突即可挂载
重命名格式为:[此时会提示
[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 groupVolGroup00
Finding volume groupVolGroup00
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以后再次执行改名
[root @ localhost ~]# vgrename OF8g7h-PQJB-9D9z-yPxn-1kfY-Advq-YbNHJ9 VolGroup01
Volume groupVolGroup00still has active LVs
修改成功以后再执行lvscan
[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
[root @ localhost ~]# vgchange -ay /dev/VolGroup01
2 logical volume(S) in volume groupVolGroup01now active
最后 mount 就可以
[root @ localhost ~]# mount /dev/VolGroup01/LogVol00 /mnt/old
至此全部完成
Linux下挂载lvm 并解决同名冲突

Bemerkungen (1)

mount挂载硬盘出错mount you must specify the filesystem type lvm?

[root@all /]# fdisk -l
Disk /dev/hdc: 80.0 GB, 80026361856 Bytes
255 Köpfe, 63 Sektoren / Spur, 9729 Zylinder
Einheiten = Zylinder 16065 * 512 = 8225280 Bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 13 104391 83 Linux
/dev/hdc2 14 9729 78043770 8e Linux LVM

Disk /dev/hda: 40.0 GB, 40020664320 Bytes
255 Köpfe, 63 Sektoren / Spur, 4865 Zylinder
Einheiten = Zylinder 16065 * 512 = 8225280 Bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 255 2048256 83 Linux
/dev/hda2 256 3934 29551567+ 83 Linux
/dev/hda3 3935 4444 4096575 83 Linux
/dev/hda4 4445 4865 3381682+ f Win95 Ext’d (LBA)
/dev/hda5 4445 4699 2048256 83 Linux
/dev/hda6 4700 4801 819283+ 83 Linux
/dev/hda7 4802 4865 514048+ 82 Linux swap
[root@all /]# mount /dev/hdc2 /mnt/cdrom
montieren: you must specify the filesystem type
mount 时出线上面的错误!谁给点提示!谢谢!

回答

1.先用vgscan
2.vgchange -ay
3.lvscan
4.montieren

到第三步的时候如果正常会显示出两块硬盘的lv状态都是active此时再

#mount -t ext3 /dev/VGname/LVname /mnt/cdrom

就可以成功了

本文来自CSDN博客转载请标明出处:http://blog.csdn.net/qiudakun/archive/2010/03/01/5336754.aspx

Bemerkungen