我最近不得不更换远程服务器中的系统磁盘,DC 将旧磁盘连接到 USB 端口。问题是 CentOS 是使用所有默认设置安装在两者上的,因此现在的输出lvscan
是:
[root@IS-55825 /]# lvscan
inactive '/dev/vg_is55825/lv_root' [50.00 GiB] inherit
inactive '/dev/vg_is55825/lv_home' [53.46 GiB] inherit
inactive '/dev/vg_is55825/lv_swap' [7.67 GiB] inherit
ACTIVE '/dev/vg_is55825/lv_root' [50.00 GiB] inherit
ACTIVE '/dev/vg_is55825/lv_home' [53.24 GiB] inherit
ACTIVE '/dev/vg_is55825/lv_swap' [7.89 GiB] inherit
pvs
可以分辨出差异,但我不知道如何将它们分开,以便我可以挂载其中一个旧分区来获取一些配置信息:
[root@IS-55825 /]# pvs -v
Using physical volume(s) on command line.
Wiping cache of LVM-capable devices
Wiping internal VG cache
Cache: Duplicate VG name vg_is55825: Existing KbuKYZ-yPtq-VI65-DlqY-e0j3-5Van-9UTe06 (created here) takes precedence over gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO
Cache: Duplicate VG name vg_is55825: Existing KbuKYZ-yPtq-VI65-DlqY-e0j3-5Van-9UTe06 (created here) takes precedence over gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO
PV VG Fmt Attr PSize PFree DevSize PV UUID
/dev/sda2 vg_is55825 lvm2 a--u 111.13g 0 111.13g QC5BPW-VdKx-dNnw-vSNm-cH6H-fZwB-HHXwFb
/dev/sdd2 vg_is55825 lvm2 a--u 111.13g 0 111.13g LNSYx6-8DCv-u9CG-S1zv-vI20-fNIq-7BA8Le
这就是/dev/sdd2
我想要的,但它无法直接安装:
[root@IS-55825 /]# mount /dev/sdd2 /oldsys
mount: unknown filesystem type 'LVM2_member'
我试过了lvdisplay --select vg_uuid=LNSYx6-8DCv-u9CG-S1zv-vI20-fNIq-7BA8Le
,但是没有输出,这就是我得到的...有什么办法可以访问它吗?
答案1
好的 - 我能够使用 来解决这个问题vgrename
。首先,运行lvscan -v
:
[root@IS-55825 ~]# lvscan -v
Using logical volume(s) on command line.
Cache: Duplicate VG name vg_is55825: Existing KbuKYZ-yPtq-VI65-DlqY-e0j3-5Van-9UTe06 (created here) takes precedence over gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO
Cache: Duplicate VG name vg_is55825: Existing KbuKYZ-yPtq-VI65-DlqY-e0j3-5Van-9UTe06 (created here) takes precedence over gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO
Cache: Duplicate VG name vg_is55825: Existing gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO (created here) takes precedence over KbuKYZ-yPtq-VI65-DlqY-e0j3-5Van-9UTe06
inactive '/dev/vg_is55825/lv_root' [50.00 GiB] inherit
inactive '/dev/vg_is55825/lv_home' [53.46 GiB] inherit
inactive '/dev/vg_is55825/lv_swap' [7.67 GiB] inherit
Cache: Duplicate VG name vg_is55825: Existing KbuKYZ-yPtq-VI65-DlqY-e0j3-5Van-9UTe06 (created here) takes precedence over gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO
ACTIVE '/dev/vg_is55825/lv_root' [50.00 GiB] inherit
ACTIVE '/dev/vg_is55825/lv_home' [53.24 GiB] inherit
ACTIVE '/dev/vg_is55825/lv_swap' [7.89 GiB] inherit
所以我猜测 UUIDgVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO
是旧磁盘。所以我运行了vgrename
:
[root@IS-55825 ~]# vgrename gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO vg_oldsys
Processing VG vg_is55825 because of matching UUID gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO
Volume group "gVj6yw-hbls-RgTh-MKe3-saoW-KH3B-ggf2LO" successfully renamed to "vg_oldsys"
然后我就可以挂载了/dev/vg_oldsys/lv-root
。呼。