How can I add an HFS+ partition to an MBR-partitioned external drive
I have a 1Tb external drive that currently has two partitions -
- 64 Gb NTFS
- 524 Gb ext2
The remaining 414Gb is unused and shows as "Free Space" on the Mac's Disk Utility. I'd like to take 250Gb of this for an HFS+ partition to use with Time Machine, but Disk Utility doesn't seem to offer a way to add a partition in that space or format it.
My running Linux box (FC9) doesn't offer an hfs+ option for mkfs; if needed, I could boot from a DVD of a more modern Linux distro to accomplish this.
This question is similar, but my partition table is fdisk format, not guid.
I'm running MacOS 10.7.5.
Here is information on the current partitions
# diskutil list disk1
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *1.0 TB disk1
1: Windows_FAT_32 NO NAME 61.4 GB disk1s1
2: Linux 524.3 GB disk1s2
# gpt -r show disk1
start size index contents
0 1 MBR
1 120005549 1 MBR part 12
120005550 1023999165 2 MBR part 131
1144004715 809520453
# fdisk /dev/disk1
Disk: /dev/disk1 geometry: 121601/255/63 [1953525168 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 0C 0 0 2 - 1023 254 63 [ 1 - 120005549] Win95 FAT32L
2: 83 1023 254 63 - 1023 254 63 [ 120005550 - 1023999165] Linux files*
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Solution 1:
Obligatory warning: You seem to have found your way to fdisk
. Keep in mind that, like most BSD-Unix-style command line fdisk
tools, the Mac OS X fdisk
's editing feature does not 'do' safeguards, it has even less safeguards than whatever other platform's command line fdisk tool you're thinking of. It will happily let you accidentally use the erase
command (which removes all the partitions) or edit a partition that Mac OS X is currently using (rendering your system unbootable) and even has few safeguards against putting numbers that just plain don't make any sense under any circumstances right into the partition table, so please be careful. Its only saving grace is that the changes are only in memory until it writes them, so if you are careful you can exit
without saving.
You can use fdisk
in interactive mode to edit the entries in the partition table. For instance, to edit the partition table on disk 1:
sudo fdisk -e /dev/rdisk1
Then edit your first blank partition table entry (e.g. edit 3
), set it to type AF
, press return for the default to the CHS mode
question, press return to accept the default of starting the partition after the end of the last one, then enter the end sector number you want (the default is the end of the disk; to figure out one for a size you want: divide the size you want by 512 bytes to get the number of sectors you want, and then add that to the start sector number and subtract one to get the end sector number ). Do a print
to make sure it looks okay (nothing has been saved yet, so if there's a mistake you can just exit
(not quit
) at this point and run fdisk
again to start from the beginning.) Then write
to save the partition table over the old one on the disk. Then exit
.
If you get a warning at write
that the changes will require a reboot, that's okay; answer y
, and reboot Mac OS X after exit
ing.
Now the partition table has been updated, but the partition itself still has the whatever old blocks of data were in that space before; Run Disk Utility, and from the Erase tab, choose the new partition, give it a name, and Erase it.