0

Was going through my usual process of writing a Raspbian image to a microSD card using sudo dd bs=1m if=/my_pi-zero.img of=/dev/rdisk3 conv=sync on my mac and I received the following message

dd: /dev/rdisk3: Device not configured
4451+0 records in
4450+0 records out
4666163200 bytes transferred in 582.264839 secs (8013816 bytes/sec)
Copied /Users/Matthew/Desktop/Photo-G/Pi-Zero.img to disk3

Typically dd: /dev/rdisk3: Device not configured is not part of that message.

However, when I plug the SD card into my Pi everything seems to be normal, could there be something wrong under the hood or should I just ignore it?

EDIT: It's also worth noting that the image file is 7.96gb so the transfer is being cut off partway through. The microSD card is 8gb and I haven't previously had a problem like this with this script.

Matt
  • 416
  • 2
  • 6
  • 16
  • PS The discrepancy between `records in` and `records out` means the last incomplete block is truncated. This may or may not cause problems. Raspbian at one stage produced images with partial blocks (although this has since been fixed) but Etcher handles these. – Milliways Oct 18 '18 at 05:21
  • @Milliways the reason I haven't been using etcher is that Im trying to flash many SD cards simultaneously. I've been using a self made python script that just multithreads the `dd` command I mentioned below – Matt Oct 18 '18 at 05:23
  • 1
    with `bs=1m` and an image file that is `7.96gb` one would expect about 8152 records in/out - the fact that you have only just over half suggests that yes, the SD card is faulty in some catastrophic way – Jaromanda X Oct 18 '18 at 07:46
  • @JaromandaX that makes sense. What I found weird though is that I tried writing the same img file to the same SD card using Etcher and it seemed to work totally successfully using that method. – Matt Oct 18 '18 at 08:16
  • oh ... well, then thta's a mystery! – Jaromanda X Oct 18 '18 at 08:18

3 Answers3

1

You try to write an image of 7.96gb but dd stopped to transfer data after 4666163200 bytes (4.66gb) without a definitely error message. This could be a sign that the SD Card is broken. You could test if the SD Card is complete writable with:

pc ~$ sudo dd bs=1m if=/dev/zero of=/dev/rdisk3 conv=fsync

Btw. you may use conv=sync to pad input blocks with null bytes but I suggest to also use conv=fsync to flush write buffers.

But failing buffered write to a SD Card cannot always be detected by the operating system even if you use a "read after write" test. To really check if a SD Card is writable without errors you have to use unbuffered I/O but this isn't supported by the OS out of the box. I have discussed this problem some times ago at Detect an SD card that became read-only. You may use that simple unbuffered I/O "read after write" test if your SD Card is complete writable.

Ingo
  • 40,606
  • 15
  • 76
  • 189
0

What is /dev/rdisk3: supposed to mean? What are the ":" there for? You are confusing the shell.

There is nothing wrong wrong with using dd but it is hazardous, and you risk ovderwriting your OS without warning.

I used to use a script with safety checks https://raspberrypi.stackexchange.com/a/29085/8697 but Etcher is easier and safer!

The discrepancy between records in and records out means the last (possibly) incomplete block is truncated. This may or may not cause problems, but unless the in/out sizes are identical is a cause for concern. There are many possible causes (including writing to a smaller card). As SD Cards are almost invariably multiples of the 4G Erase Block size, and you are using 1M blocks this seems unlikely.

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • I'm not sure what `/dev/rdisk3:` means (why there is a `:` there suddenly). `/dev/rdisk3` is the microSD card I'm trying to write to. My input is `sudo dd bs=1m if=/my_pi-zero.img of=/dev/rdisk3 conv=sync`. To your point that I might accidentally overwrite my OS, I always check to be sure with `diskutil list` to make sure I'm writing to the correct output – Matt Oct 18 '18 at 05:16
  • I added more info, I don't believe that discrepancy is because the last block was truncated since that isn't actually the last block. It stopped writing halfway through the full file size is almost 8gb. There is some larger issue at play here – Matt Oct 18 '18 at 06:31
  • the `:` is just how the error is reported ... `dd: youroutputfile: error message` – Jaromanda X Oct 18 '18 at 07:48
  • 1
    @Matt - the SD card is "broke" - use a new one :p – Jaromanda X Oct 18 '18 at 07:48
0

Surpisingly it wasn't an issue with the SD card as initially thought. It was an issue with the way I was reformatting the SD card to be FAT32.

I was trying to reformat the disk to FAT32 while setting the new name of the disk to new_name0. This was throwing an error though because the new name ought to be fully capitalized. After changing it to NEWNAME everything runs smoothly.

This would throw an error but I didn't notice because my python script would then immediately try to copy the image to the SD card, thereby burying the error in more text. This meant I was trying to write the img file to an unformated disk, ultimately resulting in the error dd: /dev/rdisk3: Device not configured

Matt
  • 416
  • 2
  • 6
  • 16