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 911990 - RFE: Support 4k sector size with qcow2
Summary: RFE: Support 4k sector size with qcow2
Keywords:
Status: CLOSED DUPLICATE of bug 748906
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 960803 1018028 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-17 05:21 UTC by Xu Tian
Modified: 2014-01-22 11:06 UTC (History)
17 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-22 11:06:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
strace output (55.27 KB, text/x-log)
2013-02-21 04:02 UTC, Xu Tian
no flags Details

Description Xu Tian 2013-02-17 05:21:35 UTC
Description of problem:

start guest with command:
qemu-kvm -name vm1 -smp 1 -m 512 -drive file=/tmp/test1.img,if=none,id=drive-virtio-disk1,media=disk,cache=none -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1 -vnc :0 -monitor stdio
guest to startup and error printed, "qemu-kvm: -drive file=/tmp/test1.img,if=none,id=drive-virtio-disk1,media=disk,cache=none: could not open disk image /tmp/test1.img: Invalid argument"

when cache=unsafe,writethrough or writeback guest start up successful;

when change cache=o, qemu quit with invalid cache option(that we expect)


Version-Release number of selected component (if applicable):

qemu-kvm-1.3.0-5.el7.x86_64
kernel-3.7.0-0.34.el7.x86_64

How reproducible:

100%

Steps to Reproduce:
1. boot guest with command:
qemu-kvm -name vm1 -smp 1 -m 512 -drive file=/tmp/test1.img,if=none,id=drive-virtio-disk1,media=disk,cache=none -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1 -vnc :0 -monitor stdio
(qemu quit,with error)

2. boot guest with command:
 qemu-kvm -name vm1 -smp 1 -m 512 -drive file=/tmp/test1.img,if=none,id=drive-virtio-disk1,media=disk,cache=unsafe -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1 -vnc :0 -monitor stdio
QEMU 1.3.0 monitor - type 'help' for more information
(qemu) info block
drive-virtio-disk1: removable=0 io-status=ok file=/tmp/test1.img ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
pflash0: removable=0 file=/usr/share/qemu/bios.bin ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0

  
Actual results:

qemu quit when cache=none

Expected results:

guest startup

Additional info:

Comment 2 juzhang 2013-02-17 07:18:07 UTC
FYI

I tried this issue by using qemu-kvm-1.3.0-5.el7.x86_64. Do not hit this issue. The guest be booted with cache=none.

#/usr/libexec/qemu-kvm -M pc-1.3 -cpu SandyBridge -enable-kvm -m 2048 -smp 2,sockets=1,cores=2,threads=1 -name rhel7 -uuid 6afa5f93-2d4f-420f-81c6-e5fdddbd1c83 -drive file=/home/a.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,serial=40c061dd-5d60-4fc5-865f-55db700407f0,cache=none,werror=stop,rerror=stop,aio=threads -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0  -vnc :1 -monitor stdio

Comment 5 Hai Huang 2013-02-19 14:33:21 UTC
Verified that problem did NOT exist in prior RHEL7 nightly builds (before 1/15/2013).

Email thread already started with Kevin, so assigning this BZ to Kevin for 
now.  Please re-assign as appropriate.

Comment 6 Kevin Wolf 2013-02-20 10:33:10 UTC
Your image is /tmp/test1.img. What kind of file system is /tmp on? If it's tmpfs, this doesn't support O_DIRECT, so the error would be expected.

