I'm trying to clear an SD card connected via a USB dongle.

Here's what I do:

# dd if=/dev/zero of=/dev/sdb bs=$((1024*4))
dd: error writing '/dev/sdb': No space left on device
1002267+0 records in
1002266+0 records out
4105281536 bytes (4.1 GB, 3.8 GiB) copied, 2.10549 s, 1.9 GB/s

The weird things I see are: This is an SD HC I card, so the transfer should never reach 1.9GB/s. The card is 16GB and correctly reports as such in dmesg.

Ok, let's check it's written:

# head -c 4105281536 /dev/zero | sha1sum 
a1750724bfbf0ada57d986f16b26e789a6c61a1d  -
(reverse-i-search)`': ^C
# head -c 4105281536 /dev/sdb | sha1sum
a1750724bfbf0ada57d986f16b26e789a6c61a1d  -

Seems ok. But when I plug is out and in again, it magically has the same filesystem available as before. When I mount them and change the files, the modification is also persisted, even though the sha1sum still shows it as zeros.

The device is definitely /dev/sdb:

[ 9895.437518] scsi 4:0:0:0: Direct-Access     Mass     Storage Device        PQ: 0 ANSI: 0 CCS
[ 9895.439248] sd 4:0:0:0: [sdb] 30318592 512-byte logical blocks: (15.5 GB/14.5 GiB)
[ 9895.439398] sd 4:0:0:0: [sdb] Write Protect is off
[ 9895.439404] sd 4:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 9895.439557] sd 4:0:0:0: [sdb] No Caching mode page found
[ 9895.439564] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 9895.441922]  sdb: sdb1 sdb2
[ 9895.443517] sd 4:0:0:0: [sdb] Attached SCSI removable disk

What's happening here?

Running on kernel 4.20.3.

1 Answer 1


I notice dd it only copies 3.8 GiB when the drive is 14.5 GiB. So what you're writing to is most likely not the sd card. Unplug the SD card and then check ls -lh /dev/sdb.

I suspect you have accidentally created a regular file on /dev called /dev/sdb. Since /dev is a ram disk it explains why you can write to it at 2GBps

When you've finished your dd command, remember to sync just in case. This will tell the kernel to flush any cache it has.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .