如何在带有 LVM 的 RHEL 6.5 KVM 客户机中从 ide 迁移到 virtio

如何在带有 LVM 的 RHEL 6.5 KVM 客户机中从 ide 迁移到 virtio

我想迁移使用 IDE、基于 LVM 的 KVM 客户机,该客户机运行 RHEL 6.5。我在这一页

1) 运行 virsh edit 。从那里,编辑配置文件并调整所有行

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

所以它们看起来像这样

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

此外,删除所有<address type .../>行,以便 libvirt 可以适当地重新生成它们。

2)在客户机内部,编辑 /etc/fstab 并将所有出现的 /dev/sdX 替换为 /dev/vdX`。

3)就这样,现在关闭机器并使用 virsh start 启动它(仅在启动的 VM 内重新启动是行不通的)。

很酷,看起来很简单,但它没有涵盖 LVM 的情况。在我的 /etc/fstab 和 /etc/grub.conf 中,我都没有找到任何可以更改的 /dev/sdX 路径(除了 grub.conf 文件中注释的路径)。我应该对 lvms 做更多的事情吗?向 VM 显示的磁盘是来自多路径 equallogic SAN 的原始 LUN。

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

VM 配置文件(包含磁盘配置的提取)

<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>

客户机的磁盘 fdisk -l 输出(分区 2 随后用作下面 fstab 中显示的 lvm 的物理卷)

[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

访客的 /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

客户的 /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

干杯,

答案1

您不需要做任何其他事情。关闭并启动虚拟机。

相关内容