Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Doc69

macrumors 6502a
Original poster
Dec 21, 2005
653
90
I need to completely wipe a drive. In the past, I've done it on a Windows machine, using the command prompt command 'Clean'. This made the 'Initialize' window pop up once I attached it to a Mac. Is there a way to do the same 'cleaning' from the Mac, perhaps using Terminal commands?

I don't need to erase drive for security, I just want to wipe all MBRs, EFI partitions etc, and make the drive completely empty.
 
I think you can do this with the "Parted Magic" application.

It can be downloaded and burned to a bootable CD (of course, you'll need a DVD/CD drive).

It -might- be installable to a USB flash drive, from which you could boot, as well...
 
Use diskutil in a Terminal window. Just make sure you get the correct deviceID, from diskutil list. It will take the form of /dev/disk3, for example.

#!/bin/sh
# We need:
# 1. deviceID - (diskutil list), something like /dev/disk9
# 2. #Parts - number of partitions
# 3. PartType - GPT or MBR
# 4. Triplet - one triplet for each partition - Format VolName Size
# Formats:
# ExFAT ExFAT
# Free Space Free Space
# (or) free
# MS-DOS MS-DOS (FAT)
# MS-DOS FAT12 MS-DOS (FAT12)
# MS-DOS FAT16 MS-DOS (FAT16)
# MS-DOS FAT32 MS-DOS (FAT32)
# (or) fat32
# HFS+ Mac OS Extended
# Case-sensitive HFS+ Mac OS Extended (Case-sensitive)
# (or) hfsx
# Case-sensitive Journaled HFS+ Mac OS Extended (Case-sensitive, Journaled)
# (or) jhfsx
# Journaled HFS+ Mac OS Extended (Journaled)
# (or) jhfs+ Recommended!
#
# VolName = whatever
#
# Size = #B, #KB, #MB, #GB, #TB, #% (50%, 100%), R (remainder)
#
# Command looks like this:
# /usr/bin/sudo /usr/sbin/diskutil partitionDisk deviceID #Part PartType Format VolName 100%
 
Last edited:
If I need to start from scratch I'll either use a CD/USB with Gparted (linux partitioning utility live system), boot from that, then erase everything, or boot from an external copy of OS X, wipe it, and then use a disk editor to remove any remnants of the old partition scheme.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.