Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-20-2009, 02:19 PM
|
#1
|
|
LQ Newbie
Registered: Apr 2009
Posts: 1
Rep:
|
Linux command to zero out deleted data from hard drive
I am looking for the Linux command (or commands) that zeros any sectors on the hard drive that contain deleted data. Pretty much the same as what "secure delete" apps do for Windows, but without all of the hashing and rewriting. I am trying to make compression on my backup images of Vmware virtual machines more efficient and I read that an easy way to do that is to zero deleted sectors. Does anyone know how to do this?
|
|
|
|
04-20-2009, 02:38 PM
|
#3
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
I'm a little fuzzy on what you want to do.
First, "deleted data" and "deleted sectors" are not the same thing.
"Secure delete" I assume refers to erasing a file in such a way that it could never be recovered. To do this on an individual file presumably involves replacing the file data with random data and then all zeroes---just as is done when "wiping" a whole drive or partition.
|
|
|
|
04-20-2009, 03:56 PM
|
#4
|
|
Senior Member
Registered: Sep 2003
Posts: 3,171
Rep: 
|
If you just want to zero things out in order to aid compression, it is easy.
dd if=/dev/zero of=/my/output/file/on/the/partition/to/be/zeroed
This command will run until the hard drive is full, then it will bomb. When it bombs all you do is delete the file you just wrote, and you have accomplished what you set out to accomplish.
|
|
|
|
04-20-2009, 06:25 PM
|
#5
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
Quote:
Originally Posted by jiml8
If you just want to zero things out in order to aid compression, it is easy.
dd if=/dev/zero of=/my/output/file/on/the/partition/to/be/zeroed
This command will run until the hard drive is full, then it will bomb. When it bombs all you do is delete the file you just wrote, and you have accomplished what you set out to accomplish.
|
That looks like a REALLY dangerous command. If it works the way you say, then the user might expect to zero out a file, and wind up zeroing much more.
|
|
|
|
04-20-2009, 06:59 PM
|
#6
|
|
Senior Member
Registered: Sep 2003
Posts: 3,171
Rep: 
|
It is no more dangerous than any other command that creates a file on a filesystem.
|
|
|
|
04-20-2009, 09:21 PM
|
#7
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
Quote:
Originally Posted by jiml8
It is no more dangerous than any other command that creates a file on a filesystem.
|
I disagree.... Again, if it works as you describe, it does a lot more than just create a file.
The original question (I think) is how to do secure erase of one or more specific files. Your command goes way beyond that.
Have you actually tried it? Cna you post an example?
|
|
|
|
04-20-2009, 09:33 PM
|
#8
|
|
Senior Member
Registered: Sep 2003
Posts: 3,171
Rep: 
|
Quote:
Originally Posted by pixellany
I disagree.... Again, if it works as you describe, it does a lot more than just create a file.
The original question (I think) is how to do secure erase of one or more specific files. Your command goes way beyond that.
Have you actually tried it? Cna you post an example?
|
I do it periodically. Especially when I want to image and compress a partition.
It works exactly as I describe. It writes a zero filled file. Lacking any instructions on the size of the file, it writes until the partition is full. This has the effect of zero-filling all previously unused space on the partition. Then you delete the file, thus freeing all the space and leaving it zero filled.
And why, exactly, do you think it does anything other than that? Because it uses dd? dd writes with user permissions, just like every other command out there. If you try to write as root to /dev/sd-something, I am sure it would be totally destructive. Short of that, it works perfectly.
|
|
|
|
04-21-2009, 07:22 AM
|
#9
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
Sorry---I was being dense.
Quote:
|
And why, exactly, do you think it does anything other than that? Because it uses dd?
|
Probably...
|
|
|
|
04-21-2009, 07:46 AM
|
#10
|
|
Member
Registered: Dec 2008
Location: Cleveland Ohio
Distribution: CentOS
Posts: 184
Rep:
|
You could do cat /dev/zero > /filename till the hard drive fills also.
|
|
|
|
04-21-2009, 07:49 AM
|
#11
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
Quote:
Originally Posted by kentyler
You could do cat /dev/zero > /filename till the hard drive fills also.
|
That's exactly what jiml was talking about.....
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:37 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|