This question already has an answer here:
I've been developing a make target that uses
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).
- Where was dd putting the data it thought it was writing?
- Was there some way I could reset the card reader without rebooting?