Cleaning Up Disk Space on Ubuntu Using BleachBit, and Wiping Free Space With DD

zen_classic_logo_0.png

When I first started using Ubuntu, I began looking around for cleanup utilities similar to Ccleaner.  I was directed to Ubuntu Tweak, which has an easy to use Computer Janitor function, but I noticed that it did not have a disk wipe function.  It was not very high on my list of priorities, so I let it go for a while.

Here and there, I saw references to BleachBit, so I decided I should give it a whirl.  It basically does a lot more than just wiping the drive, and it has a lot of options.  It is much more like Ccleaner than Computer Janitor.  Most of the functions I tried worked pretty well, it seems.  Of course, you have to be selective in what you choose, or it might ruin your day.

Ironically, the one function that did not work for me in my test run was the wipe disk function.  It was confusing, and I didn’t know for sure what it was wiping when.  It made three statements about creating a file, and then it got down to “1 minute remaining” and hung.  I hate it when programs do that, and even more so when I don’t even know for sure what it is doing where!  After about 7 – 8 hours, I killed it because I needed to reboot for other reasons.

So, it looks to me like BleachBit is OK for casual use but not for securely wiping any free space on a drive (and if you want to blow away an entire drive, my favorite utility is Derek’s Boot And Nuke).  At any rate, if you are really serious about wiping your drive, I suggest using the dd command (following liberally adapted from SuperUser.com article “How to wipe free disk space in Linux?“):

#!/bin/sh
# Run this on the partition you wish to wipe free space on
echo "zeroing small portions to handle zero space easier"
echo "Creating zero.small.file"
dd if=/dev/zero of=zero.small.file.$II bs=1024 count=204800
echo "Shredding zero.small.file"
shred -v -z zero.small.file

echo “zeroing remainder”
dd if=/dev/zero of=zero.file bs=1024
#
# Be sure written to disk
echo “Sync’ing filesystem”
sync
echo “Removing small file”
rm -v zero.small.file
echo “Shredding remainder”
shred -v -z zero.file
echo “Removing remainder”
rm -v zero.file

This still takes a while, but at least I know what it is doing.

There are two files that fill up the hard drive, get shredded and then get removed, which will make it extremely difficult, but perhaps not impossible, to recover data that was overwritten.  One file is quite small, and its function is to be a placeholder while working on the larger file.  Since you are filling up a disk drive, extremely bad things can happen if left in that state for long, so working on a smaller file first, then creating the larger file allows you to then remove the smaller file and have at least some disk space before working on the larger one.

 

 

 

Website Apps Website Monitoring