Comment 2 for bug 494803

Revision history for this message
H.M. (cybrocop) wrote : Re: NTFS partitions aren't properly detected in partition2disk

There is an issue with partition2disk for any Qcow image.

The current version of partition2disk checks for the existing of the text "partition" as output of the file command:

if (!($magic =~ /partition [0-99]/) && !($magic =~ /Qcow/)) { # if not a disk image already

However, at least on Ubuntu 10.04, the file command doesn't output such information for Qcow partitions.

The output of the "file" command on my Ubuntu 10.04 is as follows:

win2k3.img: Qemu Image, Format: Qcow , Version: 1 , Disk Size could be: 117440512 * 256 bytes

The above Qcow image contains 2 partitions: http://img710.imageshack.us/img710/629/qtparted.png

However, when I convert this to a raw partition, the output is as follows:

win2k3.raw: x86 boot sector, Microsoft Windows XP MBR, Serial 0x3dc23dc2; partition 1: ID=0x7, active, starthead 1, startsector 63, 62830152 sectors; partition 2: ID=0x6, starthead 254, startsector 62830215, 192780 sectors, code offset 0xc0

------

The current code will result in the following log entry every time a Qcow instance is run:

httpd-nc_error_log:cannot find the first partition on this disk, giving up

It looks like partition2disk should either ignore Qcow images or figure out a way to edit them appropriately.