Linux – XFS I/O Error accessing Logical Block 0 of an LVM snapshot: is the drive or snapshot bad

linuxlvmocfs2xfs

I have OpenSuSE 11.3 running as a Xen host on a machine with 8x296GB Cheetah 15k.6 SAS disks, 4 of which are mirrored, the other 4 striped. I'm using LVM to manage the disks and they are formatted with OCFS2. I configured a Xen domU as a Logical Volume on the Volume Group "vg" and used XFS for the domU filesystem. After configuring the domU, I made an LVM snapshot and stored it under the Volume Group "vg". At the time I created the snapshot, I made sure to mount it so that I knew it worked.

On the Xen host, there is also a Logical Volume for the /home partition, which a couple domUs mount. To make a long story short, I thought I was in a domU, but was really in dom0, and issued "rm -rf /home/" to clear the home directory. (This domU didn't mount the LV /home.) Although nothing of value was lost, I did notice an I/O error when the rm command returned.

Now, yesterday, I went to mount the LVM snapshot, and got

stage:/ # mount -t xfs /dev/vg/xen-util-configured /mnt/template
mount: /dev/mapper/vg-xen--util--configured: can't read superblock

So I try to xfs_check it and get

xfs_check: /dev/vg/xen-util-configured is invalid (cannot read first 512 bytes)

Similarly for xfs_repair

Phase 1 - find and verify superblock...
superblock read failed, offset 0, size 524288, ag 0, rval -1
fatal error -- Input/output error

I cannot even dd the first block, as it reports

stage:/ # dd if=/dev/vg/xen-util-configured of=foo bs=512 count=1
dd: reading `/dev/vg/xen-util-configured': Input/output error
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.00100721 s, 0.0 kB/s

dmesg reports

[ 1875.331675] Buffer I/O error on device dm-12, logical block 0
[ 1875.331687] Buffer I/O error on device dm-12, logical block 1
[ 1875.331696] Buffer I/O error on device dm-12, logical block 2
[ 1875.331704] Buffer I/O error on device dm-12, logical block 3

dm-12 is a symlink to /dev/vg/xen-util-configured (the LVM snapshot I'm trying to mount).

What I am trying to ascertain here is if the disk(s) actually has a bad sector somewhere, or if the snapshot's XFS fs is knackered (and if it is, how to get it back). I don't like that I can't even dd block 0 of the snapshot. The RAID controller doesn't report any degraded drives during boot. I'm holding off using Seagate SeaTools because the manual states the tests are "potentially or outright destructive to data on SCSI or SAS drives".

Edit:
vgdisplay shows the following:

vgdisplay
--- Volume group ---
VG Name               vg
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  39
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                12
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               1.07 TiB
PE Size               4.00 MiB
Total PE              281322
Alloc PE / Size       131616 / 514.12 GiB
Free  PE / Size       149706 / 584.79 GiB
VG UUID               eqvoEL-4qhV-AREf-7p3D-xr08-6VHh-iz13w7

So it looks like I've got over 1/2TB free.

Apologies for the long winded post…

Best Answer

What is the output of vgdisplay? You may have run out of space, and the LV snapshot is now garbage.

As well before you run a snapshot on an xfs filesystem, you must run xfs_freeze to get a consistent filesystem. However this sounds move like an LVM issue.

Related Topic