# How long should I wait for use dd command to complete a usb?

I can't see the logo of fedora after I opened my Mac to choose the usb (but I can see windows and EFI these two choices only), so I searched on the web. Then I found the fedora document , it told me use "sudo dd if=... of=... bs=1m"(I wrote 2m there) to complete a usb device for install fedora for Mac. But I met another question: the command didn't respond me for a long time and I don't know the program is still working. And how long should I wait.

edit retag close merge delete

Sort by » oldest newest most voted

Brief: depends on many factors: your USB controller, (on some systems) the port you used to connect the device, the USB device, and how the device is recognized by OS. Sometimes, it can take a very long time. And, you can be almost sure that dd will finish eventually!

If you want to check dd's progress, use what @randomuser or @karandeepchahal told you (I'd prefer the former). However, notice that on some USB devices, iostat might show 0 write speed at some times and non-zero one at other times (this specially happened on some older kernels with some USB devices).

However, if the write speed seems very slow, you should check/try the following:

1. (Easiest!) Try another USB device
2. Make sure that the device is recognized properly. So if you expect USB 3 performance, it should be recognized on a USB 3 port; and if it is USB 2.0 it should be recognized as that. Sometimes, with some USB devices, I've seen that they are recognized incorrectly; e.g. a USB 2.0 device is recognized as USB 1, and hence the read/write speed will be very slow. To fix that, you need to disconnect and reconnect the device until it is properly detected (assuming that USB ports are assigned dynamically, if not, just connect the USB device to another port). The method to detect how it is recognized is given at the end.
3. Try running dd with a smaller bs= and also adding oflag=sync. For some devices, specially on older kernels, it can result in much faster writes.

Determine how a USB device is recognized (there might be a better way, this is what I've come up with myself): Check lsusb output, and determine the Bus number your device is connected to. Then, find another line with the same Bus number and see what kind of device it is. In the following example, Foo Device is on bug number 002, so it is recognized as USB 2.0 (because of having Linux Foundation 2.0 root hub on Bus 002), but Bar Device on Bus 005 is recognized as USB 1.1 (because of Linux Foundation 1.1 root hub on bus 005). So, If Bar Device is your USB storage media, you should reconnect it until it is recognized as USB 2.0. (It is OK for some non-storage devices to be recognized as USB 1.1, since they really are!)

[hedayat@hvlap ~]% lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID abcd:1111 Foo Device
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 1111:abcd Bar Device


Finally, IIRC, when you connect a USB 2.0 device but it is recognized as USB 1, kernel will generate an appropriate message in its logs saying that the device ...

more

You can make dd output it's progress by sending a USR1 signal to it, like this:

kill -USR1 $(pidof dd)  more This is a nonsense to use bs=1m or 2m. This is a block size of the media. The ISOs are usually using 512 bytes. It will work with different sizes but may cause some warnings. dd is a raw read and write to the device, there is no known size the progress may display. To see a kind of progress use additional utility "pv" - example: dd if=/dev/zero bs=512 count=2000000 | pv | dd of=/dev/null bs=512  After dd I would use sync  before removing usb drive. more You can keep checking the io stats to see if IO is still going to the disk. If it is, then you should wait until it finishes. For example: :~$ iostat -m Linux 3.18.7-200.fc21.x86_64 (hades) 02/24/2015 _x86_64_ (4 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle 1.46 0.04 0.59 1.21 0.00 96.70

Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn sda 7.23 0.16 0.16 13311 12711 dm-0 8.85 0.16 0.16 13307 12711 dm-1 0.05 0.00 0.00 5 10 dm-2 2.73 0.03 0.02 2755 1908 dm-3 5.99 0.13 0.13 10546 10792

\$

more