Lvm – Converting raw image to LVM. Won’t mount afterwards

convertimagekvm-virtualizationlvmxen

According to this post, it should be okay, to use dd to convert a raw Xen image to LVM.

What I have done

dd if=/vm.img of=/dev/vg00/vm

I can mount vm.img with mount -o loop vm.img /root/tmp. It only have one bootable partition.

But I can't mount /dev/vg00/vm.

Can it have something to with MBR?

Any ideas what could be wrong?

Edit:

Now I have created a new LV and formatted it. And I still can't mount it.

It is the same mount error I get when I dd'ed the image over.

localhost:~# mkfs.ext3 /dev/vg00/oes2
mke2fs 1.39 (29-May-2006)
Warning: could not erase sector 2: Attempt to write block from filesystem resulted in short write
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2228224 inodes, 4456448 blocks
222822 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
136 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000

Warning: could not read block 0: Attempt to read block from filesystem resulted in short read
Warning: could not erase sector 0: Attempt to write block from filesystem resulted in short write
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: 
Warning, had trouble writing out superblocks.done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
localhost:~# mount /dev/vg00/oes2 tmp-lvm/
mount: you must specify the filesystem type
localhost:~# mount -t ext3 /dev/vg00/oes2 tmp-lvm/
mount: wrong fs type, bad option, bad superblock on /dev/vg00/oes2,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

localhost:~# mount -t ext3 /dev/vg00/oes2 tmp-lvm/
localhost:~# fdisk /dev/vg00/oes2

Unable to read /dev/vg00/oes2
localhost:~# 

Best Answer

Warning: could not erase sector 2: Attempt to write block from filesystem resulted in short write

This doesn't sound good. It most probably means that some important blocks were not written to disk correctly. You should check the SMART status of your hard drive, it might contain errors. Smartmontools can be used for that purpose. If you use Ubuntu, you can start a simple SMART utility with System > Administration > Disk Utility. Should the hard drive support SMART, you can execute a test that checks all sectors.

If the hard drive is not the problem, your LVM volume group might be corrupted in some way?!

Related Topic