1

I keep getting disk space errors when using dd to write to raw disk on SD cards in an external, USB connected SD card reader.

➜  ~ gzip -cd < image.dd.gz | sudo dd of=/dev/rsda
dd: writing to '/dev/rsda': No space left on device
2598977+0 records in
2598976+0 records out
1330675712 bytes (1,3 GB, 1,2 GiB) copied, 7,08613 s, 188 MB/s

However, /dev/sda works and I am able to copy a gzip image to my laptops internal sd card reader.

gzip -cd < image.dd.gz | sudo dd of=/dev/rmmcblk 

I used fdisk and lsblk to examine the setup more closely:

➜  ~ sudo fdisk -l /dev/sda
Disk /dev/sda: 14,9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4f669081

➜  ~ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 14,9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

➜  ~ lsblk
sda                  8:0    1  14,9G  0 disk
mmcblk0            179:0    0  14,9G  0 disk

I noticed the subtle difference that the disk name for my internal drive is mmcklk0, but I seem to need to drop the 0 when writing to the raw disk. I'd be surprised if that were an issue.

I also explored this question - "dd command indicates not enough disk space - trying to format sd card for raspberry pi" - but nothing helped.

Any help would be appreciated!

Background: I'm cloning 200+ 16GB SD cards. Writing to raw takes 55s, and 20+ minutes without raw. Ideally, I would like to buy multiple SD card readers and clone ten at a time.

Mario Olivio Flores
  • 4,813
  • 4
  • 11
  • 12

1 Answers1

3

Linux has no concept of raw devices.

You are using /dev/rsda as the output device. However, there is no such device on linux, so what you are doing is writing to a plain file on the filesystem containing /dev. This is the reason why it seems so quick: you are not writing to the SD card, you are writing to disk.

wurtel
  • 15,835
  • 1
  • 29
  • 35