I'm back! » |
Recently I was working with a machine that had a cloned hard drive with lvm's and xfs partitions. When I tried to use the volume group I got errors like
pvs
WARNING: Not using device /dev/sdc2 for PV wES5Fr-7wxw-PYKb-0o0T-5IP4-oZdl-CwQOa7.
WARNING: PV wES5Fr-7wxw-PYKb-0o0T-5IP4-oZdl-CwQOa7 prefers device /dev/sda2 because device is used by LV.
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <1.82t 4.00m
blkid showed that the Volume groups had duplicate UUID's
/dev/sda1: UUID="2d7614b5-d3a9-4b04-800b-852117d77cf4" BLOCK_SIZE="4096" TYPE="xfs" PARTUUID="00018e4d-01"
/dev/sda2: UUID="wES5Fr-7wxw-PYKb-0o0T-5IP4-oZdl-CwQOa7" TYPE="LVM2_member" PARTUUID="00018e4d-02"
/dev/mapper/centos-root: UUID="425c049b-f8ad-4584-a5ba-e3ecef9006b0" BLOCK_SIZE="4096" TYPE="xfs"
/dev/mapper/centos-swap: UUID="c876eab0-5170-411d-b3bf-f771c5c349ba" TYPE="swap"
/dev/mapper/centos-home: UUID="3903ea6c-3835-4c39-b7a3-32f57e1d1bcd" BLOCK_SIZE="4096" TYPE="xfs"
/dev/sdb1: LABEL="CENTOS-STRE" UUID="1E19-1347" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="002bdd6e-01"
/dev/sdc1: UUID="2d7614b5-d3a9-4b04-800b-852117d77cf4" BLOCK_SIZE="4096" TYPE="xfs" PARTUUID="00018e4d-01"
/dev/sdc2: UUID="wES5Fr-7wxw-PYKb-0o0T-5IP4-oZdl-CwQOa7" TYPE="LVM2_member" PARTUUID="00018e4d-02"
After some Googling I found that all I had to do was run
vgimportclone /dev/sdc2
then
vgscan showed both the volume groups
Found volume group "centos1" using metadata type lvm2
Found volume group "centos" using metadata type lvm2
and I could use vgchange -ay centos1 to activate the volume group
but when I tried to mount the filesystem and got this error
XFS (dm-3): Filesystem has duplicate UUID 3903ea6c-3835-4c39-b7a3-32f57e1d1bcd - can't mount
more Googling pointed me to xfs_admin to generate new UUID's for the xfs partitions
xfs_admin -U generate /dev/mapper/centos1-home
after all that was done everything worked fine.