lvcreate fails to create new lv

Bug #183359 reported by Eike Bernhardt
6
Affects Status Importance Assigned to Milestone
lvm2 (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Binary package hint: lvm2

Just installed a new server which has a hardware raid6 in it, on which a lvm vg is set up.

It's a fresh Ubuntu-Server 7.10 Gutsy Gibbon install, with all current updates.

Trying to add a new lv fails because device-mapper thinks that a device is too small:

root@erebus:~# uname -a
Linux erebus 2.6.22-14-xen #1 SMP Tue Dec 18 07:06:28 UTC 2007 x86_64 GNU/Linux
root@erebus:~# lvm version
  LVM version: 2.02.26 (2007-06-15)
  Library version: 1.02.20 (2007-06-15)
  Driver version: 4.11.0
root@erebus:~# dmsetup version
Library version: 1.02.20 (2007-06-15)
Driver version: 4.11.0
root@erebus:~# pvs
  PV VG Fmt Attr PSize PFree
  /dev/sdb1 raid6 lvm2 a- 4.09T 3.96T
root@erebus:~# ls /dev/mapper/
control raid6-dom0 raid6-dom0--swap raid6-domU--gutsy--disk raid6-domU--gutsy--swap
root@erebus:~# ls /dev/raid6
dom0 dom0-swap domU-gutsy-disk domU-gutsy-swap
root@erebus:~# lvcreate -v -n test -L 90G raid6
    Finding volume group "raid6"
    Archiving volume group "raid6" metadata (seqno 47).
    Creating logical volume test
    Creating volume group backup "/etc/lvm/backup/raid6" (seqno 48).
    Found volume group "raid6"
    Creating raid6-test
    Loading raid6-test table
  device-mapper: reload ioctl failed: Invalid argument
  Failed to activate new LV.
root@erebus:~# dmesg | tail -n 3
[27673.414059] device-mapper: table: device 8:17 too small for target
[27673.414071] device-mapper: table: 254:4: linear: dm-linear: Device lookup failed
[27673.414131] device-mapper: ioctl: error adding target to table
root@erebus:~#

As seen above, there should be more than enough space in the vg to create a 90GB lv.

Interestingly, lvm knows about the new lv:

root@erebus:~# lvdisplay -C
  LV VG Attr LSize Origin Snap% Move Log Copy%
  dom0 raid6 -wi-ao 10.00G
  dom0-swap raid6 -wi-ao 32.00G
  domU-gutsy-disk raid6 -wi-ao 4.00G
  domU-gutsy-swap raid6 -wi-ao 64.00M
  test raid6 -wi-d- 90.00G
root@erebus:~#

but the state/Attr seems to be wrong.

device-mapper seems to know about the new lv:

root@erebus:~# ls /dev/mapper/
control raid6-dom0 raid6-dom0--swap raid6-domU--gutsy--disk raid6-domU--gutsy--swap raid6-test

but not lvm itself:

root@erebus:~# ls /dev/raid6
dom0 dom0-swap domU-gutsy-disk domU-gutsy-swap
root@erebus:~#

vgmknodes creates the appropriate link:
lrwxrwxrwx 1 root root 22 2008-01-15 23:31 test -> /dev/mapper/raid6-test
but the new lv is not usable.

root@erebus:~# mke2fs /dev/raid6/test
mke2fs 1.40.2 (12-Jul-2007)
mke2fs: Device size reported to be zero. Invalid partition specified, or
 partition table wasn't reread after running fdisk, due to
 a modified partition being busy and in use. You may need to reboot
 to re-read your partition table.

root@erebus:~#

Any Ideas? Any information missing? I'm able to test some things out, since the server is not used productively atm.

Revision history for this message
Eike Bernhardt (eikebernhardt) wrote :

Additional Information to:

root@erebus:~# dmesg | tail -n 3
[27673.414059] device-mapper: table: device 8:17 too small for target
[27673.414071] device-mapper: table: 254:4: linear: dm-linear: Device lookup failed
[27673.414131] device-mapper: ioctl: error adding target to table
root@erebus:~#

device 8:17 should be /dev/sdb1:
brw-rw---- 1 root disk 8, 17 2008-01-15 23:19 /dev/sdb1

  --- Physical volume ---
  PV Name /dev/sdb1
  VG Name raid6
  PV Size 4.09 TB / not usable 1.97 MB
  Allocatable yes
  PE Size (KByte) 4096
  Total PE 1072611
  Free PE 1037779
  Allocated PE 34832
  PV UUID qgokgT-6W0G-uywn-K11c-fwHN-aWSg-D8HJEF

Revision history for this message
Eike Bernhardt (eikebernhardt) wrote :

Okay, this is related to bug #107326

the installer tried to sync the gpt partition into a msdos(?) partition table:

root@erebus:/mnt# fdisk -l

Disk /dev/sda: 1073 MB, 1073741312 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000bcfc4

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 130 1044193+ 83 Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 4498.8 GB, 4498858705408 bytes
255 heads, 63 sectors/track, 546955 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot Start End Blocks Id System
/dev/sdb1 1 12257 98449375 83 Linux
root@erebus:/mnt#

root@erebus:/mnt# parted /dev/sdb print

Disk /dev/sdb: 4499GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
 1 17.4kB 4499GB 4499GB lvm

Information: Don't forget to update /etc/fstab, if necessary.

root@erebus:/mnt#

With this false information for /dev/sdb1 -- no wonder lvcreate or dm fail.

I've reinstalled gutsy, using the workaround detailed in https://bugs.launchpad.net/ubuntu/+source/parted/+bug/107326/comments/5 and now i have a correct partition table:

root@erebus:~# fdisk -l /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 4498.8 GB, 4498858705408 bytes
255 heads, 63 sectors/track, 546955 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot Start End Blocks Id System
/dev/sdb1 1 267350 2147483647+ ee EFI GPT
root@erebus:~# parted /dev/sdb print

Disk /dev/sdb: 4499GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
 1 17.4kB 4499GB 4499GB lvm

Information: Don't forget to update /etc/fstab, if necessary.

root@erebus:~#

with this, i can create LVs again:

root@erebus:~# lvcreate -n test -L 3500G raid6
  Logical volume "test" created
root@erebus:~# lvs
  LV VG Attr LSize Origin Snap% Move Log Copy%
  dom0 raid6 -wi-ao 10.00G
  dom0-swap raid6 -wi-ao 32.00G
  test raid6 -wi-a- 3.42T
root@erebus:~#

So, the unterlying error is the broken parted shipped with gutsy.

Revision history for this message
Ante Karamatić (ivoks) wrote :

This is problem with LVM and GPT, and not with parted. LVM can't use non-PCDOS partition table, so you should, as you did, use whole disk, or PCDOS partition sheme.

Changed in lvm2:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Phillip Susi (psusi) wrote :

7.10 reached end of life some time ago. Have you had this issue on a currently supported release?

Changed in lvm2 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for lvm2 (Ubuntu) because there has been no activity for 60 days.]

Changed in lvm2 (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.