Skip to content

LVM2 definition instructions for building a test file does not work #295

@trodery

Description

@trodery

Hi,

I tried to build an LVM2 test file on Ubuntu 20.04 using the instructions in lvm2.ksy but the instructions are perhaps for an older version of LVM?

Original instructions from lvm2.ksy:

dd if=/dev/zero of=image.img bs=512 count=$(( 4 * 1024 * 2 ))
sudo losetup /dev/loop1 image.img
sudo pvcreate /dev/loop1
sudo vgcreate vg_test /dev/loop1
sudo lvcreate --name lv_test1 vg_test
sudo losetup -d /dev/loop1

Output when running these using Ubuntu 20.04:

# Skipped dd output
$ sudo losetup /dev/loop1 image.img
losetup: image.img: failed to set up loop device: Device or resource busy
# Deviating from instructions to mount image
$ sudo losetup --find --show image.img
/dev/loop5
$ sudo lvcreate --name lv_test1 /dev/loop5
  No command with matching syntax recognised.  Run 'lvcreate --help' for more information.
# Deviating from instructions by manually specifying size
$ sudo lvcreate --size 4M --name lv_test1 vg_test
  Volume group "vg_test" has insufficient free space (0 extents): 1 required.
# Number of extents available
$ sudo vgdisplay vg_test | grep "Total PE"
  Total PE              0

Here's what I did to create a working test image:

$ sudo dd if=/dev/zero of=lvm_image.img bs=512 count=$(( 8 * 1024 * 2 ))
16384+0 records in
16384+0 records out
8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.0332592 s, 252 MB/s
$ sudo losetup --find --show lvm_image.img
/dev/loop10
$ sudo pvcreate /dev/loop10
  Physical volume "/dev/loop10" successfully created.
$ sudo vgcreate vg_test /dev/loop10
  Volume group "vg_test" successfully created
$ sudo vgdisplay vg_test | grep "Total PE"
  Total PE              1
# Specifying a size of 8M will yield the error: "Volume group "vg_test" has insufficient free space (1 extents): 2 required."
$ sudo lvcreate --size 4M --name lv_test1 vg_test
  Logical volume "lv_test1" created.
$ sudo losetup -d /dev/loop10

lvm2.ksy was originally committed in August of 2017. Any idea which distro(s) the original instructions were written for and if they are still relevant? If the instructions are still relevant for some particular distro(s) perhaps we can update the definition to reflect this. If it's ok to update the instructions with what I've provided let me know and I'd be happy to submit a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions