Use dd to erase a disk drive / USB flash...

Robert Leong -

Use Linux's dd command to 'zero out' a disk drive/USB flash, connect the drive to a Linux box via USB or similar, it should show up as a /dev/sd?,

then use dd if=/dev/zero of=/dev/sd? count=100000 to write it.

/dev/sde below is device we will 'zero out', it is an Intel SSD disk in this example.

Use 'lsscsi' or 'cvlabel -c' to list the devices.

[root@sbf-140100003 ~]# lsscsi
[0:2:0:0] disk LSI MR9260-16i 2.12 /dev/sda
[1:2:0:0] disk LSI MR9260-16i 2.12 /dev/sdb
[2:2:0:0] disk LSI MR9280-24i4e 2.12 /dev/sdc
[2:2:1:0] disk LSI MR9280-24i4e 2.12 /dev/sdd
[3:0:0:0] cd/dvd TSSTcorp CDDVDW SN-S083F SB01 /dev/scd0
[15:0:0:0] disk INTEL SS DSA2BW160G3 /dev/sde
[root@sbf-140100003 ~]#

[root@sbf-140100003 ~]# cvlabel -c
sb_140100003_data_0 /dev/sda 17565923295 EFI # host 0 lun 0 sectors 17565923295 sector_size 512 inquiry [LSI MR9260-16i 2.12] serial 600062B20003BBC017EB25C05FC38DE6
sb_140100003_data_1 /dev/sdb 17565923295 EFI # host 1 lun 0 sectors 17565923295 sector_size 512 inquiry [LSI MR9260-16i 2.12] serial 600062B20003C30017EB255559687AA9
sb_140100003_data_2 /dev/sdc 17565923295 EFI # host 2 lun 0 sectors 17565923295 sector_size 512 inquiry [LSI MR9280-24i4e 2.12] serial 600062B200100CC017E1FA8C0D88BA4F
CvfsDisk_UNKNOWN /dev/sdd # host 2 lun 0 sectors 975681503 sector_size 512 inquiry [LSI MR9280-24i4e 2.12] serial 600062B20003BBC0149D047E4E5E4484
sb_140100003_meta /dev/sde 311474143 EFI # host 15 lun 0 sectors 311474143 sector_size 512 inquiry [INTEL SSDSA2BW160G3 ] serial JMicron USB to ATA/ATAPI Bridge
[root@sbf-140100003 ~]#

Use dd to write the device, be absolutely positive the correct device is being written to.

[root@sbf-140100003 ~]# dd if=/dev/zero of=/dev/sde count=100000

100000+0 records in
100000+0 records out
51200000 bytes (51 MB) copied, 8.32537 seconds, 6.1 MB/s


[root@sbf-140100003 ~]# cvlabel -c
sb_140100003_data_0 /dev/sda 17565923295 EFI # host 0 lun 0 sectors 17565923295 sector_size 512 inquiry [LSI MR9260-16i 2.12] serial 600062B20003BBC017EB25C05FC38DE6
sb_140100003_data_1 /dev/sdb 17565923295 EFI # host 1 lun 0 sectors 17565923295 sector_size 512 inquiry [LSI MR9260-16i 2.12] serial 600062B20003C30017EB255559687AA9
sb_140100003_data_2 /dev/sdc 17565923295 EFI # host 2 lun 0 sectors 17565923295 sector_size 512 inquiry [LSI MR9280-24i4e 2.12] serial 600062B200100CC017E1FA8C0D88BA4F
CvfsDisk_UNKNOWN /dev/sdd # host 2 lun 0 sectors 975681503 sector_size 512 inquiry [LSI MR9280-24i4e 2.12] serial 600062B20003BBC0149D047E4E5E4484
CvfsDisk_UNKNOWN /dev/sde # host 15 lun 0 sectors 312563343 sector_size 512 inquiry [INTEL SSDSA2BW160G3 ] serial JMicron USB to ATA/ATAPI Bridge
[root@sbf-140100003 ~]#

The 1st 50MB of /dev/sde is now over written with zeros.

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.