Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Security and Privacy
FedoraForum Search

Forgot Password? Join Us!

Security and Privacy Sadly, malware, spyware, hackers and privacy threats abound in today's world. Let's be paranoid and secure our penguins, and slam the doors on privacy exploits.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 3rd January 2013, 10:34 AM
nostoc Offline
Registered User
 
Join Date: Dec 2012
Location: Omnipresent
Posts: 3
linuxchrome
How to erase unused disk space?

Hi!

Rather simple question which I have failed to find an answer to through googling:

How does one erase/shred unused disk space on fedora 17?

Thanks in advance.
Reply With Quote
  #2  
Old 3rd January 2013, 11:08 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,092
linuxfirefox
Re: How to erase unused disk space?

I assume you are talking about the available data space in a filesystem...

The simple answer is "you don't".

The problem is that it won't stay that way. This goes back to the subject of "object reuse".

The only way to do that even slightly efficiently is to do it when the block is released - Unfortunately, that will cause a major impact on performance as at a minimum it will add 5-10ms per block.

That is why you have to purge the file before you delete it. At that time you get to decide which blocks are to be purged.

Multiple overwrites is a slow process, and can't be optimized very well as doing so could leave the block "contaminated" until the purge is complete. It also adds a problem to recovery, as a purge has to be restartable (crash events) after reboot. You can't just replay a journal, as you have to purge the last released block, plus any others that haven't been purged.

The result is if you delete a large file (such as a video), you would take about 3 times as long as the time it took to copy the video in the first place. During that time, little other I/O would take place.

If you want to purge anyway, backup the data you want to keep, dismount the file system, and purge the partition. Then recreate the filesystem, mount and restore.

Last edited by jpollard; 3rd January 2013 at 11:14 AM.
Reply With Quote
  #3  
Old 3rd January 2013, 01:23 PM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,298
linuxfirefox
Re: How to erase unused disk space?

Quote:
Originally Posted by jpollard View Post
I assume you are talking about the available data space in a filesystem...

The simple answer is "you don't".
Sheesh - children of a lesser dog
Gotta love JP's "Can't do" attitude.



sudo yum -y install ucommon-bin
man zerofill
...
zerofill /mount/point/path


This uses a simple, tho' slow technique of creating a huge file (or files) that contain zeroes (or random data w/ the '-r' option), sync these files to disk, and then delete the files. The file(s) has thus allocated and filled all deallocated blocks.

You need to be root to get the reserved blocks.
If you point zerofill at a device - it will delete any filesystem on that device - be careful.







Quote:
The problem is that it won't stay that way. This goes back to the subject of "object reuse".
OP never said he wanted a 'stay that way' feature.
He may just want to 'shred' currently de-allocated blocks.


Quote:
The only way to do that even slightly efficiently is to do it when the block is released - Unfortunately, that will cause a major impact on performance as at a minimum it will add 5-10ms per block.
I've worked-on/developed systems for security models use where this was required. The performance hit would be nearly unnoticeable on a typical soho user system in normal use, unless you are deleting a lot of file-space..

Quote:
That is why you have to purge the file before you delete it. At that time you get to decide which blocks are to be purged.
A/ No you don't. B/ No you can't, generally.

First it's hardware dependent. On SSDs for example you are allocated a new physical 'block' on every write. There is no way to 'purge' within the file system as a method to scrub physical data on the drive. There is often a secure erase at the hw level.

Next, there is no guarantee for an arbitrary file system that the block allocation is static when you overwrite, and it certainly IS NOT for btrfs and some others. Modern filesystems have features like COW and block de-duplication, snap-shotting, so writing zeroes to an allocated files block may simple allocate a different block for the zero'ing.

RAID-like features, checksums and COW, block de-duplication means that a block of file data does not directly correspond to a unique physical block contents. You'd better get your head out of the 1980s, it's not your grand-dads filesystem.

---------- Post added at 09:23 AM ---------- Previous post was at 09:06 AM ----------

Hmm - actually 'scrub' in the package of the same name has similar options as zerofill.
scrurb -X ...
Uses DoD 5220.22-M, scrubbing method.
Looks to be better supported than zerofill.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 3rd January 2013 at 01:25 PM.
Reply With Quote
  #4  
Old 3rd January 2013, 01:43 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,092
linuxfirefox
Re: How to erase unused disk space?

And what I said is still true.

You don't scrub the free space.

You allocate it then scrub the file.

then delete it.

And it isn't guaranteed even then.

You are right about the SSDs, I should have included them.

And the only sure way for the others is to backup what you want, dismount then scrub the partition/disk.

Last edited by jpollard; 3rd January 2013 at 01:45 PM.
Reply With Quote
Reply

Tags
disk, erase, space, unused

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] unused LVM space vinicius Hardware & Laptops 0 11th November 2012 01:39 AM
unused space in lvm to ntfs Jalovcan Using Fedora 0 5th January 2012 09:59 AM
Create a new partition in unused LVM space joe.pelayo Using Fedora 4 15th June 2011 02:28 PM
Need to claim unused disk space jaysun834 Using Fedora 4 24th January 2010 10:00 PM
How to make use of unused space ... the_tragic_hip Using Fedora 10 17th June 2005 08:40 PM


Current GMT-time: 07:43 (Sunday, 19-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat