Despite popular belief, dd
is a perfectly ordinary command, it isn't more low-level than cat
or cp
. Your command reads from the disk cache and writes to the disk buffers like any other command.
In order to make sure that the data is fully written to the physical media, you need to call sync
. The command sync
flushes all output buffers to the disk(s). When the sync
command returns, the data has been fully written¹.
sudo dd if=~/Desktop/ubuntu.iso of=/dev/sdx bs=1M; sync
Most of the time, you don't need to call sync
, because unmounting a filesystem does the same job. When the umount
command returns, or when you get a confirmation message after clicking “Eject”, the buffers have been written to the disk. Here, you're directly writing to the disk without going through a mounted filesystem, so you need to explicitly flush the buffer.
Note that instead of dd
, you could use tee
. This has two advantages: there's less risk of inverting the source and destination due to a typo, and it's probably slightly faster.
<~/Desktop/ubuntu.iso sudo tee /dev/sdx >/dev/null; sync
¹ At least on a “normal” Ubuntu system, or more generally Linux. This may not be true on other Unix-like systems or if Linux is running in a virtual environment (Cygwin, WSL, virtual machine, …). In a virtual environment, flushing writes to persistent storage may require the cooperation of the host system.
sync
?sync
might wait.dd
also has some sync options, for exampleconv=fsync
. That said, I never had to use it with/dev/sd*
drives myself. If you literally used/dev/sdx
my guess would've been you had a useless 959MB file in/dev
(ramdisk) now...