From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 599FEC433ED for ; Mon, 12 Apr 2021 15:13:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93C1760C3E for ; Mon, 12 Apr 2021 15:13:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93C1760C3E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bugs.launchpad.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVyG8-00033y-9t for qemu-devel@archiver.kernel.org; Mon, 12 Apr 2021 11:13:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVyF1-0002ZR-Do for qemu-devel@nongnu.org; Mon, 12 Apr 2021 11:12:43 -0400 Received: from indium.canonical.com ([91.189.90.7]:52996) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVyEx-00043t-QF for qemu-devel@nongnu.org; Mon, 12 Apr 2021 11:12:43 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.86_2 #2 (Debian)) id 1lVyEv-0003V5-BN for ; Mon, 12 Apr 2021 15:12:37 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 396012E8165 for ; Mon, 12 Apr 2021 15:12:37 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Mon, 12 Apr 2021 14:59:58 -0000 From: Albert Kao <1759522@bugs.launchpad.net> To: qemu-devel@nongnu.org X-Launchpad-Notification-Type: bug X-Launchpad-Bug: product=qemu; status=New; importance=Undecided; assignee=None; X-Launchpad-Bug-Tags: qemu-img X-Launchpad-Bug-Information-Type: Public X-Launchpad-Bug-Private: no X-Launchpad-Bug-Security-Vulnerability: no X-Launchpad-Bug-Commenters: atmgnd dogbertai maro the.netadmin voltagex X-Launchpad-Bug-Reporter: Zixuan Wang (the.netadmin) X-Launchpad-Bug-Modifier: Albert Kao (dogbertai) References: <152222836105.21062.2375148895134658603.malonedeb@chaenomeles.canonical.com> Message-Id: <161823959862.29979.14372659933655095391.malone@wampee.canonical.com> Subject: [Bug 1759522] Re: windows qemu-img create vpc/vhdx error X-Launchpad-Message-Rationale: Subscriber (QEMU) @qemu-devel-ml X-Launchpad-Message-For: qemu-devel-ml Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="f3c8a1aed7c0b9bc4f5601dbf2698b30e1ab66f1"; Instance="production" X-Launchpad-Hash: 1a7d1ede5751a5fac2325d86eef418ec5a9e10fd Received-SPF: none client-ip=91.189.90.7; envelope-from=bounces@canonical.com; helo=indium.canonical.com X-Spam_score_int: -65 X-Spam_score: -6.6 X-Spam_bar: ------ X-Spam_report: (-6.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Bug 1759522 <1759522@bugs.launchpad.net> Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" I noticed the cloudbase version does NOT have this issue. https://cloudbase= .it/qemu-img-windows/ The weilnetz version DOES have this issue. https://qemu.weilnetz.de/w64/ So, I found the source code for each release and compared them. cloudbase https://repo.or.cz/w/qemu/ar7.git/ weilnetz https://github.com/cloudbase/qemu git remote add origin git://repo.or.cz/qemu/ar7.git git remote add cloudbase https://github.com/cloudbase/qemu.git git fetch --all git diff v2.3.0 cloudbase/v2.3.0-cloudbase And I see that the cloudbase version comments out set_sparse(fd). I think the solution is to remove set_sparse. You can find it in block/file-win32.c ** Attachment added: "git diff v2.3.0 cloudbase/v2.3.0-cloudbase" https://bugs.launchpad.net/qemu/+bug/1759522/+attachment/5486954/+files/= diff%20v2.3.0%20cloudebasev2.3.0-clousebase.txt -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1759522 Title: windows qemu-img create vpc/vhdx error Status in QEMU: New Bug description: On windows, using qemu-img (version 2.11.90) to create vpc/vhdx virtual disk tends to fail. Here's the way to reproduce: 1. Install qemu-w64-setup-20180321.exe 2. Use `qemu-img create -f vhdx -o subformat=3Dfixed disk.vhdx 512M` to c= reate a vhdx: Formatting 'disk.vhdx', fmt=3Dvhdx size=3D536870912 log_size=3D1048576= block_size=3D0 subformat=3Dfixed 3. Execute `qemu-img info disk.vhdx` gives the result, (note the `disk si= ze` is incorrect): image: disk.vhdx file format: vhdx virtual size: 512M (536870912 bytes) disk size: 1.4M cluster_size: 8388608 4. On Windows 10 (V1709), double click disk.vhdx gives an error: Make sure the file is in an NTFS volume and isn't in a compressed fold= er or volume. Using Disk Management -> Action -> Attach VHD gives an error: The requested operation could not be completed due to a virtual disk s= ystem limitation. Virtual hard disk files must be uncompressed and uneccryp= ted and must not be sparse. Comparison with Windows 10 created VHDX: 1. Using Disk Management -> Action -> Create VHD: File name: win.vhdx Virtual hard disk size: 512MB Virtual hard disk format: VHDX Virtual hard disk type: Fixed size 2. Detach VHDX 3. Execute `qemu-img info win.vhdx` gives the result: image: win.vhdx file format: vhdx virtual size: 512M (536870912 bytes) disk size: 516M cluster_size: 33554432 Comparison with qemu-img under Ubuntu: 1. Version: qemu-img version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.16), Copyright (c) 2004-2008 Fabrice Bellard 2. qemu-img create -f vhdx -o subformat=3Dfixed lin.vhdx 512M Formatting 'lin.vhdx', fmt=3Dvhdx size=3D536870912 log_size=3D1048576 = block_size=3D0 subformat=3Dfixed 3. qemu-img info lin.vhdx image: lin.vhdx file format: vhdx virtual size: 512M (536870912 bytes) disk size: 520M cluster_size: 8388608 4. Load lin.vhdx under Windows 10 is ok The same thing happens on `vpc` format with or without `oformat=3Dfixed`, it seems that windows version of qemu-img has some incorrect operation? My guess is that windows version of qemu-img doesn't handle the description field of vpc/vhdx, which leads to an incorrect `disk size` field. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1759522/+subscriptions