Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Erasing a drive with a locked partition

I have a drive with a locked partition. I can unlock it no problem, but I would now like to erase the whole drive and repartition with only one partition before I pass the computer on to someone else. Does anyone know how to reset the drive to a single unlocked partition. Thanks very much.


All the best,


Tom

Posted on Nov 16, 2012 12:04 PM

Reply
14 replies

Nov 16, 2012 12:09 PM in response to Tom Wolsky

Tom,


You need to unlock the drive depending upon what the nature of the lock is. That aside here's how you repartition and erase the drive:


Drive Preparation


1. Open Disk Utility in your Utilities folder.


2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.


3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed.


4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.


5. Set the format type to Mac OS Extended (Journaled.) Click on the Security button, check the button for Zero Data and click on OK to return to the Erase window.


6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.


Steps 4-6 are optional but should be used on a drive that has never been formatted before, if the format type is not Mac OS Extended, if the partition scheme has been changed, or if a different operating system (not OS X) has been installed on the drive.

Nov 16, 2012 12:46 PM in response to Tom Wolsky

Tom,


What happens if you boot from an installer disc? How did you "lock" the drive? Do you know how to "unlock" it? Did you unlock it first? Is this your startup volume on the internal drive or is it an external drive?


If this is a startup drive and you are running Lion or Mountain Lion, and if you want to erase the drive, repartition, and reinstall Lion or Mountain Lion


Install or Reinstall Lion/Mountain Lion from Scratch


Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.


Boot to the Recovery HD:


Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.


Erase the hard drive:


1. Select Disk Utility from the main menu and click on the Continue button.


2. After DU loads select your startup volume (usually Macintosh HD) from the

left side list. Click on the Erase tab in the DU main window.


3. Set the format type to Mac OS Extended (Journaled.) Optionally, click on

the Security button and set the ZeroData option to one-pass. Click on

the Erase button and wait until the process has completed. Now select

the second partition, click on the Delete [-] button. Grab the sizing handle

in the lower right corner of the remaining volume and drag it to the bottom

of the rectangle. Click on the Apply button.


4. Quit DU and return to the main menu.


Reinstall Lion: Select Reinstall Lion/Mountain Lion and click on the Install button.


Note: You will need an active Internet connection. I suggest using Ethernet if possible

because it is three times faster than wireless.

Nov 16, 2012 12:57 PM in response to Kappy

Hi Kappy,


Thanks for taking the time to help.


I'm running Mountain Lion. I also tried with the computer in target disk mode.


I had to create a locked partition at one point in the computer's life. The partition is unlocked.


I did boot into the Recovery Partition. In Disk Utility if I select the whole drive, not either of the two partitions, I only have tabs on the right for First Aid and Partition. In the Partition tab you see what's in the image above.


Ethernet is regrettably not an option, as there's no Ethernet port.


Is there any way to erase the drive in Terminal?


Thanks again.


All the best,


Tom

Nov 16, 2012 2:03 PM in response to Tom Wolsky

Tom,


But did you try in DU to just select the "Locked" partition at the bottom then use the Delete [-] button to remove it?


You can use the Terminal by using diskutil:


df


This will list out all mounted drives. In the Filesystem column you will see devnames like /dev/disk3. The disk[3] is used in the following line, but substitute what is shown as the integer after the "disk" part.


diskutil eraseDisk JHFS+ Untitled disk[n]


Where disk[n] is the deviceID such as "disk3".


I hope this works for you. It should result in an empty disk containing one partition, HFS+ Journaled format and named "Untitled."

Nov 16, 2012 3:31 PM in response to Kappy

Some progress. Using Terminal I was able to erase the locked partition, but it was still locked. In Disk Utility I could now switch to erase and use Mac HFS+ Journaled. However a normal erase would not allow and always switched back to encrypted. If I was a deep erase, 7x wipe, it allowed me to erase the partition without the encrytion.


So far so good.


Now I can select the small parititon and use the - button, and select the partition popup to select 1 partition. The problem now is that the partition fails with the error: Can't unmount disk. If I try to erase the whole volume I get the same error message.


The next thing I think I'll do is to go back to target disk mode and see if I can wipe the drive from another machine.


Thanks again for your help Kappy.

Nov 16, 2012 3:37 PM in response to Tom Wolsky

Yes, progress indeed.


I suggest you use Disk Utility from your Mountain Lion system:


Drive Preparation and Installation for Mountain Lion


1. Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button. Select Disk Utility from the main menu and click on the Continue button.


2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area. If it does not say "Verified" then the drive is failing or has failed and will need replacing. SMART info will not be reported on external drives. Otherwise, click on the Partition tab in the DU main window.


3. See if you can't get the disk to unmount.


If you cannot unmount from above, then in the Terminal try:


sudo diskutil unmountDisk force disk[n]


This should let you format the disk using Disk Utility.

Nov 16, 2012 4:19 PM in response to Kappy

The SMART status is verified.


I cannot unmount the entire disk. When I run erase on the entire disk I get the can't unmount error, though the two partitions do unmount. I can also mount and unmount each of the partitions separately.


When I try


sudo diskutil unmountDisk force disk[n]


I get sudo: command not found


Should I not try the target disk mode route? I haven't done it yet as I still waiting for the other machine to be available.

Nov 16, 2012 7:27 PM in response to Tom Wolsky

Did you use the devname with a number for disk[n]. Remember you should use something like disk1.


Tom, I'm about at the end of my expertise here. If you cannot get everything to unmount then I don't know how to get DU to operate on the disk so you can repartition it.


Maybe this will work:


sudo diskutil mergePartitions JHFS+ not disk[a]s[b] disk[a]s[c]


disk[a]s[b] disk[a]s[c] are the partnames from df, for example, disk3s1 disk3s2.


You should perform this when booted from a different drive. For example, you can connect the two computers using a Firewire cable and booting the problem machine into Target Disk Mode.

Nov 16, 2012 11:51 PM in response to Kappy

Thanks for all your help Kappy. Once I got the encrypted part erased, I could unmount the whole disk and repartition it when the computer was in target disk mode.


I'm wondering if it wouldn't allow the partition and unmounting if the entire disk because the Recovery partition is on the disk, and it couldn't unmount itself.

Erasing a drive with a locked partition

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.