[linux-lvm] pvcreate on a loopback device - error: (newbie)
Markus Laire
malaire at gmail.com
Wed Sep 20 12:24:11 UTC 2006
On 9/20/06, John Que <qwejohn at gmail.com> wrote:
> Hello,
>
> I had tried to do some test with LVM on a loopback device
> follwing some tutorials on the web.
>
> I get errors.
> what I do is this:
>
> dd if=/dev/zero of=/work/tmp/disk-image count=10240
> mke2fs /work/tmp/disk-image
> mount -o loop /work/tmp/disk-image /work/loop/ 78 14:23
>
> pvcreate /dev/loop1
>
> error:
> Failed to wipe new metadata area
> /dev/loop1: Format-specific setup of physical volume failed. Failed
> to setup physical volume "/dev/loop1"
>
>
> what did I do wrong ?
If you want to use LVM on a loopback device, you don't create a
filesystem on it first.
You need to do something like
# Create new empty disk-image
dd if=/dev/zero of=disk-image count=10240
# set up a loop-device for it
losetup /dev/loop2 disk-image
# initialize that loop-device for LVM
pvcreate /dev/loop2
# Create a VG on it
vgcreate Test /dev/loop2
Now you can create Logical Volumes on that VG, e.g.:
# Create a logical volume
lvcreate --size 4M --name MyLV Test
# Create a filesystem on it
mke2fs /dev/Test/MyLV
# mount the filesystem
mkdir MyLV
mount /dev/Test/MyLV MyLV
And if you want to remove everything...
umount MyLV
rmdir MyLV
lvremove /dev/Test/MyLV
vgremove Test
losetup -d /dev/loop2
rm disk-image
--
Markus Laire
More information about the linux-lvm
mailing list