Cleaning house (hardware edition)

In: Uncategorized

5 Jul 2010

I’m on a simplification kick, and I’ve been dramatically reducing the clutter in my life and enjoying the results.

I recently noticed a good deal on a drive at Microcenter and thought “Why keep 5 external drives (1.3 TB total, 5 usb cables, 5 power cords) when a single drive (1.5 TB, 1 usb cable, 1 power cord) will do?”

So began the long process of consolidating, organizing, and erasing years worth of files, and if you’re doing the same, I have a few tips to share.

After consolidating everything to one disk, I wanted to find duplicate files that may have proliferated over the years. Fortunately, there’s a little utility called fdupes that does the trick nicely. On a Windows system, you can use it through cygwin.

fdupes -r /cygdrive/VOLUME_HERE

The first pass was preliminary to see how bad it was. I found 100s of GBs worth of data that I had forgotten about. There were also several .svn directories cluttering up the results. To remove that useless (for a backup) metadata, I removed it with

IFS=$(echo -en "\n\b")
find -regex ".svn" -delete

The first line sets the input file separator to a newline character (as opposed to the space) so the results of the find in the next statement works as expected. Now it will treat filenames with spaces as a proper path.

Now I could recursively, forcibly delete all the duplicates:

fdupes -rFd /cygdrive/VOLUME_HERE

I also wanted to remove all those Thumbs.db files that Windows loves to create as well as all the empty files, (now) empty directories, and old files

find -iregex ".*(Thumbs\.db|\.tmp|\.old|\.bak|\.dmp)$" -delete
find -size 0 -type f -delete
find -type d -empty -delete

Note: You may want to run these commands without the delete option first as a sanity check.

Now prep the old drives for donation …

Considering that you may have very sensitive data (e.g. passwords, bank/credit card statements, etc.) on your old drives, be sure to clean the drives before you donate them.

I simply formatted each and then used the windows built in cipher utility to clean each drive after copying over the contents.

cipher /w:VOLUME_HERE:

This wipes all the empty space on a disk with a 3 pass system – writing all 0’s, writing all 1’s, and then writing random data. In all that’s 4 passes (including the original format).

I could go on to discuss encryption of your data on your new drive and offsite backup, but that’ll have to wait for another day …