Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to copy an image to a USB thumb drive. As I would like to get "real" speeds, and don't want to wait ages for the device to sync after copying the image, I would like to know which options to use for that.

share|improve this question
up vote 1 down vote accepted

Reading through the source code shows that you should also be asking about the nocache option as well. The direct option should get you what you want, but it also depends on what version of dd you're playing around with. Doing a large copy an an Ubuntu 11.04 system showed me even slower (=closer to reality?) times with the dsync option uses synchronized i/o for data, which likely loses the aggregation advantage that modern disk controllers give us. To know "exactly" what's going on, you're going to have to dig into the source code for the particular kernel you're running, but even then you're at the mercy of the interface board on the drive, which does its own buffering.

share|improve this answer
You're not at the mercy of the drive; when the fsync() or direct write() completes, the data is on the platter. – psusi Jan 30 '12 at 16:25

The fsync option will flush the data at the end of the copy. The dsync option will flush the data after every block. The direct option will have similar results as dsync, only without polluting the filesystem cache with the data. This is good for caching the rest of the system, and saves some cpu overhead.

Either dsync or direct will give lower throughput, but that can be mostly offset by using a large block size, such as 1MB or more.

share|improve this answer
What happens when oflag=direct makes writes faster? I have an extended question about just that on… – Michael Graff Jan 27 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .