5

I do

$ df -h
...
/dev/sdc1       1,5G  1,5G     0 100% /media/username/Ubuntu 17.04 amd64

$ umount /dev/sdc1

$ df -h
...
#sdc1 now not listed

$ sudo dd if=./memtest86-usb.img of=sdc
307200+0 records in
307200+0 records out
157286400 bytes (157 MB, 150 MiB) copied, 2,78627 s, 56,5 MB/s

but flashdrive remain unchanged.

what is wrong?

  • 3
    @user68186 read the hover text on the downvote arrow. It doesn't say anything about whether something is a "common mistake". – hobbs Aug 1 '18 at 13:25
  • df only lists mounted partitions, so of course it would not show up in the output after unmounting. – Sergiy Kolodyazhnyy Aug 1 '18 at 13:31
  • 1
    Also, when writing image to a disk, it's often necessary to specify the block size, something like bs=4M. Also makes dd run a bit faster, iirc – Sergiy Kolodyazhnyy Aug 1 '18 at 13:33
  • 5
    You should be more careful when typing dd commands. That you make a mistake at all is an indication that you are not giving dd the respect it deserves. There's a reason seasoned *nix folks call it disk destroyer. – FourOhFour Aug 1 '18 at 16:44
  • 1
    @user68186 what was your point? Common mistakes shouldn't be downvoted? On the contrary, common mistakes are the ones most eligible for downvoting, because the downvoting tooltip says: "This question does not show any reasearch effort", and if it were indeed that common, basic research would have uncovered the mistake. – muru Aug 1 '18 at 18:00
31

Your command creates a file named sdc in the current directory. You want of=/dev/sdc.

So the complete correct command is:

sudo dd if=./memtest86-usb.img of=/dev/sdc

Run sync afterwards to synchronize cached writes to disk or use the conv=fsync option with dd.

  • 4
    Note that you'll also want to sync after dd but before removing the flash drive. – marcelm Aug 1 '18 at 14:46
  • 1
    (or use the conv=fsync option with dd) – muru Aug 2 '18 at 0:29
  • @muru I think oflag=sync would be more equivalent to a single sync command run afterwards? – detly Aug 2 '18 at 0:49
  • @detly the way I understand it, oflag=sync forces every write to be synchronized, but conv=fsync forces synchronization only at the end. So the former would have more consistent write speeds, perhaps, but the latter is more like a sync command run afterwards. – muru Aug 2 '18 at 0:55
  • @muru Ah you're right, I had it completely backwards. – detly Aug 2 '18 at 0:57
6

I support @RoVo's answer - it is a correct and good answer to the question.


I would like to add that dd is risky, and has caused problems for many users, because it will do what you tell it to do without any question. A minor typing error can make it overwrite an internal drive or a backup drive with important files.

You can play safer by using a [cloning] tool with a final checkpoint, that will give you a second chance to double-check and also display information about the available target devices.

  • Disks alias gnome-disks

  • mkusb

Link with more details: Cloning tools with a final checkpoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.