Wiping Out Data

Carsten Aulbert carsten at welcomes-you.com
Wed Mar 28 10:37:04 UTC 2007


Jeffrey F. Bloss wrote:
> This is exactly what I tried with a USB device, only using
> if=/dev/random. It failed with the "no media" error unless the drive
> was mounted.

Let's see, plugging in USB-stick, 512 MB in size:

# sfdisk --list /dev/sdb

Disk /dev/sdb: 1011 cylinders, 17 heads, 60 sectors/track
Units = cylinders of 522240 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+   1010    1011-    515580    c  W95 FAT32 (LBA)
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty

device is not mounted, running dd on partition:
(note that I use urandom, because I don't want to wait that long)

# time dd if=/dev/urandom of=/dev/sdb1 bs=1M
dd: writing `/dev/sdb1': No space left on device
504+0 records in
503+0 records out
527953920 bytes (528 MB) copied, 195.147 seconds, 2.7 MB/s

real    3m15.151s
user    0m0.004s
sys     2m5.532s

Checking again:

# mount /dev/sdb1 /media/usbdisk/
mount: you must specify the filesystem type
(to be expected, sfdisk output like above)

Now the full stick:

# time dd if=/dev/urandom of=/dev/sdb bs=1M
dd: writing `/dev/sdb': No space left on device
504+0 records in
503+0 records out
528089088 bytes (528 MB) copied, 179.724 seconds, 2.9 MB/s

real    2m59.727s
user    0m0.000s
sys     1m59.587s

Check with layout:
sfdisk --list /dev/sdb

Disk /dev/sdb: 1011 cylinders, 17 heads, 60 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition table type
No partitions found


So, in the end, I don't know what you have tried, but it certainly does
work the way at least I expect is.

Cheers

Carsten

PS: To cure the USB stick now, just create a nice partition /dev/sdb1
and format it with mkfs.vfat






More information about the ubuntu-users mailing list