
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bhR347vL55SA6RBIfMovKtx9QhoMUo0mw Content-Type: multipart/mixed; boundary="Rex9njBKm0vVDcsej8W9ig7Xt3vd8hFbN"; protected-headers="v1" From: Max Reitz <mreitz@redhat.com> To: Nir Soffer <nsoffer@redhat.com>, Gianluca Cecchi <gianluca.cecchi@gmail.com>, "qemu-block@nongnu.org" <qemu-block@nongnu.org> Cc: Paolo Margara <paolo.margara@polito.it>, users <users@ovirt.org> Message-ID: <5c36d206-1e28-9376-dd68-3675793af55f@redhat.com> Subject: Re: [Qemu-block] import thin provisioned disks with image upload References: <CAG2kNCy9Ok=rqbAi4i+XfWGoF=pSjugsAv=iP=whgf7QPtJVsA@mail.gmail.com> <CAMRbyyu4rchkT8WYE-QWwkFZFKGaKtFzoLPX1_jkwYDhNBn0Mg@mail.gmail.com> In-Reply-To: <CAMRbyyu4rchkT8WYE-QWwkFZFKGaKtFzoLPX1_jkwYDhNBn0Mg@mail.gmail.com> --Rex9njBKm0vVDcsej8W9ig7Xt3vd8hFbN Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2017-12-07 21:33, Nir Soffer wrote: [...]
=20 Trying harder... =C2=A0 =20 The term "file size" is ambiguous in this context... =20 =20 It is not. file size is what you get from stat: =20 $ truncate -s 1g empty =20 $ stat empty=C2=A0 =C2=A0 File: 'empty' =C2=A0 Size: 1073741824Blocks: 0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IO B= lock: 4096=C2=A0 =C2=A0regular file =C2=A0 ... =20 $ qemu-img info empty image: empty file format: raw virtual size: 1.0G (1073741824 bytes) disk size: 0 =20 The value "disk size" used by qemu-img is confusing and not useful when you want to transfer the file to another host. =20 I don't know why qemu-img display this value instead of the actual file size, adding qemu-block mailing list in case someone can explain this.
Because I still think it's ambiguous. $ qemu-img create -f raw empty 1G Formatting 'empty', fmt=3Draw size=3D1073741824 $ qemu-img info empty image: empty file format: raw virtual size: 1.0G (1073741824 bytes) disk size: 0 $ LANG=3DC stat empty File: empty Size: 1073741824 Blocks: 0 IO Block: 4096 regular file [...] $ ls -s empty 0 empty $ du -h empty 0 empty $ ls -l empty -rw-r--r--. 1 maxx maxx 1073741824 8. Dez 16:20 empty What "stat" reports as "size" I'd call the length (what qemu-img info calls "virtual size" for raw images). What I (and qemu-img info) call "size" is how much disk space is actually used. And both ls -s and du agree that it's 0 bytes in this case. By the way, yes, "stat" has a different definition of "size", so that seems wrong. But I argue that the "ls" option is called "--size", so there's a conflict already and qemu-img info is not the first tool to disagree with stat on this. Max --Rex9njBKm0vVDcsej8W9ig7Xt3vd8hFbN-- --bhR347vL55SA6RBIfMovKtx9QhoMUo0mw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQFGBAEBCAAwFiEEkb62CjDbPohX0Rgp9AfbAGHVz0AFAloqrm0SHG1yZWl0ekBy ZWRoYXQuY29tAAoJEPQH2wBh1c9Ap4wH/3X1J+p8aum+Mp+Z7zMLpxwp4dqqfvhv +yzMUabVkS4hOlow6PmeAyI4boW/pPOnRTnTMBTVdPXf50OnLYJovXSdwkInsaPy 66UindBWKRvAH0FQxOkuBSvtj2sks0T+PLv+kLGlnFQ5FVYHVUNflm3KKyyR8Sgc VL2ptdL8BO4g0SFqwT0svivlrsCCTpcywCoA8cBqGm9SH2gNYyAvC10zG0pkrLSm rIEqo/RTgT24vlnPo5a699oH/c82oK5bB5h7Tx+yOHsnJy2tunb/xU5zHt19yehg bLX4k4POVoE1sFO2HGq92nt0pQR6Efk+aOGX1f6Y1p4QG7EPlnItp6A= =tS9i -----END PGP SIGNATURE----- --bhR347vL55SA6RBIfMovKtx9QhoMUo0mw--