0

I want to migrate a IDE-using, LVM-based KVM guest running RHEL 6.5. I found this steps in this page:

1) Run virsh edit . From there, edit the config file and adjust all lines of

<target dev='hda' bus='ide'/>

so they look like this

<target dev='vda' bus='virtio'/>

Furthermore, remove all <address type .../> lines so that libvirt can regenerate them appropriately.

2) Inside the guest, edit /etc/fstab and replace all occurrences of /dev/sdX with /dev/vdX`.

3) That’s it, now shutdown the machine and start it with an virsh start (just a reboot inside the started VM won’t work).

Cool, seems easy but it doesn't cover the case with LVMs. Neither in my /etc/fstab nor in my /etc/grub.conf I found any /dev/sdX path that I could change (besides one commented in the grub.conf file). Should I do anything more with the lvms? The disk shown to the VM is a raw LUN comming from a multipathed equallogic SAN.

[root@testphys ~]# virsh domblklist aplitest
Target     Source
------------------------------------------------
hda        /dev/eql/vol-so-aplitest
hdc        -

VM config file (extract with the disk configuration)

<disk type='block' device='disk'>
  <driver name='qemu' type='raw' cache='none' io='native'/>
  <source dev='/dev/eql/vol-so-aplitest'/>
  <target dev='hda' bus='ide'/>
  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>

Guest's fdisk -l output for the disk (partition 2 is then used as the physical volume for the lvms shown in fstab below)

[root@aplitest ~]# fdisk -l

Disk /dev/sda: 118.1 GB, 118122086400 bytes
255 heads, 63 sectors/track, 14360 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000fb75

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       14361   114840576   8e  Linux LVM

Guest's /etc/fstab

#
# /etc/fstab
# Created by anaconda on Fri Feb 28 15:51:07 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_aplitest-lv_root /                  ext4    defaults        1 1
UUID=0de4d0fc-3637-4b10-908f-7cde8d9347c2 /boot      ext4    defaults        1 2
/dev/mapper/vg_aplitest-lv_home /home              ext4    defaults        1 2
/dev/mapper/vg_aplitest-lv_opt /opt               ext4    defaults        1 2
/dev/mapper/vg_aplitest-lv_tmp /tmp                ext4    defaults        1 2
/dev/mapper/vg_aplitest-lv_usr /usr                ext4    defaults        1 2
/dev/mapper/vg_aplitest-lv_var /var                ext4    defaults        1 2
/dev/mapper/vg_aplitest-lv_var_log /var/log        ext4    defaults        1 2
/dev/mapper/vg_aplitest-lv_swap swap               swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

Guest's /etc/grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_aplitest-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-431.5.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-431.5.1.el6.x86_64 ro root=/dev/mapper/vg_aplitest-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_aplitest/lv_swap  KEYBOARDTYPE=pc KEYTABLE=la-latin1 rd_LVM_LV=vg_aplitest/lv_root rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-431.5.1.el6.x86_64.img
title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_aplitest-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_aplitest/lv_swap  KEYBOARDTYPE=pc KEYTABLE=la-latin1 rd_LVM_LV=vg_aplitest/lv_root rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-431.el6.x86_64.img

Cheers,

2

You don't need to do anything else. Go shutdown and start the VM.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.