Comment 7 Xu Tian 2013-02-21 02:58:56 UTC
(In reply to comment #6)
> Your image is /tmp/test1.img. What kind of file system is /tmp on? If it's
> tmpfs, this doesn't support O_DIRECT, so the error would be expected.

hi Kevin,

create image file via "qemu-img create -f qcow2 /root/test.img 1G" and try to start up guest with cache=none still failed;  file system on /root is xfs:

/dev/mapper/rhel-root / xfs rw,relatime,attr2,inode64,noquota 0 0

try "dd if=/dev/zero of=/root/test2.img oflag=direct bs=1 count=1" it failed too, it looks root cause is fail to open image file with "O_DIRECT" on xfs file system;


thanks,
Xu

Comment 8 Xu Tian 2013-02-21 03:07:08 UTC
Since this defeat caused by fail to open file with O_DIRECT in XFS file-system, so move it file-system component and update bug title;

Thanks,
Xu

Comment 9 Xu Tian 2013-02-21 03:51:23 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Your image is /tmp/test1.img. What kind of file system is /tmp on? If it's
> > tmpfs, this doesn't support O_DIRECT, so the error would be expected.
> 
> hi Kevin,
> 
> create image file via "qemu-img create -f qcow2 /root/test.img 1G" and try
> to start up guest with cache=none still failed;  file system on /root is xfs:
> 
> /dev/mapper/rhel-root / xfs rw,relatime,attr2,inode64,noquota 0 0
> 
> try "dd if=/dev/zero of=/root/test2.img oflag=direct bs=1 count=1" it failed
> too, it looks root cause is fail to open image file with "O_DIRECT" on xfs
> file system;
> 
> 
> thanks,
> Xu

sorry to used incorrect command in above comments, please ignore it;

used a incorrect dd command:"dd if=/dev/zero of=/root/test2.img oflag=direct bs=1 count=1", invalid value of bs; 

try with "dd if=/dev/zero of=/root/test2.img oflag=direct bs=1M count=1" dd works well;

thanks,
Xu

Comment 10 Xu Tian 2013-02-21 04:00:41 UTC
test below case:

1: create qcow2 image via qemu-img:

result: guest not start up

[root@localhost ~]# qemu-img create -f qcow2 /root/test-qcow2.img  1G 
Formatting '/root/test-qcow2.img', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off 
[root@localhost ~]# qemu-img info /root/test-qcow2.img 
image: /root/test-qcow2.img
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 196K
cluster_size: 65536
[root@localhost ~]# qemu-kvm -drive file=/root/test-qcow2.img,if=none,cache=none,media=disk,format=qcow2 -vnc :0
qemu-kvm: -drive file=/root/test-qcow2.img,if=none,cache=none,media=disk,format=qcow2: could not open disk image /root/test-qcow2.img: Invalid argument

2: create raw image with "qemu-img" 

result: guest start up 

[root@localhost ~]# qemu-img create -f raw test-raw.img 1G
Formatting 'test-raw.img', fmt=raw size=1073741824 
[root@localhost ~]# qemu-kvm -drive file=/root/test-raw.img,if=none,cache=none,media=disk,format=raw -vnc :0

3. create raw image with "dd"

result: guest start up

[root@localhost ~]# dd if=/dev/zero of=/root/test-dd.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 0.345461 s, 3.1 GB/s
[root@localhost ~]# qemu-kvm -drive file=/root/test-dd.img,if=none,cache=none,media=disk,format=raw -vnc :0(In reply to comment #8)
> Since this defeat caused by fail to open file with O_DIRECT in XFS
> file-system, so move it file-system component and update bug title;
> 
> Thanks,
> Xu

test below case:

1: create qcow2 image via qemu-img:

result: guest not start up

[root@localhost ~]# qemu-img create -f qcow2 test-qcow2.img 1G
Formatting 'test-qcow2.img', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off

[root@localhost ~]# strace  -o /tmp/strace.log qemu-kvm -drive file=/root/test-qcow2.img,if=none,cache=none,media=disk,format=qcow2 -vnc :0
qemu-kvm: -drive file=/root/test-qcow2.img,if=none,cache=none,media=disk,format=qcow2: could not open disk image /root/test-qcow2.img: Invalid argument

[root@localhost ~]# qemu-img info /root/test-qcow2.img
image: /root/test-qcow2.img
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 196K
cluster_size: 65536
[root@localhost ~]# 


2: create raw image with "qemu-img" 

result: guest start up 

[root@localhost ~]# qemu-img create -f raw test-raw.img 1G
Formatting 'test-raw.img', fmt=raw size=1073741824 
[root@localhost ~]# qemu-kvm -drive file=/root/test-raw.img,if=none,cache=none,media=disk,format=raw -vnc :0

3. create raw image with "dd"

result: guest start up

[root@localhost ~]# dd if=/dev/zero of=/root/test-dd.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 0.345461 s, 3.1 GB/s
[root@localhost ~]# qemu-kvm -drive file=/root/test-dd.img,if=none,cache=none,media=disk,format=raw -vnc :0

Base on above test result, move back this bug to qemu-kvm component;

Comment 11 Xu Tian 2013-02-21 04:02:44 UTC
Created attachment 700331 [details]
strace output

Comment 12 Xu Tian 2013-02-21 04:09:13 UTC
Hi Kevin,

qemu-img version is "qemu-img-1.3.0-5.el7.x86_64", and I have post strace output; do you have suggestion? Anything need me to try, please ping me when free.

thanks,
Xu

Comment 13 Kevin Wolf 2013-02-21 09:23:36 UTC
Please use -f with strace, the main thread of qemu doesn't do anything interesting.

Does dd oflag=direct work with a block size of 512?

Comment 14 Xu Tian 2013-02-21 10:55:58 UTC
(In reply to comment #13)
> Please use -f with strace, the main thread of qemu doesn't do anything
> interesting.
> 
> Does dd oflag=direct work with a block size of 512?

Hi Kevin,

"dd if=/dev/zero of=/root/test.img  oflag=direct  bs=512b" works fine, but bs=1k not work, see details below:

[root@localhost ~]# dd if=/dev/zero of=/root/test.img  oflag=direct  bs=512b count=100
100+0 records in
100+0 records out
26214400 bytes (26 MB) copied, 0.361657 s, 72.5 MB/s

[root@localhost ~]# dd if=/dev/zero of=/root/test.img  oflag=direct  bs=1k count=100
dd: writing ‘/root/test.img’: Invalid argument
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000215752 s, 0.0 kB/s
[root@localhost ~]# dd if=/dev/zero of=/root/test.img  oflag=direct  bs=4k count=1024
1024+0 records in
1024+0 records out
4194304 bytes (4.2 MB) copied, 0.277361 s, 15.1 MB/s
[root@localhost ~]# dd if=/dev/zero of=/root/test.img  oflag=direct  bs=4k count=10240
10240+0 records in
10240+0 records out
41943040 bytes (42 MB) copied, 1.22037 s, 34.4 MB/s

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.7.0-0.34.el7.x86_64 #1 SMP Thu Jan 31 13:59:22 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

thanks,
Xu

Comment 15 Xu Tian 2013-02-21 12:21:58 UTC
Re-test this defeat with below scenerios:

boot guest with 4k virtual block size + raw image:

guest start up

[root@localhost ~]#  /usr/libexec/qemu-kvm -drive file=/root/test.raw,if=none,cache=none,format=raw,media=disk,id=drive-virtio-disk1 -device virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1,physical_block_size=4096  -smp 1 -m 512 -vnc :0

boot guest boot guest with 4k virtual block size + qcow2 image:

fail to start up guest

[root@localhost ~]#  /usr/libexec/qemu-kvm -drive file=/root/test.qcow2,if=none,cache=none,format=qcow2,media=disk,id=drive-virtio-disk1 -device virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1,physical_block_size=4096  -smp 1 -m 512 -vnc :0
qemu-kvm: -drive file=/root/test.qcow2,if=none,cache=none,format=qcow2,media=disk,id=drive-virtio-disk1: could not open disk image /root/test.qcow2: Invalid argument


Thanks for Kevin Wolf help on re-test this defeat;

Xu

Comment 16 Xu Tian 2013-02-26 08:12:37 UTC
(In reply to comment #15)
> Re-test this defeat with below scenerios:
> 
> boot guest with 4k virtual block size + raw image:
> 
> guest start up
> 
> [root@localhost ~]#  /usr/libexec/qemu-kvm -drive
> file=/root/test.raw,if=none,cache=none,format=raw,media=disk,id=drive-virtio-
> disk1 -device
> virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1,
> physical_block_size=4096  -smp 1 -m 512 -vnc :0
> 
> boot guest boot guest with 4k virtual block size + qcow2 image:
> 
> fail to start up guest
> 
> [root@localhost ~]#  /usr/libexec/qemu-kvm -drive
> file=/root/test.qcow2,if=none,cache=none,format=qcow2,media=disk,id=drive-
> virtio-disk1 -device
> virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1,
> physical_block_size=4096  -smp 1 -m 512 -vnc :0
> qemu-kvm: -drive
> file=/root/test.qcow2,if=none,cache=none,format=qcow2,media=disk,id=drive-
> virtio-disk1: could not open disk image /root/test.qcow2: Invalid argument
> 
> 
> Thanks for Kevin Wolf help on re-test this defeat;
> 
> Xu

My hard disk sector size:

Sector size (logical/physical): 512 bytes / 4096 bytes

Comment 17 Qian Guo 2013-10-11 04:47:37 UTC
*** Bug 1018028 has been marked as a duplicate of this bug. ***

Comment 18 Ademar Reis 2013-12-06 12:17:25 UTC
*** Bug 960803 has been marked as a duplicate of this bug. ***

Comment 19 Kevin Wolf 2014-01-22 11:06:50 UTC

*** This bug has been marked as a duplicate of bug 748906 ***


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