Mar 312012
 

Three operating systems, three file systems, three methods to zero out disk space.  Fortunately, they are all pretty simple. Doing this is a good idea right before creating a drive image for backup, as it makes compression more efficient.

OSX – HFS+ (Mac OSX Journaled)

  1. Open Disk Utility
  2. Click on the OSX partition
  3. Click Erase from the tabbar menu
  4. Click Erase free space… button
  5. Choose the Fastest option – this will fill the partition with zeros one time.

Windows 7 – FAT32, NTFS, exFAT

  1. Download SDelete from Microsoft Technet
  2. Copy sdelete.exe to C:\Windows\System32 (or any folder in your system PATH).
  3. Run SDelete from the command-line using:  
    sdelete -p 1 -z c:\

    (where ‘c’ is the target drive letter)

Ubuntu – ext3, ext4

  1. Install the secure-delete package: 
    sudo apt-get install secure-delete
  2. Use fdisk to find the correct drive partition:
    fdisk -l

     The drive in question will be something like /dev/sda or /dev/sdb.  Each partition is numbered, like /dev/sdb1 and /dev/sdb2

  3. Mount the drive partition (if it is not already):  
    sudo mount /dev/sdb1 /mnt/hdd1
  4. Run 
    sfill -Ilz /mnt/hdd1

    where ‘hdd1′ is the location of the mounted partition in the filesystem.

  One Response to “Erase (zero out) free disk space on OSX, Windows and Ubuntu”

  1. With Linux (Ubuntu or RedHat), the “sfill -Ilz” command doesn’t works fine with ext3, ext2.. and others file system formats. It’s likely that the space is increased rather than reduced.

    I have test this on 2 VMs with ext formats and different linux OS.

    Regards,
    Drk.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*