kpartx / device-mapper errors on small disk
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
This was originally opened as a cirros bug, but seems generic to kpartx or device-mapper. I suspect device-mapper.
Independent of cirros, recreate is like this:
$ sudo modprobe nbd
$ rm -f my.img
$ truncate --size $((16065*5*512)) my.img
$ echo "16065,," | sfdisk -uS my.img
$ fdisk -l my.img
...
$ sudo qemu-nbd --connect /dev/nbd7 "$PWD/my.img"
$ sudo kpartx -av /dev/nbd7
$ sudo kpartx -av /dev/nbd7
device-mapper: resume ioctl on nbd7p1 failed: Invalid argument
create/reload failed on nbd7p1
add map nbd7p1 (0:0): 0 64260 linear /dev/nbd7 16065
$ dmesg | tail
[1281945.659640] nbd7: p1 size 64260 extends beyond EOD, truncated
[1281964.528483] device-mapper: table: 252:0: nbd7 too small for target: start=16065, len=64260, dev_size=80324
wrt cirros, the reproduce looks like this:
$ wget http://
$ sudo qemu-nbd -c /dev/nbd7 cirros-
$ sudo kpartx -av /dev/nbd7
gives:
device-mapper: resume ioctl on nbd7p1 failed: Invalid argument
create/reload failed on nbd7p1
add map nbd7p1 (0:0): 0 64260 linear /dev/nbd7 16065
dmesg adds:
[80163.572187] bio: create slab <bio-1> at 1
[80163.572258] device-mapper: table: 253:0: nbd7 too small for target: start=16065, len=64260, dev_size=80324
using fdisk on /dev/nbd7 gives
Command (m for help): v
Partitions 1: cylinder 5 greater than maximum 4
Remaining 16063 unallocated 512-byte sectors
summary: |
- can't kpartx qcow2 cirros 0.3.1 + kpartx / device-mapper errors on small disk |
description: | updated |
description: | updated |
no longer affects: | cirros |
Changed in linux (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Low |
Is this still an issue?
qemu-img convert -O raw cirros- 0.3.2-x86_ 64-disk. img out.img
$ fdisk -l out.img
Disk out.img: 41 MB, 41126400 bytes
255 heads, 63 sectors/track, 5 cylinders, total 80325 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
out.img1 * 16065 80324 32130 83 Linux
that doesn't complain about anything, and the math of 80324*512 (+512) == 41126400