Unix/Linux Go Back    


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

unix and linux commands - unix shell scripting

How to use dd command to erase the data in disk

AIX


Tags
aix, unix

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 11-25-2010   -   Original Discussion by rainbow_bean
rainbow_bean's Unix or Linux Image
rainbow_bean rainbow_bean is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 6 February 2015, 4:07 PM EST
Posts: 114
Thanks: 1
Thanked 0 Times in 0 Posts
How to use dd command to erase the data in disk

how to use dd command to erase the data in disk, such as hdisk2?
Sponsored Links
    #2  
Old Unix and Linux 11-25-2010   -   Original Discussion by rainbow_bean
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 12 January 2018, 4:20 PM EST
Location: Saskatchewan
Posts: 22,570
Thanks: 1,161
Thanked 4,293 Times in 3,961 Posts
dd is pretty simple. Be sure to unmount anything on that disk before doing this:



Code:
dd if=/dev/zero of=/path/to/device bs=65536

the bs=65536 is optional, just makes it a bit more efficient by writing more at once.

dd will also work on partitions.

What to do with the disk after is less simple, since the filesystem and even the boot sector therein will be annihilated along with the files.

If you want a less drastic solution than dd-ing and reformatting, you could take a look at the shred command.
Sponsored Links
    #3  
Old Unix and Linux 11-26-2010   -   Original Discussion by rainbow_bean
bakunin's Unix or Linux Image
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 12 January 2018, 3:50 PM EST
Location: In the leftmost byte of /dev/kmem
Posts: 5,672
Thanks: 112
Thanked 1,628 Times in 1,194 Posts
Just to expand on what Corona688 has already said: i once read that some (military) paranoids don't stop here but erase disks several times (IIRC 7 times) with different hex values to make sure the overwritten bits can't be restored by some obscure means. If you want to do this prepare a stream with "0xFF"s quite like the "0x00"s from "/dev/zero" and use these two streams alternatingly to write the disk several times.

How often you do that is determined by your own level of paranoia. ;-))

I hope this helps.

bakunin
    #4  
Old Unix and Linux 11-26-2010   -   Original Discussion by rainbow_bean
rbatte1's Unix or Linux Image
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 12 January 2018, 9:58 AM EST
Location: Lancashire, UK
Posts: 3,435
Thanks: 1,491
Thanked 671 Times in 604 Posts
That's not paranoid at all. We have a policy that all retired media, working or not has to be shredded. We store them up and on request a specialist company turn up with a van and shredder. The maximum permitted size of the pieces is half a centimetre square. Each item has it's serial number confirmed before destruction.

It you are going to reuse the disk elsewhere, just a simple delete will be fine if you trust yourself not to go fishing in future. Plug it in to the next server and format it ready for use. Adding it into a volume group, raid set or whatever will splat over the VTOC information anyway and then each filesystem you build will create new superblocks anyway.


If you want the info on the shredder company let me know.



Robin
Sponsored Links
    #5  
Old Unix and Linux 11-26-2010   -   Original Discussion by rainbow_bean
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 12 January 2018, 4:20 PM EST
Location: Saskatchewan
Posts: 22,570
Thanks: 1,161
Thanked 4,293 Times in 3,961 Posts
Shredding perfectly good disks is a waste of hardware and probably a warranty violation. Linux I vaguely remember a warranty disagreement between Dell and the US military... They could hardly return the machines intact after they'd used them. They came to a rather Pyrrhic compromise: Dell got the drives back, but didn't get their platters!

It of course depends on your security standards but a simple dd if=/dev/zero of=/dev/disk will wreck the data badly enough that you'd need to hire cleanroom spacesuit people and their special machine to have any hope of retrieving it. With 7 overwrites, not even that.

The shred utility I mentioned earlier does that kind of destructive overwrite at the file level, on filesystems that support it, letting you securely delete a file without needing to reformat. Of course that's no guarantee there's nothing unwanted in unlinked sectors somewhere.

Last edited by Corona688; 11-27-2010 at 02:09 AM.. Reason: /dev/zero, not /dev/null
Sponsored Links
    #6  
Old Unix and Linux 11-26-2010   -   Original Discussion by rainbow_bean
fpmurphy's Unix or Linux Image
fpmurphy fpmurphy is offline
Registered User
 
Join Date: Dec 2003
Last Activity: 12 June 2016, 11:03 PM EDT
Location: /dev/ph
Posts: 4,996
Thanks: 73
Thanked 475 Times in 437 Posts
According to the 2006 NIST Guidelines for Media Sanitization, only one wipe of a disk using dd or dcfldd is necessary. See http://csrc.nist.gov/publications/ni...00-88_rev1.pdf.
Sponsored Links
    #7  
Old Unix and Linux 11-27-2010   -   Original Discussion by rainbow_bean
frank_rizzo's Unix or Linux Image
frank_rizzo frank_rizzo is offline Forum Advisor  
Resident BOFH
 
Join Date: Dec 2007
Last Activity: 28 July 2016, 2:18 PM EDT
Posts: 1,152
Thanks: 4
Thanked 92 Times in 89 Posts
hopefully these are local disks(SCSI/SSA). if it is SAN - it is still good to wipe the disks but you cannot truly know where the data is behind the scenes. you can also use the diag erase disk procedure.
Sponsored Links
Closed


Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to erase tape data in unix V4.0 D? akz UNIX for Advanced & Expert Users 5 10-07-2010 09:41 AM
Erase AIX rootvg system disk kobi gabai AIX 7 07-13-2010 05:20 PM
Erase hard disk sumathi.k AIX 3 11-10-2009 06:50 AM
Erase hard disk data kenloong AIX 8 06-17-2008 03:11 PM



All times are GMT -4. The time now is 09:36 AM.