LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-03-2010, 02:19 PM   #1
PeterJD
LQ Newbie
 
Registered: Dec 2009
Posts: 8

Rep: Reputation: 0
Simple, detailed instructions to wipe free space please.


Can someone please give me simple detailed instructions on how to wipe the free space on my hard drive. I have a Ubuntu/WXP dual install. It is very easy to do this in Windows as there are several free software tools to do it. Is there anything like this in Ubuntu?

Best, PeterJD
 
Old 05-03-2010, 02:24 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
When you say "free space", it could mean space that is not partitioned, or it could mean free space within a filesystem.

The standard tool for wiping a partition or an entire disk is dd. It can also be used to wipe unpartitioned space.

I am not aware of a way to wipe unused space within a file system. There is something called "shred" which works with individual files, but I have never used it.
 
1 members found this post helpful.
Old 05-03-2010, 02:24 PM   #3
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Could you explain what you are trying to do a little better? I am not sure what you mean by "wipe free space". Do you mean zeroing out unused parts of the disk?
 
Old 05-03-2010, 02:39 PM   #4
PeterJD
LQ Newbie
 
Registered: Dec 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Thank you. What I am interested in wiping is files which I have "deleted" and browser history which I have "deleted".

PeterD
 
Old 05-03-2010, 02:46 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
If you delete a file, then there is no longer a connection to it, and something like shred is not going to work. (As far as the filesystem is concerned, the file no longer exists.)

Even if you delete in a GUI, and then restore from the trash, there is no guarantee that the file will be in the same place on the physical drive.

I'm out of ideas --for now, at least
 
Old 05-03-2010, 02:54 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
This is strictly a hunch....not advice

If you have a partition on which you have deleted some files which you now need to shred, I think the best solution **might** be this:

1. Using the filessytem, copy the entire contents to some other partition or disk. (be sure to include hidden files)
2. Wipe the original partition (using something like dd) and re-format it.
3. Copy the contents back

Depending on your partition setup, it could be just as easy to wipe the whole disk and re-install.
 
Old 05-03-2010, 03:46 PM   #7
Weird0ne
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware / Arch
Posts: 10

Rep: Reputation: 2
I think the easiest way to accomplish what you're trying to do is to write over all the free blocks including data that is still on the drive even there is no link to it. Shred does this at the time the deletion occurs (I belive the default is 25x). To do this for an entire drive, you would use dd to fill the drive with random data, and then re-write over it with 0's.

ex.
dd if=/dev/urandom of=blank.img
rm blank.img
dd if=/dev/zero of=blank.img
rm blank.img

This will use the urandom device for data and write to a file (overwriting any block that currently dont have "files" linked to them). Then remove the file once the drive is out of space. Then using the zero device to fill it with 0's.

** Be careful with this. Read the manual on dd first. A typo can erase everything on your system. And if you have everything on a single partition this can lead to a system hang as you will have no space left on your device for system processes. **

Last edited by Weird0ne; 05-03-2010 at 03:50 PM. Reason: Caution
 
1 members found this post helpful.
Old 05-03-2010, 04:18 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
I think WeirdOne has it.
 
Old 05-04-2010, 01:01 AM   #9
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 675

Rep: Reputation: 136Reputation: 136
Quote:
Originally Posted by pixellany View Post
When you say "free space", it could mean space that is not partitioned, or it could mean free space within a filesystem.

The standard tool for wiping a partition or an entire disk is dd. It can also be used to wipe unpartitioned space.

I am not aware of a way to wipe unused space within a file system. There is something called "shred" which works with individual files, but I have never used it.
Wipping free space within filesystem once was easy:
Code:
as root:
dd if=/dev/zero of=/some/none_exist_file_inside_filesystem
and then
rm /some/none_exist_file_inside_filesystem
"As root" needed to fill with zeros 5% of filesystem size reserved for
root usage only

Of course on filesystems with journal it may be not enough
 
1 members found this post helpful.
Old 05-04-2010, 09:36 AM   #10
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: *buntu, Vector
Posts: 499

Rep: Reputation: 102Reputation: 102
Weird One's should do it. If you want to make sure you don't crash your system, don't run it as root, but if you want to be more certain the data is deleted then be root.

Bear in mind full disks play havoc with some software. Notably, Thunderbird goes badly haywire.
 
Old 05-04-2010, 02:43 PM   #11
PeterJD
LQ Newbie
 
Registered: Dec 2009
Posts: 8

Original Poster
Rep: Reputation: 0
So can I just use the dd command as described by Valery Reznic? And how long will it take? Otherwise it just seems too complicated. I'm not really paranoid.

PeterJD
 
Old 05-04-2010, 02:54 PM   #12
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I do not understand what Valery suggests---it look like he is writing zeros to a file. If the file has already been deleted, then I do not see how it could do anything.

Back to basics:
Within a filesystem you can copy, delete, and remove file using the well-known tools. In this case, deletion and moving do not erase the actual bit patterns---they only break the connections and allow the space to be used for something else.

By contrast, a tool like dd has the ability to operate on the raw device, regardless of whether there is a filesystem. Using dd to wipe the space occupied by a deleted file is certainly possible, but only if you know where the actual data WAS. (Again, I don't see how Valery's method would do this.)

dd, specifically, can read and write using EITHER the raw device name OR a file name (Not surprising, considering the long-standing *n(u|i)x principle that "everything is a file")---So:
to write to /dev/sda2 (a partition), the partition needs to exist

to write to /home/myjunk/filename, the FILE needs to exist
 
Old 05-04-2010, 02:57 PM   #13
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: *buntu, Vector
Posts: 499

Rep: Reputation: 102Reputation: 102
WeirdOne and Valery's method works by creating a new file, filling the entire free space, and that is all zeroes. Thus, the space freed by any previously deleted files will be used by the new file, and hence zeroed out. You then delete the big file full of zeroes to recover your space.

And dd can create a file that does not exist.
 
Old 05-05-2010, 07:57 AM   #14
PeterJD
LQ Newbie
 
Registered: Dec 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Sorry, I just don't understand how to apply most of what you have said. I am a complete newbie to Linux. All my computer work has been in Windows.

What I want are simple instructions like: Do this, do that, so and so will happen, then do that, etc. until the desired result is achieved. If these cannot be provided I just won't bother and will simply re-install WXP, wipe the free space (which is easy in Windows), abandon Ubuntu and carry on happily using Windows.

PeterJD
 
Old 05-05-2010, 08:04 AM   #15
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
I just don't understand what you want to do.

Quote:
Originally Posted by PeterJD View Post
Thank you. What I am interested in wiping is files which I have "deleted" and browser history which I have "deleted".

PeterD
So you want to empty your trash so it doesn't take up space?

Or do you mean you want to actually wipe the bit patterns off your drive for privacy's sake?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A faster way to wipe free space? taylorkh Linux - Software 13 04-19-2009 11:21 AM
Need Detailed Instructions On How To Customise Fbpanel Mark7 Linux - Desktop 0 02-06-2008 02:49 PM
detailed instructions for getting HPg85xi to work through USB lazarys Linux - Newbie 5 05-05-2006 04:03 PM
Complete Linux Newbie, Need Detailed Instructions For Problems srparke Linspire/Freespire 8 03-19-2005 02:08 AM
wipe free space with Linux? bigrobot Linux - Software 2 02-19-2005 05:08 AM


All times are GMT -5. The time now is 11:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration