First of all i have to say i've been looking through lots of posts very similar to what i have but none could solve my problem...

In my xen server i use 5 lvm disks per virtual machine:


I just create the disks with lvcreate, add them to the vm config file and create the vm. Each disk partition is then made by the partition manager while installing the OS (Ubuntu server 12.04).

Tipically resizing an lvm disk should be as simple an lvextend

lvextend -L +100MB /dev/vm-disks/testes-home
Extending logical volume testes-home to 524.00 MiB
Logical volume testes-home successfully resized

Followed by a resize2fs, but it gives an error...

resize2fs /dev/vm-disks/testes-home 
resize2fs 1.42 (29-Nov-2011)
resize2fs: Bad magic number in super-block while trying to open /dev/vm-disks/testes-home
Couldn't find valid filesystem superblock.

It is curious that mounting also doesn't work the normal way for an lvm volume:

mount /dev/vm-disks/testes-home /root/mount/
mount: you must specify the filesystem type

One could think that there were more than one partition but running kpartx yields only one...

kpartx -av /dev/vm-disks/testes-home
add map vm--disks-testes--home1 (252:36): 0 1044480 linear /dev/vm-disks/testes-home 2048

... and mounting that one works ok...

mount /dev/mapper/vm--disks-testes--home1 /root/mount/

e2fsck also complains...

e2fsck -f /dev/vm-disks/testes-home 
e2fsck 1.42 (29-Nov-2011)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/vm-disks/testes-home

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>

Why all this? It's supposed to be super simple...

fdisk -l /dev/vm-disks/testes-home 

Disk /dev/vm-disks/testes-home: 549 MB, 549453824 bytes
37 heads, 35 sectors/track, 828 cylinders, total 1073152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 524288 bytes / 1572864 bytes
Disk identifier: 0x000d462a

                Device Boot      Start         End      Blocks   Id  System
/dev/vm-disks/testes-home1            2048     1046527      522240   83  Linux

any ideas? :)

1 Answer 1


The problem is that you have are trying to run the resize2fs tool on the whole logical volume, which contains a partition table, and a partition inside the volume.

First you must resize the partition table by running fdisk on the logical volume.

Then you need to use kpartx to create the mapping from partition inside the volume to a device, like you already did before mounting, and then run resize2fs on the actual partition.

So, in summary, expand partition, run:

resize2fs /dev/vm--disks--testes--home1

instead of:

resize2fs /dev/vm-disks-testes
  • (still getting aquainted with this interface...) Thanks for the answer :) but i still couldn't make it. fdisk /dev/vm-disks/testes-home i have first to delete the partition and create a new one starting at the same point, right? fdisk /dev/vm-disks/testes-home (Start: 2048) i delete the partition, create new one but start is now at 3072... kpartx /dev/vm-disks/testes-home e2fsck -f /dev/mapper/vm--disks-testes--home1 e2fsck: Superblock invalid, trying backup blocks... e2fsck: Bad magic number in super-block while trying to open /dev/mapper/vm--disks-testes--home1
    – Caveman
    Sep 3, 2014 at 15:28
  • Well, i can resize if i lvextend the lvm volume and then at the virtual server i fdisk, e2fsck and resize2fs, which is a different approach. The only problem then is if it's the boot disk that needs expansion... not a big problem, though ;) If you could tell me how that'd be great, cause i really can't pull it from the xen-server only...
    – Caveman
    Sep 3, 2014 at 16:21
  • You can do the fdisk, e2fsck and resize2fs all on the host system. You just need to pass the /dev/vm-disks-testes to fdisk, and use /dev/cm--disks--testes--home1 for the other commands. Sep 3, 2014 at 21:20
  • I did try that and it didn't work as expected. To resize a partition one must delete and recreate it with the new size, starting at the same sector. Problem is on the xen-server the partition i delete starts at sector 2048, but when i try to recreate it, the first allowed sector starts at 3072... Why? And i couldn't find a way out of it. If on the other hand i recreate the partition at the vm, then ok, it can start at 2048. Strange... is it lvm info that adds the extra 1024? Then why does fdisk at the xen-server show it starts at 2048? Thank you so much for your help :)
    – Caveman
    Sep 4, 2014 at 8:18
  • Well, actually I try to avoid using partition tables inside LVMs, because they cause problems like this. Instead I just make an LVM volume at host, and then assign it to /dev/xvda on the guest. Then one doesn't need any unnecessary partitions. Sep 4, 2014 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.