[linux-lvm] Vol management problems over loopback mounted files

Neil, Mark mark.neil at imperial.ac.uk
Wed May 14 05:06:09 UTC 2003


Dear All,

I am trying to set up a volume managed file system over ordinary files using
the loopback devices.  However whatever I try seems to work until I try and
actually use any logical volumes as file systems.  Otherwise the volume
management system is completely happy with what I have done according to the
various display utilities 

What am I doing wrong?  

As a simple example of this problem see below (all on a Redhat 9.0 system,
Kernel 2.4.20-9 - also fails in the same way on a Redhat 8 system with a
2.4.18 kernel)

[root at dex root]# dd if=/dev/zero of=/tmp/diskfile0 bs=512M count=1
1+0 records in
1+0 records out
[root at dex root]# dd if=/dev/zero of=/tmp/diskfile1 bs=512M count=1
1+0 records in
1+0 records out
[root at dex root]# dd if=/dev/zero of=/tmp/diskfile2 bs=512M count=1
1+0 records in
1+0 records out
[root at dex root]# losetup /dev/loop0 /tmp/diskfile0
[root at dex root]# losetup /dev/loop1 /tmp/diskfile1
[root at dex root]# losetup /dev/loop2 /tmp/diskfile2
[root at dex root]# pvcreate /dev/loop[0-2]
pvcreate -- physical volume "/dev/loop0" successfully created
pvcreate -- physical volume "/dev/loop1" successfully created
pvcreate -- physical volume "/dev/loop2" successfully created

[root at dex root]# vgcreate test_vg /dev/loop[0-2]
vgcreate -- INFO: using default physical extent size 4 MB
vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte
vgcreate -- doing automatic backup of volume group "test_vg"
vgcreate -- volume group "test_vg" successfully created and activated

[root at dex root]# lvcreate -L768M -n test_lv test_vg
lvcreate -- doing automatic backup of "test_vg"
lvcreate -- logical volume "/dev/test_vg/test_lv" successfully created

[root at dex root]# mke2fs /dev/test_vg/test_lv
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
98304 inodes, 196608 blocks
9830 blocks (5.00%) reserved for the super user
First data block=0
6 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root at dex root]# mkdir /mnt/tmp
[root at dex root]# mount /dev/test_vg/test_lv /mnt/tmp
mount: you must specify the filesystem type
[root at dex root]# mount -t ext2 /dev/test_vg/test_lv /mnt/tmp
mount: wrong fs type, bad option, bad superblock on /dev/test_vg/test_lv,
       or too many mounted file systems
[root at dex root]# e2fsck /dev/test_vg/test_lv
e2fsck 1.32 (09-Nov-2002)
Couldn't find ext2 superblock, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open
/dev/test_vg/test_lv

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>

[root at dex root]#

Cheers

Mark Neil
Imperial College
London 





More information about the linux-lvm mailing list