7

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.

2 Answers 2

3

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.

2
  • 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, 2012 at 16:25
  • psusi no, some disks lie
    – behrooz
    Apr 19, 2017 at 18:58
5

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.

1

You must log in to answer this question.

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