MacNN Forums (
-   macOS (
-   -   Not Enough Free Space on NetBoot Image Partition (

l008com Dec 16, 2012 05:55 PM
Not Enough Free Space on NetBoot Image Partition
Since the NetBoot server isn't all that popular, I'm going to explain how it works a bit before I get into my problem.
I assume everyone knows how it works on the client end. You choose an image and your Mac boots that image over the network. Quick, easy, painless. It's a cool system. So on the server/admin sideā€¦

Every version of OS X Server comes with it's own System Imaging Utility. So lets say you want to make a netboot image with some utilities on it. So you take an external hard drive. Make two partitions on it. On one partition, you set it up to be the netboot image. So you install all of the utilities you want installed. You configure all of the preferences just the way you want them. Set your background image, etc, etc. On the other image, you just do a quick clean plain installation of your OS. And you also install your OS X Server Admin tools (or in case of 10.8, the Server app). So once your image-to-be is configured, you boot the second partition, and run the imaging utility. This utility will turn your volume into a netboot image. A netboot image is basically just a folder with some .plists in it, a read-only disk image of your initial volume, and a kernel or two (10.5).

NetBoot images are read-only. So when you boot them, you can make as many changes as you want. But once you shut down, all changes are lost. Every time any mac boots a netboot image, it is booting the image exactly as it was when you made it. The changes you make are stored in shadow files on the server that you can periodically toss, since they are only used during the current active session. Once you reboot, the shadow files are useless.

So here is the problem: When you make a netboot image from a real volume, the utility only leaves a small amount of free space on the volume. Even though the disk image is read only, the amount of free space matters because that's still all you get to use. In other words, if the .dmg file in the netboot image i just made only has 900 MB of free space in the volume, then that's all I get for free space on any machine I boot off that image. Even though the image is read only, and all of the "free space" is actually being stored as shadow files on the server, that limit is still applied. And 900 MB is not very much free space. So you can boot a utilities volume and if a program eats up a lot of ram, that virtual memory can eat up what little free HD space you have, and suddenly your netboot image is not very functional.

Now being the clever fellow that I am, I came up with a solution to this problem last time around. I used the following command to resize the partition (and only the partition) of the .dmg file, inside the netboot image (netboot images are just folders).

hdiutil resize -size 60g -partitiononly NetBoot.dmg
This resized the volumes to 60 GB. But it was all blank space, so the .dmg file's size did not change. It would just mount as a read only volume with 40 GB of free space instead of a few hundred MB. This little trick worked very well. But it's not working any more. I can't figure out why. But every time I try to run this command on the .dmg file, I get an error very similar to the following:

hdiutil: resize request 125829120 is above maximum size 18005952 allowed.
hdiutil: resize: failed. Invalid argument (22)

I get this error while running 10.8, 10.7, or 10.6. I get this error whether I'm trying to resize an image containing 10.8, 10.7, 10.6, 10.5, 10.4 or 10.3. I get this error whether I convert the image to a read/write image first, or even a spare image first. I get this error whether the original hard drive that volumes were on, is partitioned as APM or GUID.

The "maximum size" listed in the error message is different for each image I try to resize. It's as if the tool is trying to fit the increase volume inside the existing free space of the image's volume. Which isn't what I'm trying to do at all.

I've been using netboot images filled with utilities for years now. And overall it works very very well. I started back when the first macbooks came out with no firewire. I quickly realized I needed a better solution than booting my Mac into firewire mode to repair other Macs. And then when I got into it, I realized I could host images of all different OS versions. So now I can plug my MBP into a client's network, and boot any Mac they have off of a utility volume of any version of Mac OS X needed, all the way down to 10.3, all at the same time. And I also have NetInstall volumes too that let me install OS X for all these versions as well. The only real quirk I've had over the years, is this 'free' space issue. In the past (before the last time I updated my images, where I used the command above to resize the partitions and solve the problem), what I've done when I've ran into a HD pinch while working, is to immediately start deleting apps I don't think I'm going to need, right off the netbooted Mac. This frees up space on the netboot volume and the system is happy. And again it's all read only, so I'm not actually making changes to the image itself. One real half assed solution I thought of was to set up all of my netboot volumes as having a 1 GB file in their trash and not emptying it before creating a netboot image from the volume. Then when this problem came up and the OS was running out of disk space, I could just empty the trash. I'm quite sure this little trick would have worked, but it's so half-assed. I'd much rather just have more free space on the mounted disk images.
olePigeon Dec 18, 2012 10:42 AM
You should use DeployStudio instead of Apple's built in service. In fact, Apple uses DeployStudio. I went to an Apple Seminar where they trained people on it. It's free and makes the process rather painless. You can even set up workflows to automate the whole process. It's what I used at my work for imaging and deploying close to 500 laptops in just a couple weeks.
cache22nz Dec 18, 2012 11:33 AM
That doesn't address his problem. DeployStudio is a great tool for capturing and deploying images (I use it myself), but it still leverages off Apple's NetBoot solution. It can create its own NetBoot image, but it's specifically designed to boot to the DeployStudio client. In terms of creating a custom image with your own selection of utilities, I'm not aware of anything other than Apple's System Image utility, since Mike Bombich's NetRestore utility doesn't seem to work with the latest OSs.

(As an aside, the image DeployStudio creates is read/write by default, so you can tweak things, or add extra utilities to it. Our latest 10.7 image looks to be about 5GB is size, and has about 3GB free.)

I see you got a response on Apple's support forum that suggests resizing the image, rather than just the partition. I suppose you could then try converting the image to read-only/compressed.
l008com Dec 18, 2012 11:00 PM
So I removed the -partitiononly flag and did a convert to read/write, resize, convert back to read-only. And that worked, that gave me exactly what I had before. These are the commands I used, I'm sure many will find these useful:

Convert images to read-write with:

hdiutil convert Image.dmg -format UDSP -o
Resize partitions with:

hdiutil resize -size 50g
Convert back to read-only with:

hdiutil convert -format UDRO -o Image.dmg

For no particular reason, I went with 50 GB for all images. SO doing these commands leaves you with a disk image whos .dmg file is exactly the same size as the "used" space on the mounted volume, but the volume itself is a 50 GB volume, with 40+/- GB of free space. This is what you need if you are using NetBoot images, so they don't fill up right away. Those commands should really be built into the System Image Utility so it gets done automatically as a part of creating a netboot image.

You mentioned compressed images. I actually experiment with converting my disk images to compressed images a while back. And it totally works. And your collection of images uses a lot less space. But, computers booting off the server boot slower. And since it's generally slower anyway, I opted to stick with the uncompressed images.

And speaking of speed. Booting up a Mac off the NetBoot server on my laptop, which has a 500MB/sec SSD . . . WOW is it fast. You would never guess that you are netbooted. Apps open much faster than they do with a Mac booted off an HDD. Its not as fast as opening up apps on my laptop itself, but it's surprisingly close.
l008com Dec 18, 2012 11:02 PM
Oh and another neat things. Converting the read-only disk image to read-write, I was getting a steady 120 MB/sec read & write simultaneously. Converting back to read-only, I was getting a steady 180MB/sec simultaneously. And verifying a disk image, I was getting a steady 375MB/sec (not that steady though, because that that rate, the verification is done almost as soon as it beings). Not that any of this is related to the point of this thread :D
All times are GMT -4. The time now is 08:36 AM.

Copyright © 2005-2007 MacNN. All rights reserved.
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

Content Relevant URLs by vBSEO 3.3.2