Live partition resizing & Boot camp

Many Mac owners, myself included, partition their machine such that the OS is isolated from User data. Or so they can install two copies of the OS. Or for any of a number of other reasons.

Of course, as the system and user’s relationship to the system evolves, it often proves to be the case that the originally chosen partitioning scheme is, well, wrong. Too much space for OS, not enough for Data.

Or, in the case of Boot Camp, a new technology is released that requires an additional partition on the system’s drive.

With the 10.4.6 update, the diskutil command has gained the ability to resize partitions, including creating new partitions.

This is via the resizeVolume subcommand:

[albbum:~] bbum% diskutil resizeVolume
Disk Utility Tool
Usage:  diskutil resizeVolume [Mount Point|Disk Identifier|Device Node] size
        <part1format part1Name part1Size> <part2format part2Name part2Size> ...
Non-destructively resize a disk. You may increase or decrease its size.
When decreasing size, you may optionally supply a list of new partitions to create.
Ownership of the affected disk is required.
Valid partition sizes are in the format of <number><size>.
Valid sizes are B(ytes), K(ilobytes), M(egabytes), G(igabytes), T(erabytes)
Example: 10G (10 gigabytes), 4.23T (4.23 terabytes), 5M (5 megabytes)
resizeVolume is only supported on GPT media with a Journaled HFS+ filesystem.
A size of "limits" will print the range of valid values for the current filesystem.
Example: diskutil resizeVolume disk1s3  10G
         JHFS+ HDX1 5G MS-DOS HDX2 5G
Valid filesystems: "Case-sensitive HFS+" "Journaled HFS+"
	"Case-sensitive Journaled HFS+" "HFS+"
	"MS-DOS FAT12" "UFS" "Linux" "Swap" 

Boot camp requires an MS-DOS Partition for installation. There can only be one MS-DOS partition in the first three partitions on the disk and it must be the last of the first three partitions (you can have any number of additional partitions beyond 3 of any type).

The example in the above command is telling; it would resize disk1s3 to 10 gigabytes while creating a new journaled HFS+ partition of 5 gigs and an MS-DOS partition of 5 gigs. Assuming that there is no disk1s0 or disk1s1 (which happens), the end result would be an MS-DOS partition as the last of three partitions, ready for the installation of Windows.

