我使用 ddrescue 复制了几个驱动器,用于在 Xen 下启动映像文件。它们包含一个 LVM 卷组,其中有几个卷,最初分布在两个磁盘上,其中一个磁盘最终出现故障,但已成功恢复。TL;DR 客户机(Centos 5.8)在我启动时找不到逻辑卷,我需要弄清楚我的选择是什么。这是我的 xl-compatible.cfg:
# For centos import
name = 'placeholder'
# figure out pvhvm drivers
builder = 'hvm'
vcpus = 6
memory = '16384'
boot = 'c'
# according to xl.cfg man page it is 'guest specific' what this is
root = '/dev/VolGroup00/LogVol00'
disk = [
'file:/home/user/xenvms/placeholder/disk1.img,sda,rw',
'file:/home/user/xenvms/placeholder/disk2.img,sda,rw',
# copying over to new lvs instead of files didn't magically fix anything, consider this later
#'phy:/dev/vg0/xen.placeholder.com-VolGroup00-disk1,sda,rw',
#'phy:/dev/vg0/xen.placeholder.com-VolGroup00-disk2,sdb,rw',
]
vif = [ 'bridge=xenbr0' ]
#serial = 'pty'
vnc = 1
vnclisten = '0.0.0.0'
以下是使用 losetup 使设备可用之后,从 dom0 的角度看 fdisk -l 在这些图像中显示的内容:
Disk /dev/loop0: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0007f805
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 63 208844 208782 102M 83 Linux
/dev/loop0p2 208845 3907024064 3906815220 1.8T 8e Linux LVM
Disk /dev/loop1: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000c421b
Device Boot Start End Sectors Size Id Type
/dev/loop1p1 * 63 3907024064 3907024002 1.8T 8e Linux LVM
如果我使用系统救援 CD 启动虚拟机,我能够使用 fdisk 和 lvdisplay 查看逻辑卷:
以下是我启动时发生的情况。有人知道我应该从哪里开始让启动的客户操作系统找到卷组吗?
答案1
将磁盘线从 sda 替换为 xvd 最终是解决方案:
'tap:aio:/dev/vg0/xen.placeholder.com-VolGroup00-disk1,xvda,rw',
'tap:aio:/dev/vg0/xen.placeholder.com-VolGroup00-disk2,xvdb,rw',