Format a Partition From HFS+ to UFS

isaac_ho

Web Designer
I want to format one of my partitions from HFS+ format to UFS, but I can't do it with OSX's Disk Utility, please help me! Thanks!:rolleyes:
 

Darkshadow

wandering shadow
Heh, went through this one a couple weeks ago on the MacFixit forums....here's what I finally figured out to do:

First you need to change the partition to a UFS partition. The only way I figured out how to do this is to use <b><font color="#0000ff">pdisk</font></b>. Unfortunately, I found out that OS X's pdisk won't allow you to edit the partition map on the startup disk, though LinuxPPC's does...dunno why they set it up this way. This means that if the partition you want to change to UFS is on the same drive as OS X, you're pretty much out of luck.

That said, here's how to change it via pdisk. Type <b><font color="#0000ff">pdisk</font></b> in the terminal (need to be root or use sudo!). At the first prompt, type <b><font color="#0000ff">e</font></b>. You'll be asked for the drive to edit, it's <b><font color="#ff0000">/dev/rdisk0</font></b> if it's the master drive, or <b><font color="#ff0000">/dev/rdisk1</font></b> for a slave drive (and 2 for another drive, 3 for another one, etc, etc). At the next prompt, type <b><font color="#0000ff">p</font></b> to print out the parition map. You'll need to locate the partition that you want to change to UFS, and write down its partition number, its <b><font color="#ff0000">length</font></b>, and its <b><font color="#ff0000">base</font></b> (you'll see these listed when you type <b><font color="#0000ff">p</font></b>). After you write these down, type <b><font color="#0000ff">d</font></b> at the prompt - it'll ask you which partition you want to delete. Put in the partition number you wrote down. Now you can create a UFS partition in the space the old one was in. Type <b><font color="#0000ff">C</font></b> (make sure to type it as a <b>capital c</b>!) at the prompt. It'll then ask you for the beginning block number - write down the number you copied from the <b><font color="#ff0000">base</font></b> field. Next it will ask you for the length in blocks - write down the number you copied from the <b><font color="#ff0000">length</font></b> field. Next it asks you to name the partition - write down whatever you want to (this names the partition in the partition map, <i>not</i> the Finder). And finally, it will ask you for the partition type - write down <b><font color="#ff0000">Apple_UFS</font></b> (exactly like that).

Now type <b><font color="#0000ff">p</font></b> at the prompt again to make sure that the partition looks exactly the same as it did before, with the exception that it now says Apple_UFS instead of Apple_HFS. If it does, type <b><font color="#0000ff">w</font></b> at the prompt. This actually writes the partition table. If you made a mistake, or wrote something down wrong, you can just type <b><font color="#0000ff">q</font></b> at the prompt to quit, and nothing will actually be changed. The only time any changes you do actually take effect is when you type <b><font color="#0000ff">w</font></b> at the prompt.

Ok, now your partition has been changed from HFS to UFS...but OS X still won't see it. <b><font color="#0000ff">pdisk</font></b> doesn't write down disk drivers for the partition, only changes the partition's type. I'd like to note that at this moment, after you've used pdisk but haven't yet done the next step, you can actually use pdisk to change the partition back to an HFS+ one <b>without losing any data that was on the partition</b>. Once you do the next step, all the data on the partition will be erased and there is no getting it back.

The next step, actually getting OS X to recognize the new UFS partition, is really simple. Type <b><font color="#0000ff">newfs -T ufs /dev/disk</font><font color="#ff0000">X</font><font color="#0000ff">s</font><font color="#ff0000">X</font></b> (where you replace the X's with the disk/partition number i.e. you want to do this to partition 10 on the 2nd (slave) hard drive, you'd type <b><font color="#0000ff">/dev/disk</font><font color="#ff0000">1</font><font color="#0000ff">s</font><font color="#ff0000">10</font></b>). You'll need to be root or use sudo to do this command as well. Note that this step <b>does</b> erase all the info off of the partition.

That's it. Reboot, and the UFS disk will show up in OS X.

If anyone wants to read the original post on MacFixIt, here ya go: <a href="http://www.macfixitforums.com/php/showflat.php?Cat=&Board=Forum35&Number=230910&page=4&view=collapsed&sb=5&o=186&part=">Can't see an OS9.1 formatted UFS partition</a>
 

Zeus

Registered
Hi,
just boot from install cd and then from the diskutility (it's in the first menu) choose your drive then the partition and put on the erase panel...

When you're there select the disk format (hfs or ufs) and click erase!


That's all!!

Bye
 

Darkshadow

wandering shadow
Err..he said Disk Utility wouldn't do it. That's why I went through all of that. ;)

Also, if a drive is less than 2 GB, Disk Utility won't "see" it. He didn't say what size it was, but if it's under that, then the stuff I posted is really the only way to change it.
 

Zeus

Registered
Probably he tried to format a drive without booting from the install CD.

for me it worked good!!
 
Top