Resizing Mac Partitions on-the-fly


As of OSX 10.4.6 you get a extra bonus if you use the terminal and run diskutil. The new addition is the function resizeVolume. Note that this command works only on Intel Macs with hard disks formatted using the GPT (GUID Partition Table) format with a journaled Hierarchical File System Plus (HFS+) file system. This is the default for Intel Macs’ hard disks.

To use the resizeVolume command, you need to get some information: you must be able to specify which partition you want to resize. You also need to know the partition’s size limitations, since it must be big enough to hold data already on the disk. To find the partition’s name, type diskutil list in Terminal. Press return and you’ll see a list of all the disks on your Mac. The one labeled /dev/disk0 is your boot disk. If you have other disks, they’re named disk1, disk2, and so on. Look under the Identifier header for the names of the disk’s partitions; for example, disk2s2. (Ignore any partitions labeled GUID_partition_scheme or EFI.)

Now you need to find out what size your new partition can be. Run this command: diskutil resizeVolume disk_identifier limits , replacing disk_identifier with your partition’s identifier. This will return the current size of the partition, as well as the minimum and maximum sizes you can use. For example:

For device disk2s2 Untitled:
Current size: 215822106624 bytes
Minimum size: 6691028992 bytes
Maximum size: 215822106624 bytes

Now that you know the disk’s name and size limits, prepare your command. It should follow this basic model:

diskutil resizeVolume disk_identifier partition_size second_partition_format second_partition_name second_partition_size

The first part of the command is, of course, the command itself: diskutil resizeVolume. Follow that with the identifier and size of the partition you’d like to split. Type in the size you want this partition to be, not what it currently is. So, for example, if you want the first partition to be 100GB, specify 100G . Finally, specify the format, name of your choosing, and size for the partition you want to create. Want more than two partitions? Just add additional arguments to your command.

Although you can resize the first partition, you can’t change its format—that’s why you don’t need to specify one for it. For each additional partition you wish to create, you must specify the format you want it to adopt. For example, type JHFS+ for journaled HFS+, HFS+ for unjournaled HFS+, MS-DOS for FAT32, UFS for Unix File System, and so on. You must specify the size for each partition. For example, to create a 100GB partition in journaled HFS+, you’d type JHFS+ new_partition_name 100G.

Here’s an example at work:

diskutil resizeVolume disk2s2 100G JHFS+ Part2 100G

This command splits a single partition in two. It specifies a size of 100GB for the first partition. Then it creates a new, second partition, named Part2, using the journaled HFS+ format, with a minimum size of 100GB. If there’s more empty space in the partition, the command will use it all. So if you split a 232GB partition, the above command would give you a first partition of 100GB and a second partition of 132GB.

The resizeVolume command occasionally fails. If it encounters any disk problems, it will stop, and you’ll need to run Disk Utility or another disk-maintenance program. If you have any system or special metadata files—which can’t be moved—in the section of your partition that you wish to reallocate, the command will also fail.

, ,

One response to “Resizing Mac Partitions on-the-fly”

Leave a Reply