1

This question already has an answer here:

I've been developing a make target that uses dd (actually dcfldd) to write a Raspbian Jessie image to an SD card. The target is just

flash:
    sudo dcfldd bs=4M if=$(IMGPATH) of=$(SDX)
    sync

where $(SDX) is /dev/sdc. See this question for a couple more details.

At one point, I removed the SD card from the USB card reader, tested it in the Raspberry Pi, and made some notes for changes to the script. However, I forgot to take it out the RPi and put it back into the reader (which was still in the USB socket) before calling the make target again. Bizarrely, no errors were thrown; but the ~4GB of data was "written" in seconds.

After this, putting the card in properly and calling the target again resulted in the same super-fast "copy", but the card did not appear to be altered.

I tried reformatting the card multiple times with the "Disks" tool in Ubuntu and with gparted, but the only way to get it flashing properly again was to reboot the machine. Of course, I also tried removing and reinserting the reader from the USB socket.

With the reader inserted, but with no card, I see only /dev/sdc. With the card also inserted, I see /dev/sdc, /dev/sdc1, and /dev/sdc2 (with the Raspbian image on the card).

I'm wondering

  1. Where was dd putting the data it thought it was writing?
  2. Was there some way I could reset the card reader without rebooting?

marked as duplicate by sawdust, DavidPostill, Community Jul 26 '16 at 0:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Since the command has superuser privileges, and the device node doesn't exist because you didn't insert the SDcard, the likely explanation is that a file of that name was created in the /dev directory by executing your dd command. The data was simply written to an ordinary file. This file conflicted with the (dynamically-created) device node until you rebooted. – sawdust Jul 25 '16 at 1:31
  • @grawity Indeed it is. I'll verify this evening that the solution there works for me, then this question can be deleted or closed or whatever. – tsbertalan Jul 25 '16 at 17:03
  • @grawity Total dupe confirmed. And barely a month later, at that. I'll push the "That solved my problem!" button now. – tsbertalan Jul 26 '16 at 0:02
1

Check to see if /dev/sdc is suddenly a regular file full of your data. Although I would normally expect it to be a special file that is either connected a live device, or giving "not found errors," there may be circumstances where the special file was accidentally deleted. You'd have to be root to do that, but I've fat-fingered myself into the situation before and your symptoms are mighty familiar.

If it did get deleted, then you will need to read up on the mknod command in order to recreate it.

  • It turns out that, with the reader inserted but no card, I just get a dcfldd:/dev/sdc: No medium found error. With no reader or card, I do in fact get a regular file, and deleting this (as root) is all that's needed to restore normal function. – tsbertalan Jul 25 '16 at 23:59

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