MAC-FDISK(8)
๐พ mac-fdisk(8) โ Apple Disk Partitioning Manual ๐พ
okay so hi bestie ๐ซถ welcome to the mac-fdisk page, straight out of the Apple Disk Partitioning Manual. this is the one that lives in section 8 of the manual, and it's about to be your new fave little partition gremlin.
โจ NAME โจ
mac-fdisk โ Apple partition table editor for Linux ๐
โจ SYNOPSIS โจ
mac-fdisk [ -h | --help ] [ -v | --version ] [ -l | --list device ... ]
mac-fdisk [ -r | --readonly ] device ...
โจ DESCRIPTION โจ
so mac-fdisk is a command line type program โ very terminal, very demure โ that partitions disks using the standard Apple disk partitioning scheme as described in "Inside Macintosh: Devices". no cap, that's the source. ๐
the device is usually one of these icons right here:
/dev/sda
/dev/sdb
/dev/sdc
/dev/sdd
/dev/sde
/dev/sdf
/dev/sdg
/dev/hda
/dev/hdb
quick vibe check on how that naming works ๐ โ /dev/sda is the first hard disk on the SCSI bus (i.e. the one with the lowest id), /dev/sdb is the second hard disk, and so on down the line.
now the part that trips people up: a partition is a device name followed by a partition number. that number is the index (starting from one) of the partition map entry in the partition map โ and heads up, the partition map itself occupies the first entry. ๐ so for example, /dev/sda2 is the partition described by the second entry in the partition map on /dev/sda. (yes, the original really does spell it "partiton map" in that sentence. we love a typo era. ๐)
โจ OPTIONS โจ
-v|--versionโ prints the version number of themac-fdiskprogram. ๐ท๏ธ-h|--helpโ prints a list of available commands for themac-fdiskprogram. ๐-l|--listโ lists the partition tables for the specified device(s). and if you give it no device(s) at all? it lists all SCSI and IDE devices found in the system. โญ-r|--readonlyโ preventsmac-fdiskfrom writing to the device. ๐ก๏ธ read-only queen behavior, we stan a safe queen.
๐ Editing Partition Tables ๐
okay here's the fun part. ๐ if an argument is just simply the name of a device, that means mac-fdisk should edit the partition table of that device.
once it's started, mac-fdisk hits you with an interactive command prompt for editing the partition table. the partition editing commands are:
h list available commands
p print (list) the current edited partition table status
P print ordered by base address
i initialize the partition map
s change size of partition map
b create new 800K Apple_Bootstrap partition (used by yaboot)
c create new standard Linux type partition
C create new partition, specifying the partition type
d delete a partition
r reorder partition entry
w write the partition table to disk
q quit
note that lowercase p and uppercase P are different commands, and lowercase c and uppercase C are also different. it's giving case-sensitive girly. ๐
commands that take arguments will prompt for each argument in turn. but bestie, you can also just type the arguments separated by spaces and those prompts get skipped entirely. efficiency icon. โก
the i and w commands will prompt for confirmation. and here's the big one: none of the editing you do will actually affect the state of the disk you are partitioning until the w command is issued. then the map, in its edited state, gets permanently written to the disk. permanent. forever. no undo. ๐ญ
partitions are always specified by their number โ the index of the partition entry in the partition map. and listen, many commands will change the index numbers of partitions which follow the affected partition, so you are encouraged to use the p command to print the partition table as frequently as necessary. spam it. it's free. ๐
โ ๏ธ limits alert: for SCSI disks, the partition table should not contain more than fifteen partitions (partition map excluded). IDE disks have a limit of 31 partitions.
here is a more-or-less typical output for the print command ๐ :
Command (? for help): p
/dev/sdb
# type name length base ( size ) system
/dev/sdb1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map
/dev/sdb2 Apple_Driver43 Macintosh 54 @ 64 ( 27.0k) Driver 4.3
/dev/sdb3 Apple_Driver43 Macintosh 74 @ 118 ( 37.0k) Driver 4.3
/dev/sdb4 Apple_Driver_IOKit Macintosh 512 @ 192 (256.0k) Unknown
/dev/sdb5 Apple_Patches Patch Partition 512 @ 704 (256.0k) Unknown
/dev/sdb6 Apple_HFS untitled 3072000 @ 1216 ( 1.5G) HFS
/dev/sdb7 Apple_HFS untitled 2 333026 @ 3073216 (162.6M) HFS
/dev/sdb8 Apple_Free Extra 10 @ 3406242 ( 5.0k) Free space
Block size=512, Number of Blocks=3406252
DeviceType=0x0, DeviceId=0x0
Drivers-
1: @ 64 for 22, type=0x1
2: @ 118 for 36, type=0xffff
๐ง the i command
the i (initialize) command prompts for the size of the device. you can just hit Return to accept the offered size, which should be correct. ๐ซถ
๐ง the b command
the b command is a shortcut to create the bootstrap partition used on PowerPC NewWorld machines. it's equivalent to creating an 800k Apple_Bootstrap type partition using the C command described below.
the sole purpose of this partition is to store the boot loader. ๐
in multiboot environments, the first bootable partition found on the disk takes precedence โ unless a specific boot partition is set in OpenFirmware. so it's best to:
- create the bootstrap partition first, or
- move it to a position before any
Apple_HFSorApple_Bootpartitions using thercommand described below
then you'll still be able to boot Linux after the occasional OpenFirmware reset. ๐ฎโ๐จ crisis averted.
๐ง the c command
the c (create new partition) command has three arguments. and as mentioned up top, you can type the arguments following the command separated by spaces, or just respond to the prompts for each argument:
- the base address of the start of the partition. you can specify a number in blocks (most likely reading from the existing partition map) โ or you can type a partition number followed by the letter
pto indicate that the new partition should take the place of that existing free space partition. ๐ - the length of the partition. again, you can specify a number in blocks, or type a partition number followed by the letter
pto indicate use of the entire partition. you can also type a number followed byk,m, orgto indicate the size in kilobytes, megabytes, or gigabytes respectively. (these are powers of 1024, of course, not powers of 1000. respectful. ๐ซก) ๐ - the name of the partition. this can be a single word without quotes, or a string surrounded by single or double quotes. it is best to name any swap partition you create
swap๐ โ other partition names are up to you. and ngl, the names are not visible to Linux. ๐
๐ง the C command
the C command is identical to the c command, with the addition of a partition type argument after the other arguments.
the partition type used for Linux swap and data partitons is APPLE_UNIX_SVR2 โ this is the partition type created by the c command. (yep, "partitons" again. iconic typo, keeping it. ๐)
under normal circumstances, you should not need to use this command. it's giving optional bonus level. ๐ฆ
๐ง the d command
the d command deletes the partition number specified, replacing that partition with partitionable free space. ๐๏ธ
๐ง the r command
the r (reorder) command allows the index number of partitions to be changed.
the index numbers are constrained to be a contiguous sequence, and mac-fdisk will enforce this constraint by recalculating the partition numbers after each insert, delete or reorder operation.
here's the iykyk part ๐ โ OpenFirmware looks for bootable partitions in the order specified by the index. but the partitions are not moved on the disk. this command takes two arguments: the number of the partition to be moved, and the partition number it should become.
๐ง the w command
the w command writes the partition map out to disk. ๐พ
โ ๏ธ note that partition maps for disks with mounted partitions cannot immediately be reinterpreted by the kernel. in order to use the new partition map, you must reboot. ๐ญ
within the Debian installer system, mac-fdisk is normally invoked before any partitions are mounted, so a reboot is not necessary before continuing the installation. we love a convenient installer flow. ๐
๐ง the q command
the q command terminates the program. and if there was no w command issued during the program run, then there will be no effect on the disk. no harm, no foul, nothing written. โจ
๐ BUGS ๐
some people believe there should really be just one disk partitioning utility. (a bold take. a controversial take. we're just reporting it. ๐)
and here's the real one, bestie โ mac-fdisk should be able to create HFS partitions that work. currently, if a pre-existing HFS partition is resized, MacOS will continue to use the partition size stored in the HFS 'superblock' instead of using the size from the partition table. (the MacOS volume on the partition remains valid even though the sizes don't match anymore. ๐)
this can have undesired side effects, especially when creating a smaller HFS partition followed by a few Linux partitions in place of the previous HFS partition space. ๐ญ
๐ก to avoid this issue: create MacOS partitions within MacOS and then don't resize them in mac-fdisk. periodt. ๐
๐ SEE ALSO ๐
fdisk(8), mkswap(8), mkfs(8) โ go read those next, bestie, they're the whole friend group. ๐ซถ
๐ AUTHOR ๐
Eryk Vershen (eryk@apple.com), and the man page was revised by Chris Tillman (tillman@azstarnet.com). legends, both of them. ๐
and that's the page, bestie!! ๐ฆ this one shipped with Debian, dated 1 December 2001, and it lives happily at MAC-FDISK(8). now go partition something responsibly โ and remember, don't hit w until you mean it ๐
โจ๐
๐ฆ where this page comes from
- nixos 26.05: mac-fdisk 0.1.16
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms