Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Apr 2019 11:44:34 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Igor Mozolevsky <igor@hybrid-lab.co.uk>
Cc:        Ian Lepore <ian@freebsd.org>, Hackers freeBSD <freebsd-hackers@freebsd.org>
Subject:   Re: bhyve VM stopped to boot after moving virtio disks
Message-ID:  <E8014037-6A9E-423A-B369-8C06AF024808@yahoo.com>
In-Reply-To: <CADWvR2iR2THrrx7yK%2BguWKn_Zydnb%2BSFgD5FHFhVk-XeAzyZHQ@mail.gmail.com>
References:  <alpine.BSF.2.20.1904192255290.97274@puchar.net> <2006ff8da153bbe5e7f620da9260ee1518bd248f.camel@freebsd.org> <alpine.BSF.2.20.1904201729190.99712@puchar.net> <b0d23ad4b9f442a1a7342306443b855407f0765c.camel@freebsd.org> <CADWvR2iR2THrrx7yK%2BguWKn_Zydnb%2BSFgD5FHFhVk-XeAzyZHQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 2019-Apr-20, at 10:45, Igor Mozolevsky <igor at hybrid-lab.co.uk> =
wrote:

> On Sat, 20 Apr 2019 at 18:00, Ian Lepore wrote:
>=20
> <snip>
>> dd absolutely will fail to copy the last block of the source if it
>> isn't exactly the blocksize and you didn't specify conv=3Dsync, and =
it
>> will return a zero status when doing so.  It appears you've convinced
>> yourself otherwise, but for anyone else reading this thread, be =
aware:
>> conv=3Dsync is required to copy the last part of the source if it's
>> smaller than the blocksize.
>=20
>=20
> Isn't that contrary to the POSIX Spec? Reading the manual [1], it is
> implied (from STDERR part of the main section) that dd will read and
> write partial blocks, cf. truncated blocks?..
>=20
> 1. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/dd.html

Have you tried as Ian suggests to see if it made a difference?
Ian seems to be speaking FreeBSD, not necessarily POSIX. (I'm
talking actual FreeBSD behavior here, not necessarily documented
behavior.)

It turns out that https://www.freebsd.org/cgi/man.cgi?dd(1) does say:

     Normally, data resulting from input or conversion or both are =
aggregated
     into output blocks	of the specified size.	After the end of input =
is
     reached, any remaining output is written as a block.  This	means =
that the
     final output block	may be shorter than the	output block size.

where conv=3Dsync is described as:

sync
     Pad every input block to the input buffer size. Spaces
     are used for pad bytes if a block oriented conversion
     value is specified, otherwise NUL bytes are used.

(So sync changes the overall input size when it adds pad bytes, at
least as documented.)

It appears to me that Ian's expectations of the actual behavior and
the FreeBSD documentation of such are not a match. Absent testing,
I'd bet on Ian, even if it means FreeBSD dd has a bug.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E8014037-6A9E-423A-B369-8C06AF024808>