Re: Why doesn't 13_4 img (1.3G) write to a 4 G memstick?
- In reply to: Gary Aitken : "Why doesn't 13_4 img (1.3G) write to a 4 G memstick?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Jan 2025 19:56:21 UTC
Gary Aitken wrote:
> $ xz --decompress < /hd2/Downloads/FreeBSD/13_4/FreeBSD-13.4-RELEASE-amd64-memstick.img.xz | dd of=/dev/da0 bs=1M conv=sync
I don't like use of conv=sync coupled with dd reading from a pipe
especially when the source is a slow decompress utility. Not what you
want there.
conv=value[,value ...]
Where value is one of the symbols from the following list.
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.
You really, really, really do not want to be padding short read blocks
in this situation. If xz cannot keep up then dd will be padding a lot
of blocks and "creating" data. Since you reported that it overflowed
your device that seems most likely to have happened here. That will
never happen when reading from a file but might happen when reading
from a pipe with a slow source writing to it with a different block
size.
I think what you actually wanted was this.
xz --decompress < /hd2/Downloads/FreeBSD/13_4/FreeBSD-13.4-RELEASE-amd64-memstick.img.xz | dd of=/dev/da0 bs=1M iflag=fullblock oflag=sync,direct
iflag=value[,value ...]
Where value is one of the symbols from the following list.
fullblock Reading from the input file may not obtain a full
block. When a read returns short, continue reading
to fill the block. Without this flag, count limits
the number of times read(2) is called on the input
rather than the number of blocks copied in full. May
not be combined with conv=sync.
oflag=value[,value ...]
Where value is one of the symbols from the following list.
sync Set the O_SYNC flag on the output file to make writes
synchronous. This is synonymous with the fsync value.
direct Set the O_DIRECT flag on the output file to make writes
bypass any local caching.
Bob