11.2 LVM Mirroring Virtualbox

Hi Folks,

Can any one assist? I have a virtual box VDI which runs 11.2/KDE

I am playing with mirroring as a learning exercise. As I’m familiar with another LVM I thought that I could easily adapt to the LVM used in Linux. However I have hit some problems. I accept that they might be due to VirtualBox, but lets see.

I have performed an install of 11.2 onto a disk (/dev/sda), using lvm. The setup program very cleverly created a boot partition (/dev/sda1), and a partition to be owned by lvm (/dev/sda2), in which I have the home/root/swap volumes.

I wanted to create a mirrored environment, and after a bit of playing discovered that I needed to replicate the partitioning on the newly attached virtual disk (which had to be fully allocated not “dynamic”). I also eventually realised that in needed to use lvconvert not lvextend…

lvextend /dev/system/home -m 1 /dev/sdb2

would tell me that it could not vary the number of mirrors yet (?!)

lvconvert /dev/system/home -m 1 /dev/sdb2

tell me that “Not enough PVs with free space available for parallel allocation”, yet vgdisplay -v tells me that /dev/sdb2 is empty (and /dev/system/home is smaller that the size of /dev/sdb2)

lvconvert /dev/system/home -m 1 --alloc anywhere /dev/sdb2

appears to do the job, with numerous errors complaining about the mirror monitoring failing, except that lvdisplay -v does not tell me if the volume has been mirrored, and the allocated LE has not changed, yet vgdisplay -v shows that the number of free PEs has gone down.

As far as mirroring the rest of the Lvs I’ll wait until the community has feed its comments back to me.

The boot partition, I have mirrored via dd, and have edited the /boot/grub/menu.lst file to change the hd0 references to hd1.

I guess that I still need to dd the first 512 bytes of /dev/sda to /dev/sdb in order to get it to boot.

I suppose my question is that am I approaching LVM mirroring correctly?

Thanks in advance.

On a real system I think yes on a Virtual have no idea. Remember it is just a pretend drive. We may assume that it has all the characteristics of a real drive but we really don’t know that for sure.

LVM and mirroring technologies do NOT extend to Virtual drives. LVM while you can make it kinda react with virtual drives there is a danger of total system coruption if you try to delete and or remake the virtual drive. Think about it, instead of creating a Logical volume as a sub-filesystem of a real volume (partition), with LVM and virtual drive (huge file of the host filesystem designed to work as an independent partition) is being told to create an LVM on a fake drive and link to real space as a sub-filesystem of the real system. One mistake and both the virtual and real filesystem host will be crunched.

Part two, You want to create a mirror of a drive then tell it to not use the real drive but a fake drive (virtual) and to then try and mirror a LVM drive which is both a member of the fake drive and real drive. Something has to give and I’ll bet it will be your system.


In respect of the mirroring I needed --corelog on the lvconvert command. This is because unlike the LVM that I’m familiar with LVM2 requires a third place to log the changes to the primary and secondary e.g. a third drive or RAM (hence --corelog because I’m too lazy to create a third vdi at this point).

I’m now in the sitution where I have:

Oracle Virtualbox 3.2.8 on Win7 x64
openSUSE 11.3 x86
two vdi’s - each on a seperate physical disk

I have installed , then mirrored afterwards (a) without updates and (b) with updates which both work, until a reboot. At which point the LVs are not opened because dm-mirror is not found (I have done a modprobe dm-mirror previously). If I then do a fresh reinstall, over writing /dev/sda, the install is clever enough to detect /dev/sdb and that it did belong to the system vg, and it syncs the LVs and everything then runs fine and even allows successful reboots.

The problem thus appears to be which modules I need to insert – any CLI suggestions?

Thanks in advance.

The way forward was to add


to the INITRD_MODULES line of /etc/sysconfig/kernel

then run


to recreate the initial ramdisk that the boot image uses.

More to follow