zeroing out part of an SDcard

Robert Moskowitz rgm at htt-consult.com
Thu Aug 21 12:51:11 UTC 2014


More on my compressing images from SDcards.

I only need the boot info and 1st partition, so I remove the other 
partitions, but of course there is still 1s out there so it will not 
compress efficiently. I want to zero out the end of the card so first I 
use fdisk:

# fdisk -l /dev/sdb

Disk /dev/sdb: 7.4 GiB, 7969177600 bytes, 15564800 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: 0x0009e2ad

Device Boot Start End Blocks Id System
/dev/sdb1 8192 1007615 499712 83 Linux

Then dd:

# dd if=/dev/zero of=/dev/sdb bs=1M seek=1007620
dd: ‘/dev/sdb’: cannot seek: Invalid argument
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000652852 s, 0.0 kB/s

======================

seems you cannot seek on an SDcard. How do I do this? Since the change 
in partition 1 is trivial, if I have to start again from an SDcard with 
all 3 paritions, I can do that...




More information about the users mailing list