RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1000428 - virt-format uses wrong partition type for vfat filesystems
Summary: virt-format uses wrong partition type for vfat filesystems
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-23 12:39 UTC by Gerd Hoffmann
Modified: 2014-06-18 02:01 UTC (History)
4 users (show)

Fixed In Version: libguestfs-1.22.6-5.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 12:48:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Gerd Hoffmann 2013-08-23 12:39:48 UTC
Description of problem:
$subject

Version-Release number of selected component (if applicable):
libguestfs-tools-c-1.22.5-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. qemu-img create -f qcow2 "$file" "$size"
2. virt-format --add "$file" --format=qcow2 --partition=mbr --filesystem=vfat
3. attach image as usb disk to windows guest

Actual results:
usbstick doesn't show up in Windows Explorer

Expected results:
usbstick can be used without much fuss

Additional info:
The partition is created with type 0x83 (Linux).
When partitioning the stick using windows it will pick 0x0b (W95 FAT32),
virt-format should to the same.

While being at it: Having a --label=<text> cmd line switch (to specify a volume label for the filesystem) would be great too.  Wanna have a separate RFE bug for this?

Comment 1 Richard W.M. Jones 2013-08-23 12:52:23 UTC
Doh.  We fixed the same problem in virt-make-fs too ...

(In reply to Gerd Hoffmann from comment #0)
> While being at it: Having a --label=<text> cmd line switch (to specify a
> volume label for the filesystem) would be great too.  Wanna have a separate
> RFE bug for this?

Don't worry, I'll fix them both.

Comment 4 Lingfei Kong 2013-10-10 06:53:40 UTC
Can reproduce with libguestfs-tools-c-1.22.5-3.el7.x86_64

Steps to reproduce:
1. qemu-img create -f qcow2 test.img 100M
2. virt-format --add test.img --format=qcow2 --partition=mbr --filesystem=vfat
3. attach image as usb disk to windows guest

Result:
usbstick doesn't show up in Windows Explorer

Comment 5 Richard W.M. Jones 2013-10-10 07:50:34 UTC
(In reply to Lingfei Kong from comment #4)
> Can reproduce with libguestfs-tools-c-1.22.5-3.el7.x86_64
> 
> Steps to reproduce:
> 1. qemu-img create -f qcow2 test.img 100M
> 2. virt-format --add test.img --format=qcow2 --partition=mbr
> --filesystem=vfat
> 3. attach image as usb disk to windows guest

When attaching the image, did you ensure the format is set
to qcow2?  If you set it to raw then Windows would just see
a qcow2 header, everything would be completely broken.

> Result:
> usbstick doesn't show up in Windows Explorer

Can you run:

virt-filesystems -a test.img --all --long -h

The output should show that the MBR byte is set to 0b.
For examples see:
https://github.com/libguestfs/libguestfs/commit/d432ab2b5a965110bab542bfd397785eee9753dd

Comment 6 Lingfei Kong 2013-10-11 03:11:25 UTC
(In reply to Richard W.M. Jones from comment #5)

> When attaching the image, did you ensure the format is set
> to qcow2?  If you set it to raw then Windows would just see
> a qcow2 header, everything would be completely broken.

Yes, I specified the format as qcow2 in the steps showed in commnet #4, here is the command I used to attach the image file:
/usr/libexec/qemu-kvm -m 1024 -name "VM" -drive file=/root/win.img -usbdevice disk:format=qcow2:/test.img

> Can you run:
> 
> virt-filesystems -a test.img --all --long -h
> 
> The output should show that the MBR byte is set to 0b.

I checked the image file(showed in comment #4, it is created with command: virt-format --add test.img --format=qcow2 --partition=mbr --filesystem=vfat
) with virt-filesystems  tool, the following is the output:
[host]#virt-filesystems -a test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  vfat  -      -    100M  -
/dev/sda1  partition   -     -      83   100M  /dev/sda
/dev/sda   device      -     -      -    100M  -

It shows the MBR byte is 83 not 0b.

Comment 7 Richard W.M. Jones 2013-10-11 11:14:26 UTC
I'm just reading back more closely.  It looks like you have
correctly reproduced the original problem with 1.22.5.

The bug should be fixed in libguestfs >= 1.22.6-5.el7.

Comment 9 Lingfei Kong 2013-12-06 08:25:04 UTC
Verified it with libguestfs-1.22.6-15.el7

Steps to verify: 
1. #qemu-img create -f qcow2 test.img 100M

2. #virt-format --add test.img --format=qcow2 --partition=mbr --filesystem=vfat

3. attach image as usb disk to windows guest
#/usr/libexec/qemu-kvm -m 1024 -name "VM" -drive file=/var/lib/libvirt/images/vm1.img -usbdevice disk:format=qcow2:/root/lkong/test.img -vnc :0

4.
 # virt-filesystems -a test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  vfat  -      -    100M  -
/dev/sda1  partition   -     -      0b   100M  /dev/sda
/dev/sda   device      -     -      -    100M  -


Result:
1. usbstick shows up in Windows Explorer.
2. It shows the MBR byte is 0b in step 4. 

So, this bug is fixed.

Comment 10 Ludek Smid 2014-06-13 12:48:50 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.