Hi guys,
I'm pulling my hair out over this one. I am trying to set up a virtual server environment. ( I am using VirtualBox, but I think this is irrelevant to this problem.) I have downloaded a pre-packaged Linux virtual disk, with which I have successfully started a virtual instance of a Linux server. Now, my goal is (nevermind why for now) to use one virtual machine to modify the root disk of another (which is turned off during this process). Here are the steps I take:
- Create and test a virtual linux server (as noted above), called vs-A
- Clone the disk used by vs-A (while vs-A is stopped). Let's call the first disk vhd-A1 and the new clone, vhd-A2.
- Create a new virtual linux server, vs-B which uses vhd-A2. This works. Power it off.
- Now tell vs-A to use vhd-A1 at /dev/hda (as usual) and to use vhd-A2 as /dev/hdb.
- Start vs-A
So now, vs-A is running with /dev/hda and /dev/hdb. But trying to do anything with hdb doesn't seem to work. I'd like to know why and to try to remedy that.
# dumpe2fs /dev/hdb2
dumpe2fs 1.39 (29-May-2006)
dumpe2fs: Bad magic number in super-block while trying to open /dev/hdb2
[expected -- it's "encapsulated" in an LVM]
# pvs -a
Found duplicate PV pLPlWtPxq1A8JBAfSqrDWdhYZM2PpVr0: using /dev/hdb2 not /dev/hda2
PV VG Fmt Attr PSize PFree
/dev/VolGroup00/LogVol01 -- 0 0
/dev/hda1 -- 0 0
/dev/hdb1 -- 0 0
/dev/hdb2 VolGroup00 lvm2 a- 19.88G 0
/dev/hdb2 VolGroup00 lvm2 a- 19.88G 0
<other output>
# lvscan
Found duplicate PV pLPlWtPxq1A8JBAfSqrDWdhYZM2PpVr0: using /dev/hdb2 not /dev/hda2
ACTIVE '/dev/VolGroup00/LogVol00' [18.88 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.00 GB] inherit
# pvscan
Found duplicate PV pLPlWtPxq1A8JBAfSqrDWdhYZM2PpVr0: using /dev/hdb2 not /dev/hda2
PV /dev/hdb2 VG VolGroup00 lvm2 [19.88 GB / 0 free]
Total: 1 [19.88 GB] / in use: 1 [19.88 GB] / in no VG: 0 [0 ]
# pvs
Found duplicate PV pLPlWtPxq1A8JBAfSqrDWdhYZM2PpVr0: using /dev/hdb2 not /dev/hda2
PV VG Fmt Attr PSize PFree
/dev/hdb2 VolGroup00 lvm2 a- 19.88G 0
# :Fine, I'll just overwrite the thing!
# mke2fs -b 4096 -O dir_index,spare_super /dev/hdb2
mke2fs 1.39 (29-May-2006)
/dev/hdb2 is apparently in use by the system; will not make a filesystem here!
Is there a tool or a technique to deal with this situation? Is there a way to rename the uuid? If so, how do I specify that I want the uuid of /dev/hdb changed? Is there a way to associate an existing physical partition to a new group? How do admins do disaster recovery with LVM in these kinds of situations?