Warning: This procedure involves changing your partition map. If possible, backup data first, in case something goes horribly wrong.
Installing the Required Software
Changing the partition type requires a program called pdisk in LinuxPPC and YDL and mac-fdisk in Debian (they are almost exactly the same, therefore wherever I say pdisk, Debian users should replace it with mac-fdisk).
Alternatively, you can use pdisk for Mac OS, however that requires an extra step not covered here.
Yellow Dog Linux, LinuxPPC:
mount /mnt/cdrom
cd /mnt/cdrom/RedHat/RPMS/
rpm -Uvh pdisk*.ppc.rpm
Debian:
apt-get install mac-fdisk
Changing the partition map using pdisk
You can start pdisk or mac-fdisk by: pdisk devicename or mac-fdisk devicename
Note: Replace devicename with the device who's partition you want to edit. For example, /dev/hda or /dev/sda.
Type in p. This will give you a partition map printout similar to:
cowsandcorn:~# mac-fdisk /dev/hda
/dev/hda
Command (? for help): p
/dev/hda
# type name length base ( size ) system
/dev/hda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map
/dev/hda2 Apple_Driver_ATA Macintosh 54 @ 64 ( 27.0k) Unknown
/dev/hda3 Apple_Driver_ATA Macintosh 74 @ 118 ( 37.0k) Unknown
/dev/hda4 Apple_Patches Patch Partition 512 @ 192 (256.0k) Unknown
/dev/hda5 Apple_UNIX_SVR2 root 1638400 @ 704 (800.0M) Linux native
/dev/hda6 Apple_UNIX_SVR2 swap 131072 @ 1639104 ( 64.0M) Linux swap
/dev/hda7 Apple_UNIX_SVR2 nothing 333824 @ 1770176 (163.0M) Linux native
/dev/hda8 Apple_HFS untitled 4 2097152 @ 2104000 ( 1.0G) HFS
Block size=512, Number of Blocks=4201343
DeviceType=0x0, DeviceId=0x0
Drivers-
1: @ 64 for 21, type=0x701
2: @ 118 for 33, type=0xf8ff
Command (? for help):
For this example, I have decided I want only half of partiton nothing (/dev/hda7) to be of Linux format, and half of it to become to and HFS partition.
Warning: Any data that you have on the partition you will cut in half is going to be destroyed!! Make sure if you have anything you want there is backed up. Type in q to quit pdisk if neccessary.
Type in d. You will be asked for the number of the partition you want to delete. In this case, I want to delete partition 7.
Print the partition map again by typing p.
/dev/hda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/hda2 Apple_Driver_ATA Macintosh 54 @ 64 ( 27.0k) Unknown /dev/hda3 Apple_Driver_ATA Macintosh 74 @ 118 ( 37.0k) Unknown /dev/hda4 Apple_Patches Patch Partition 512 @ 192 (256.0k) Unknown /dev/hda5 Apple_UNIX_SVR2 root 1638400 @ 704 (800.0M) Linux native /dev/hda6 Apple_UNIX_SVR2 swap 131072 @ 1639104 ( 64.0M) Linux swap /dev/hda7 Apple_Free Extra 333824 @ 1770176 (163.0M) Free space /dev/hda8 Apple_HFS untitled 4 2097152 @ 2104000 ( 1.0G) HFS
See, we have now removed that partition from the partition map, it now appears as type "Apple_Free".
Now we have to create the new partitions. Type C (a uppercase C!) to do that.
You will be asked for the first block. In this case it's 333824 (the number before the @ indicates this).
Next you will be prompted for length in blocks.
You can tell it in one of three formats: 885088 (in bytes), 75M (in MB), or in 30G (in Gigabytes for those lucky enough to be able to do that ;). Only whole numbers are allowed, no fractions or decimals. So if you want a 1.5 GB partition, you need to use 1536M instead.
Obviously, this size must be within the size of the free partition, otherwise pdisk will just yell back at you with an error.
Next it will ask you for a partition type. If you want it to be readable by Mac OS, make it Apple_HFS, if you don't want it readable by Mac OS (but Linux) make it Apple_UNIX_SVR2.
When you are done, print the partition map again, to ensure its' to your sastifcation.
Type in "w". This will write the partition map. It will give you one last chance to stop it before it happens. Then type in "q" to quit.
Formatting
Reboot. You must reboot for Mac OS or Linux to reread the partition map.
If you changed the type to Apple_HFS, Mac OS will see it the next time you reboot, and note it's a unknown format. It will then ask you if you would like to format it. You should choose yes, then the type to format it (HFS or HFS+).
If you want to format it in HFS Standard format, you can also use hformat /dev/hda5 (replace with your actual partition you want to reformat -- it won't prompt you to confirm -- be careful!)


