红联Linux门户
Linux帮助

Ubuntu挂载CentOS下的LVM

发布时间:2015-03-19 09:48:28来源:linux网站作者:1780024521

本人电脑有Windows XP和CentOS两个系统,因学习需要装了Ubuntu,不料发现不能加载lvm,故查阅资料,借鉴别人,整理如下:


1.首先使用vgscan 扫描 lvm 结果如下

zhq@zhq:/$ sudo vgscan
Reading all physical volumes.  This may take a while...
Found volume group "VolGroup00" using metadata type lvm2


2.通过 vgdisplay VolGroup00 查看 lvm 的 VG UUID

zhq@zhq:/$ sudo vgdisplay VolGroup00
--- 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               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               19.62 GiB
PE Size               32.00 MiB
Total PE              628
Alloc PE / Size       628 / 19.62 GiB
Free  PE / Size       0 / 0 
VG UUID               xPw6Yb-1SYW-ayBT-TqOP-hF4i-w02x-vY0165


3.重命名(本人认为此步可省,可能是源于简洁吧,呵呵,没试,你可以试试,呵呵)

zhq@zhq:/$ sudo vgrename VolGroup00 /dev/vg0
Volume group "VolGroup00" successfully renamed to "vg0"

这个时候通过 vgdisplay 就可以看到 VG的信息了

zhq@zhq:/$ sudo vgdisplay
--- Volume group ---
VG Name               vg0
System ID          
Format                lvm2
Metadata Areas        1
Metadata Sequence No  4
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                2
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               19.62 GiB
PE Size               32.00 MiB
Total PE              628
Alloc PE / Size       628 / 19.62 GiB
Free  PE / Size       0 / 0
VG UUID               xPw6Yb-1SYW-ayBT-TqOP-hF4i-w02x-vY0165


4.激活VG

VG重命名后,默认是非ACTIVE状态,我们要通过以下方式激活VG

zhq@zhq:/$ sudo lvscan
ACTIVE            '/dev/vg0/LogVol00' [18.16 GiB] inherit
ACTIVE            '/dev/vg0/LogVol01' [1.47 GiB] inherit

激活 VG
zhq@zhq:/$ sudo vgchange -ay /dev/vg0
2 logical volume(s) in volume group "vg0" now active

查看状态
zhq@zhq:/$ sudo lvscan

/LogVol00' [18.16 GiB] inherit
ACTIVE            '/dev/vg0/LogVol01' [1.47 GiB] inherit

zhq@zhq:/$ sudo vgscan
Reading all physical volumes.  This may take a while...
Found volume group "vg0" using metadata type lvm2


到此为止,可以在ubuntu下看见久违的centos了,不过/home下的用户进不去,实乃遗憾,说权限不够,改了权限也不行,期待高手指点。


挂载LVM问题解决

1.重命名问题:本人觉得原文中有两个VolGroup00,故要改名
2.进入用户权限不够:需要ubuntu下root用户登录,刚装上ubuntu的需要用root帐号,现设密码,sudo passwd
输入两次,更改完毕。