Tuesday, August 7, 2007

diskutil resizeVolume

To create a partition for Windows on a iMac with a 150GB disk I used the following commands:

First we need to look at the current disk partitioning:
diskutil list
which returns something like

#: type name size identifier
0: GUID_partition_scheme *149.1 GB disk0
1: EFI 200.0 MB disk0s1
2: Apple_HFS MyMac 148.7 GB disk0s2

Then I used the command
diskutil resizeVolume disk0s2 112G MS-DOS Windows 36G

This resizes the Mac partition to 112 GB and creates a second partition in ms-dos format named 'Windows' with a sie of 36 GB

More infos here:

A reboot is then required. But wait:
Be sure to set the startup disk first, otherwise your mac will not start up!!!
bless --mount "/Volumes/Macintosh HD" --setBoot

In order to use the newly created volume with netboot, I had to erase the volume.
Otherwise the volume was not visible in NetRestore.
The command to do this is:

diskutil eraseVolume MS-DOS ".Windows XP" /dev/disk0s3