14 Responses to “Live partition resizing & Boot camp”

  1. Dominik Wagner says:

    Interestingly enough I partitioned my disk with the following scheme:
    Dom 97 GB
    OS2 8 GB
    Swap 6 GB
    so creating a pratitioning scheme bootcamp would like, i would have to make some lousy small partitiion between Dom and OS2? Or could i just reformat OS2 to MS-DOS using diskutil erase? I didn’t think there is any magic beyond partitioning in Boot Camp – if there is, enlighten me 🙂

  2. Mithras says:

    Boot Camp is special because it simultaneously writes a GPT partition table (used by OS X) and an MBR partition table (used by Windows). It’s a nifty trick that no other tool can yet do, as far as I know.

  3. JFK says:

    Boot Camp is just calling the DiskManagement framework to do the work. It’s pretty much doing

    diskutil resizeVolume / g MS-DOS Untitled 1g

    (note that the last partition size given to diskutil always get’s whatever space is left, so it doesn’t matter what you pass it…

  4. Craig Turner says:

    This brings back memories of a mis-spent childhood trying to get partition tools to play nicely so I could get combinations of PC operating systems working together. I never found a nice match of tools – something would always not work properly even when I used a neutral tool like partition magic. It’s good to see an OS team making an effort to play nicely – I can’t think of an elegant resize solution previously (partition magic claimed it but I had some nasty run ins with that) which is weird because it’s such an obvious feature.

    I’m excited about bootcamp – but not because I want Windows. I’m hoping to upgrade my laptop later this year to a macbook, but it really comes down to whether or not it will be easy to get a functional linux setup on it. I’m addicted to a couple of aspects of my mac setup (audiohijack, great media support, self-adjusting crossover-cable support and lots of little things) but I’m a lot more comfortable in gnome than anything else when I’m working.

    Bill – do you know if there has been any consideration about Apple doing something similar to bootcamp for linux? I’ve read that redhat are planning a port, but it would be better still if users could just insert their distribution of choice and have it load. I don’t know enough about the process of bootstrapping an OS to know if this is reasonable. Apple have managed it at least for Windows, but that’s a very specific target and it might not be so straightforward to offer support for generic linux distros.

  5. IAn says:

    this is a foreign language to me…if anyone could help me out i would greatly appreciate it – i’ve already partitioned my macbook…foolishly only giving 5GB to windows. i’d like to increase this to around 10GB but havent been able to figure out how without going through the entire process over again. any info would be great – thanks –

  6. Sean says:

    So I just got myself a MacBook Pro and am attempting to make this work, with no success so far. I’m an old school Unix guru, so I’m very particular about how I partition my machine to work best with Unix. I currently use a 5 partition scheme:

    swap 1G
    system 10G
    apps 15G
    users 15G
    scratch 45G (this partition is whatever is left in space and used for all downloading, coding, music, movies, etc – basically anything that changes often on disk)

    From what I have read above, it looks like for BootCamp it would need to become 6 partitions as follows:

    swap 1G
    system 10G
    apps 15G
    users 15G
    scratch 45G

    Is this correct? If so, what am I doing wrong. I partitioned the drive like this, first using Disk Utility (which does let you select MS-DOS as a partition type when doing the partitioning) and secondly with ‘diskutil’ which is on the install DVD. In both cases I got the same results. If I try to run BootCamp Assistant which the disk already partitioned, it just comes up with an error saying that it will only work if the disk is a single MacOS partition, then quits. So, fine, I just went ahead and booted from my XP install CD to just do an install. When it comes up with it’s list of “drives” to install onto, I get a C: drive. But it says that it can’t install XP on that partition unless I “delete” the partition and reformat it from the XP installer. I stupidly did try this before I realized that that C: drive was the size of my entire hard disk and when I deleted it, my whole hard drive was wiped out and I had to start over. This isn’t a big deal because this is a brand new machine and I still have my old one. So I can reinstall as many times as I need to and still have all my data. But I’d like to get this squared away now before I start using the machine on a regular basis.

    Any suggestions?

  7. macmd says:

    I’ve been looking at this for the same reason as IAn. But strangly there is no geek out there that has tried a re-partition on a complete OS X/XP setup that they wan’t to redistribute. Is there anyone out there that has taken the plunge?

  8. bbum’s weblog-o-mat » Blog Archive » Mac OS X live partitioning example says:

    […] What a perfect time to use 10.4.6’s resizeVolume to make myself a new boot partition. […]

  9. Fast Miso » Mac OS X, Live partitioning and we with PowerPCs says:

    […] The other day my friend’s laptop hard drive was dying. He need to back up his disk to his external drive (which should be done with everyone’s best friend Carbon Copy Cloner) but he didn’t have a separate partition to keep things tidy in the process. Everyone has been talking about OS X 10.4.6’s new resizeVolume option to the diskutil command, but few articles actually mention that, while the option exists on the PowerPC 10.4.6 version of diskutil, you can’t actually use it on a PowerPC, as far as I can tell. The different is that Intel-based Macs (Macintels) have a GUID Partition Table while PowerPC-based Macs use Apple Partition Map (APM). You can only resizeVolume if the volume is GUID, that is, Intel-based. […]

  10. Matthew Johnson says:

    Can this safely be used on the current system partition? I am thinking of signing up for the Leopard Technology Preview and would like to partition the system drive on my PowerBook to create a place to install Leopard. If I can’t do so while booted into the PowerBook, could I connect it to my new iMac in FireWire disk mode and do this?

    Thanks for your help!


  11. eyk says:

    hey all, i recently installed vista on a bootcamp partition. I realized after the fact that it was too small, so I backed up the partition using Symantec Ghost 12.0. I then went into OSX, removed the bootcamp partition, and then created a new one using bootcamp. Before restoring the partition, the OSX disk utility GUI read the partition as the correct (40GB) size. After restoring the Ghost image, the disk utility now reads the old size of 20GB. Does anyone know what’s going on? It is interfering with VMWare Fusion’s ability to mount the bootcamp partition from within OSX because it is (probably) looking for it at the wrong part of the disk… Any help would be appreciated!



  12. bbum says:

    Sounds like a bug in Ghost — it sounds like it is restoring the partition info instead of laying down the partition contents into the newly sized partition.

    When doing things like this, I usually use the command line tool ‘asr’ or Disk Utility to save off the contents of the partition and later restore.

  13. envie says:

    Can the resizeVolume command be used in 10.4.11? I looked at the man page for diskutil and it does not mention this funcationality…

  14. R Hyre says:

    Oddly enough, you have to use Linux partitioning tools on PPC Macs to resize the Apple Partition Map partitions. However, this works pretty well, I’ve done it on my Mac Mini and ancient iBook to dynamically resize partitions.

    Any word on when PPC and other linuxen will fully grok the GUID partition tables? I’d prefer to do live resizes with one utility, to avoid ‘pilot error’ in the future.

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>