2

I'm running a Debian Squeeze dom0, and after rebooting it all 7 of my domUs have data corruption. Each is setup as ext3 partition directly on a separate lvm2 volume. None of the lvm volumes will mount; all have bad superblocks. I've tried e2fsck with each superblock to no avail. What else can I try?

Each domU has two LVM volumes connected to it, one for the disk and one for swap. The disk is mounted at root, formatted as a normal ext3 partition as a xen-blk device. The volumes are never mounted outside of the guest OS. I'm running Ubuntu 11.04 using the instructions here. I'm not sure that they didn't shutdown properly, all I know is they were corrupt after I issues a clean 'reboot' on the dom0.

Here's a sample Xen config file; the rest are the same except for name, vcpus, memory, vif and disk.

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

There are two LVM logical volumes connected to each VM. Here's the fdisk -l output for the disk volume:

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

And the swap volume:

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)
2
  • Please explain your disk-setup in more detail. One LVM volume corresponds to one partition and this is the only partition for the DOmUs, which is mounted /? What guest OS were you using, and why did the DomUs not shut down poperly?
    – Nils
    Dec 5, 2011 at 19:02
  • Please update your question with that setup - then delete your comment. I am not that familiar with Ubuntu - so perhaps you should migrate to "ask ubuntu". But we can go on with the generic XEN-stuff (independent of linux flavour). Can you please post a complete DomU-config-file and the output of fdisk -l (from the Dom0) for the two associated LVs (also as update to your question)?
    – Nils
    Dec 6, 2011 at 20:30

3 Answers 3

1

Try your e2fsck from the dom0 and use a loop device with an offset to map the partition. With your setup the offset would be 512 i think. e.g

losetup -o512 /dev/loop0 /dev/VolGroup00/VMNAME-disk
e2fsck -p /dev/loop0
2
  • I get the same results: e2fsck: Bad magic number in super-block while trying to open /dev/loop0 /dev/loop0: The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>
    – zcs
    Dec 14, 2011 at 1:19
  • Can you supply the output of the following string of commands please; losetup -d /dev/loop0 ; losetup /dev/loop0 /dev/VolGroup00/VMNAME-disk ; fdisk -ul /dev/loop0
    – leenix
    Dec 14, 2011 at 10:20
0

The partition tables of your two LVs look strange.

The "disk" LV extends beyond its last cylinder, while the metrics of the "swap" LV do not seem to match the LV.

Within the DomU xvda1 is mounted as "/" and xvdb1 is your swapspace, right?

Did you see any "access beyond end of disk" messages in /var/log/messages of your DomU?

What happens if your DomU starts to swap? You can force that using the stress command.

-1

I had this problem once, only that the domUs are ext3 and dom0 is Centos6.2. Some LVM partitions had file system corrupts, some have bad superblocks, some were ok. We suspected that it had something to do with SElinux (we turned off selinux in other dom0 and they were fine)

1
  • Turning off LSMs is nearly always not a solution. Apr 20, 2015 at 6:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .