我正在运行 Debian Squeeze dom0,重新启动后,我的所有 7 个 domU 都出现数据损坏。每个 domU 都直接在单独的 lvm2 卷上设置为 ext3 分区。所有 lvm 卷都无法挂载;所有卷都有坏的超级块。我尝试对每个超级块执行 e2fsck,但无济于事。我还能尝试什么?
每个 domU 都连接有两个 LVM 卷,一个用于磁盘,一个用于交换。磁盘安装在根目录,格式化为 xen-blk 设备的普通 ext3 分区。这些卷永远不会安装在客户操作系统之外。我正在使用说明运行 Ubuntu 11.04这里。我不确定它们是否没有正确关闭,我只知道在我对 dom0 发出干净的“重启”后它们就损坏了。
这是一个示例 Xen 配置文件;除了名称、vcpus、内存、vif 和磁盘之外,其余部分都相同。
name = 'load1'
vcpus = 2
memory = 512
vif = ['bridge=prbr0', 'bridge=eth0']
disk = ['phy:/dev/VolGroup00/load1-disk,xvda,w','phy:/dev/VolGroup00/load1-swap,xvdb,w']
#============================================================================
# Debian Installer specific variables
def check_bool(name, value):
value = str(value).lower()
if value in ('t', 'tr', 'tru', 'true'):
return True
return False
global var_check_with_default
def var_check_with_default(default, var, val):
if val:
return val
return default
xm_vars.var('install', use='Install Debian, default: false', check=check_bool)
xm_vars.var("install-method",
use='Installation method to use "cdrom" or "network" (default: network)',
check=lambda var, val: var_check_with_default('network', var, val))
# install-method == "network"
xm_vars.var("install-mirror",
use='Debian mirror to install from (default: http://archive.ubuntu.com/ubuntu)',
check=lambda var, val: var_check_with_default('http://archive.ubuntu.com/ubuntu', var, val))
xm_vars.var("install-suite",
use='Debian suite to install (default: natty)',
check=lambda var, val: var_check_with_default('natty', var, val))
# install-method == "cdrom"
xm_vars.var("install-media",
use='Installation media to use (default: None)',
check=lambda var, val: var_check_with_default(None, var, val))
xm_vars.var("install-cdrom-device",
use='Installation media to use (default: xvdd)',
check=lambda var, val: var_check_with_default('xvdd', var, val))
# Common options
xm_vars.var("install-arch",
use='Debian mirror to install from (default: amd64)',
check=lambda var, val: var_check_with_default('amd64', var, val))
xm_vars.var("install-extra",
use='Extra command line options (default: None)',
check=lambda var, val: var_check_with_default(None, var, val))
xm_vars.var("install-installer",
use='Debian installer to use (default: network uses install-mirror; cdrom uses /install.ARCH)',
check=lambda var, val: var_check_with_default(None, var, val))
xm_vars.var("install-kernel",
use='Debian installer kernel to use (default: uses install-installer)',
check=lambda var, val: var_check_with_default(None, var, val))
xm_vars.var("install-ramdisk",
use='Debian installer ramdisk to use (default: uses install-installer)',
check=lambda var, val: var_check_with_default(None, var, val))
xm_vars.check()
if not xm_vars.env.get('install'):
bootloader="/usr/sbin/pygrub"
elif xm_vars.env['install-method'] == "network":
import os.path
print "Install Mirror: %s" % xm_vars.env['install-mirror']
print "Install Suite: %s" % xm_vars.env['install-suite']
if xm_vars.env['install-installer']:
installer = xm_vars.env['install-installer']
else:
installer = xm_vars.env['install-mirror']+"/dists/"+xm_vars.env['install-suite'] + \
"/main/installer-"+xm_vars.env['install-arch']+"/current/images"
print "Installer: %s" % installer
print
print "WARNING: Installer kernel and ramdisk are not authenticated."
print
if xm_vars.env.get('install-kernel'):
kernelurl = xm_vars.env['install-kernel']
else:
kernelurl = installer + "/netboot/xen/vmlinuz"
if xm_vars.env.get('install-ramdisk'):
ramdiskurl = xm_vars.env['install-ramdisk']
else:
ramdiskurl = installer + "/netboot/xen/initrd.gz"
import urllib
class MyUrlOpener(urllib.FancyURLopener):
def http_error_default(self, req, fp, code, msg, hdrs):
raise IOError("%s %s" % (code, msg))
urlopener = MyUrlOpener()
try:
print "Fetching %s" % kernelurl
kernel, _ = urlopener.retrieve(kernelurl)
print "Fetching %s" % ramdiskurl
ramdisk, _ = urlopener.retrieve(ramdiskurl)
except IOError, _:
raise
elif xm_vars.env['install-method'] == "cdrom":
arch_path = { 'i386': "/install.386",
'amd64': "/install.amd" }
if xm_vars.env['install-media']:
print "Install Media: %s" % xm_vars.env['install-media']
else:
raise OptionError("No installation media given.")
if xm_vars.env['install-installer']:
installer = xm_vars.env['install-installer']
else:
installer = arch_path[xm_vars.env['install-arch']]
print "Installer: %s" % installer
if xm_vars.env.get('install-kernel'):
kernelpath = xm_vars.env['install-kernel']
else:
kernelpath = installer + "/xen/vmlinuz"
if xm_vars.env.get('install-ramdisk'):
ramdiskpath = xm_vars.env['install-ramdisk']
else:
ramdiskpath = installer + "/xen/initrd.gz"
disk.insert(0, 'file:%s,%s:cdrom,r' % (xm_vars.env['install-media'],
xm_vars.env['install-cdrom-device']))
bootloader="/usr/sbin/pygrub"
bootargs="--kernel=%s --ramdisk=%s" % (kernelpath, ramdiskpath)
print "From CD"
else:
print "WARNING: Unknown install-method: %s." % xm_vars.env['install-method']
if xm_vars.env.get('install'):
# Figure out command line
if xm_vars.env['install-extra']:
extras=[xm_vars.env['install-extra']]
else:
extras=[]
# Reboot will just restart the installer since this file is not
# reparsed, so halt and restart that way.
extras.append("debian-installer/exit/always_halt=true")
extras.append("--")
extras.append("quiet")
console="hvc0"
try:
if len(vfb) >= 1:
console="tty0"
except NameError, e:
pass
extras.append("console="+ console)
extra = str.join(" ", extras)
print "command line is \"%s\"" % extra root
每个虚拟机都连接了两个 LVM 逻辑卷。以下是fdisk -l
磁盘卷的输出:
Disk /dev/VolGroup00/VMNAME-disk: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x00029c01
Device Boot Start End Blocks Id System
/dev/VolGroup00/VMNAME-disk1 1 1045 8386560 83 Linux
以及交换量:
Disk /dev/VolGroup00/VMNAME-swap: 536 MB, 536870912 bytes
37 heads, 35 sectors/track, 809 cylinders
Units = cylinders of 1295 * 512 = 663040 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004faae
Device Boot Start End Blocks Id System
/dev/VolGroup00/VMNAME-swap1 2 809 522240 82 Linux swap / Solaris
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 32, 33) logical=(1, 21, 19)
Partition 1 has different physical/logical endings:
phys=(65, 36, 35) logical=(808, 4, 28)
答案1
尝试从 dom0 执行 e2fsck,并使用具有偏移量的循环设备来映射分区。我认为,使用你的设置,偏移量应该是 512。例如
losetup -o512 /dev/loop0 /dev/VolGroup00/VMNAME-disk
e2fsck -p /dev/loop0
答案2
您的两个 LV 的分区表看起来很奇怪。
“磁盘”LV 超出了其最后一个柱面,而“交换”LV 的指标似乎与 LV 不匹配。
在 DomU 中,xvda1 被安装为“/”,而 xvdb1 是您的交换空间,对吗?
您在 DomU 的 /var/log/messages 中看到过“访问超出磁盘末端”的消息吗?
如果你的 DomU 开始交换,会发生什么情况?你可以使用压力命令。
答案3
我曾经遇到过这个问题,只是 domU 是 ext3,dom0 是 Centos6.2。一些 LVM 分区的文件系统损坏,一些分区的超级块损坏,一些分区正常。我们怀疑这与 SElinux 有关(我们关闭了其他 dom0 中的 selinux,它们都正常)