zeroing out part of an SDcard

Stephen Berg (Contractor) stephen.berg.ctr at nrlssc.navy.mil
Thu Aug 21 13:10:07 UTC 2014


On 08/21/2014 07:51 AM, Robert Moskowitz wrote:
> 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...
>
>
I'd create a new partition on the remainder of the card, and then dd 
/dev/zero to that partition.  I don't know squat about the bits and 
pieces of partition structure but that should wipe most of it at least.

-- 
Stephen Berg
Systems Administrator
NRL Code: 7320
Office: 228-688-5738
stephen.berg.ctr at nrlssc.navy.mil



More information about the users mailing list