Following instructions on this page, the page showed a dd
command and a sync
option at the end. The command is the following:
xzcat ~/ubuntu.img.xz | sudo dd of=/dev/sdX bs=32M sync
I know what is dd
and how it works but I've never heard of or used the sync
option with it and its manual page entry is like:
sync pad every input block with NULs to ibs-size; when used with
block or unblock, pad with spaces rather than NULs
What is NUL
and why is it padded to ibs-size
, and why bother padding the data blocks and use the sync
option with the dd
command? Why not keeping it simple and easy?
When I try to run sync
with the command as it is with the appropriate location and values I get the following error:
dd: unrecognized operand ‘sync’
Try 'dd --help' for more information.
dd ... conv=sync
argument. – Byte Commander Dec 06 '15 at 19:38conv=sync
option it seems quite clear why it isn't used for this. At best it would do nothing, at worst it would corrupt the image during copying. – kasperd Dec 06 '15 at 23:22oflag=fsync
( which flushes the output dd has written ) instead of async
command ( which flushes everything on the system. – psusi Dec 07 '15 at 00:10sync
is an argument to bothconv
and theiflag
oroflag
options. – Dan Loewenherz Aug 07 '16 at 20:16oflag=fsync
;fsync
is a symbol for theconv
operand. Seeinfo '(coreutils) dd invocation'
as suggested inman dd
- which has correct indentation. forfsync
under theconv
operand: Synchronize output data and metadata just before finishing. This forces a physical write of output data and metadata. The correct argument isconv=fsync
. test:docker run -it --rm --name testdd ubuntu /bin/bash
and thendd if=/dev/zero of=/dev/null conv=fsync count=1
which works.oflag=fsync
throws invalid output flag: 'fsync' – Life5ign May 12 '23 at 03:22