How to add an extra partition
This How To explains how to resize your MacOS HFS+ partition, create and format a new partition on the freed space, and use this partition as /usr.
I started on Linux with LinuxPPC 2000 Q4, and I'm still very glad I choose that distribution. But the suggested disk space was really a bit minimal, and as a result I was stuck with a / of 800M and a /home of 400M. Meanwhile I upgraded to Mandrake 9.1, and I really had to squeeze it in.
So I decided to add another 1Gb by resizing the MacOS partition. Here's how I did that.
1. Defragment the MacOS HFS+ partition.
This is essential if you have been using MacOS for some time, otherwise there's no way to resize it without loss of data. I used a trial version of Norton Utilities 6.0.2, a free download at the time (2001), and it still works (provided you keep the archive and install it from scratch every time you need it ;-) . The problem is that you can't resize the partition on which your active System Folder resides. The software tells you to boot from the Norton Utilities Disk, but no need for that (at least in my case).
- 1.1 I assume you have an exchange partition, a (small) HFS partition you use to exchange data between MacOS and Linux. Alternatively, a HFS-formatted ZIP disk or CompactFlash card will do fine.
- 1.2 Install Norton Utilities on the exchange partition.
- 1.3 Boot from any bootable MacOS CD (press C on reboot). I use the FWB Hard Disk Toolkit-PE CD that came with my LinuxPPC distro. I guess the original MacOS Install CD should do fine as well.
- 1.4 Start Norton Speed Disk, choose "2 for resizing" and defragment.
-
2. Resize the MacOS HFS+ partition.
With the aforementioned FWB Hard Disk Toolkit, it's a breeze. Mandrake's DiskDrake should be able to do it as well, but I haven't tried that. But before you do this, make sure you have jotted down your original partition table somewhere.The easiest way to get it is (under Linux):
pdisk -l /dev/hda
My disk is called hda, it could be sda, sdb, hdb or whatever, but I'll use hda throughout this howto. My partition table looks like this:
/dev/hda5 MacOS
/dev/hda6 swap
/dev/hda7 bootstrap
/dev/hda8 /exchange
/dev/hda9 /
/dev/hda10 /home -
3. Adjust /etc/fstab
Resizing the partition causes all higher partition numbers to shift one up. The immediate result is that, on reboot, OF boot menu is gone! No worries, though:- 3.1 Boot from a Linux CD The LinuxPPC 2000 Q4 is still my favourite, because it boots without any trouble into a graphical installer.
- 3.2 Get a root prompt. 13 my case, this means opening an xterm. Alternatively, switch to a console. With Mandrake, you get a terminal by choosing the "rescue" image.
- 3.3 Mount the / partition.
mount -t ext2 /dev/hda10 /mnt/install
Your partition number and mount point might be different (for Mandrake it's /mnt/disk). Check with
ls /mnt.
- 3.4 Edit /etc/fstab.
Just add 1 to all partition numbers.
- 3.5 Unmount the / partition.
umount /dev/hda10
- 3.6 Reboot from the CD.
Strictly speaking not necessary, but I didn't take any chances, and furthermore, I wanted a "proper" system ASAP.
-
4. Change OF boot script (/etc/yaboot.conf)
- 4.1 I assume you managed to boot from the Linux Install CD.
LinuxPPC actually boots into your installed system, whatever that may be (Mandrake, YDL,...). I get some errors because I boot using a 2.2.18 kernel and the initscripts are for 2.4.19, but nothing severe. For Mandrake you'll have to boot the rescue image once more.
- 4.2 Edit /etc/yaboot.conf
Again, add 1 to all partition numbers. That's everything which looks either like hd:7 or /dev/hda9.
- 4.3 Run ybin
/sbin/ybin -v
- 4.4 That's it, unless your system does not support nvsetenv.
In that case (and you'll know because your system doesn't boot :-), boot into OF (Option-Command-O-F) and type
setenv boot hd:8,\\:tbxi
- 4.1 I assume you managed to boot from the Linux Install CD.
-
5. Create the new partition
I used Mandrake's DiskDrake for this, and it did a good job. On LinuxPPC 2000, you could use Perldisk. The alternative is either using a MacOS tool like FWB's, or using pdisk (Note: fdisk and cfdisk don't work, because they expect a DOS style partition table), and then mke2fs. -
6. Use new partition as /usr
- 6.1 Change to runlevel 3.
Because, a.o., X is on /usr. Switch to a console (Ctrl-ALt-F1) and do
init 3.
- 6.2 Mount the new partition.
I mounted on /opt because I have nothing there.
The corresponding line in /etc/fstab looked like this:
/dev/hda6 /opt ext2 defaults 1 2
So I just did:
mount /opt
- 6.3 Copy your current /usr to the new partition.
cp -a /usr /opt
- 6.4 Remove the contents of /usr.
But don't remove /usr itself, you need it as mount point.
cd /usr
rm -Rf * - 6.5 Change /etc/fstab
- 6.6 Reboot
/dev/hda6 /usr ext2 defaults 1 2
- 6.1 Change to runlevel 3.

