Category Archives: Mac

Resizing an OSX partition on a VM hosted on ESXi.

Update 11/2/2014: We are successfully virtualizing Mavericks (10.9) and it is possible to resize disks online without having to go through the following guide. It still applies to Mountain Lion (10.8) and earlier versions.

One of the great things in vSphere 5.1 is that the Mac Pro is a fully supported server for ESXi. That means you can virtualize OSX on supported and recent hardware.

While the templating and integration is not as great as with Windows and Linux, you can deploy VMs in a reasonably short amount of time. Just make sure you don’t check the “Edit virtual hardware (Experimental)” box as it may blow your template up.

If you attempt to grow the disk, you will get a “Partition failed” error message in OSX “MediaKit reports partition (map) too small.”. No matter how many times you try it won’t work…

At this point you have 4 options:

Since I didn’t have time to place a purchase request and didn’t have much time, I used a PartedMagic iso I already had in one of my Datastores. Only to notice that the iso wouldn’t boot. This is due to the fact that OSX VMs are running in EFI boot mode only.

Fear not, there is a way to get it to boot:

  1. Shut your VM down.
  2. Right click > Edit Settings.
  3. Increase the disk space to the capacity you want.
  4. Go to the options tab, change the “Guest Operating System” to Windows and select any flavor of Windows in the drop down menu.
    From this:
    changeguest1
    To this:
    changeguest2
  5. Then, still in the Options screen, under “Advanced > Boot Options”, change the boot firmware from EFI to BIOS.
    efibios
  6. Your VM should now be able to boot from the ISO.
  7. In PartedMagic, start Partition Editor, you should see an error message similar to this:
    fixgpt
    Click Fix. If another dialog prompts you to fix something else, click Fix again.
  8. Add a FAT32 partition in the empty space.
    newpart
  9. Click Apply.
  10. Shut down and revert the Guest OS and Boot Firmware options.
  11. Boot into OSX, delete the FAT32 partition and resize your main partition.
  12. You’re done.

Namaste.

Serving Mountain Lion updates with a server running Lion.

UPDATE 10/03/12: Turns out, Apple decided it’s no longer possible to update a newer OS than what the server is actually running (i.e. no updates for 10.8 if the server is running 10.7). As per this KB article, updating Mountain Lion requires a Mountain Lion server. My stance on this is to use either Reposado or Munki to server updates moving forward… Apple still doesn’t care about the enterprise market.

Anything below this is deprecated and no longer works. Keeping it here for archiving purposes.

You want to follow this Apple article that applies to Snow Leopard: http://support.apple.com/kb/HT4771

Add the following line at the end of the otherCatalogs array in /etc/swupd/swupd.plist:
index-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog

Then, locate the following line in /etc/swupd/swupd.conf:

RewriteRule ^/index\.sucatalog$ http://%{HTTP_HOST}/cgi-bin/SoftwareUpdateServerGetCatalog?/index-lion-snowleopard-leopard.merged-1.sucatalog

Add these 2 lines after:

RewriteCond %{HTTP_USER_AGENT} Darwin/12
RewriteRule ^/index\.sucatalog$ http://%{HTTP_HOST}/cgi-bin/SoftwareUpdateServerGetCatalog?/index-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog

Restart Software Update.

Namaste.

Deploy Windows on Macs using MDT.

[Edited for Mac OSX Lion, thanks to Ted.]

Deploying Windows on Macs is a bit complicated since they don’t support standard PC features like PXE. Considering you have one-and-only one Mac OS partition (usually Macintosh HD), running the Boot Camp installer creates a fourth partition on Disk0 (Disk0\Partition3 or Disk 0\Partition4 if you’re running Lion/Mountain Lion).

MDT lets you generate boot CDs for unsupported hardware. Make sure you include BroadcomMarvell and Nvidia Ethernet drivers into your driver repository.

  1. Go into your deployment share (Deployment$\Scripts) and create a file named DiskPartMac.txt then insert the following contents into it:
    SELECT disk 0
    SELECT partition 3 or SELECT partition 4 if you’re running Lion or Mountain Lion
    FORMAT FS=NTFS LABEL=”Bootcamp” QUICK
    EXIT
  2. Create a standard Task Sequence in the Deployment Workbench, chose the OS you want to install.
  3. Under PreinstallNew Computer Only, delete “Format and Partition Disk”.
  4. Still under New Computer Only, create a command line action by clicking “Add” at the top then “General”, then “Run Command Line”. Rename it to “Custom Mac Format” and input the following command:
    diskpart /s “%scriptroot%\DiskPartMac.txt”
  5. Move it between “Validate” and “Copy scripts”.
  6. Click on “Install Operating System” under “Install” and configure the target partition as Disk 0 Partition 3 or 4 if you’re running Lion:
You’re done.
Namaste.

My favorite tools…

I’ve been wanting to put a list of my favorite tools online for a long time…
System cleanup, tune-up and optimization:
Ccleaner – Piriform – Free – Cleans caches, temp files, application specific settings, cleans up the registry and much more.
Defraggler – Piriform – Free – An awesome disk defragmentation software.
Cleanup! 4.5.2 – Steven Gould – Free – Very very strong cleanup tool for Windows XP only.
Filesystem repair:
Data Recovery Wizard Pro – EaseUs – $69.95 – Best data recovery software I’ve ever used. Way more efficient than Ontrack EasyRecovery Pro. And cheaper. Saved my a** more than a couple of times.
ViVard – Copyrsoft – Free – HDD diagnostic and sector repair. Vendor independent.
Mac side:
Appcleaner – FreeMacSoft – Free – Application uninstaller for Mac OS. Like AppZapper but free.
OnyX – Titanium Software – Free – Like Ccleaner, for mac. Awesome.
Misc:
Mouse Jiggler.vbs, a small VBscript I use to prevent a computer from locking itself when I’m working on it without knowing the user’s password:

Set WshShell = WScript.CreateObject("Wscript.Shell")
Do While 1
WshShell.SendKeys"{SCROLLLOCK}"
WshShell.SendKeys"{SCROLLLOCK}"
WScript.Sleep(300000)
Loop

More to come…

Namaste.

iTunes hanging when connecting iPhone.

If you see iTunes hanging (being unresponsive) when you connect your iPhone, try the following:

  • Connect your iPhone.
  • Watch iTunes hanging.
  • Curse. A lot.
  • Launch Image Capture.app, go to the Preferences and select “When a camera is connected open:” “No application”.
  • iTunes magically un-hangs.
  • You’re welcome.

Namaste.

Playing with Boot Camp on Macs and EFI limitations workarounds.

As you may know, Macs use a GPT (GUID Partition Table) unlike Windows, that usually uses the old MBR (Master Boot Record). On top of that, there is just a BIOS emulation on top of the EFIon Apple machines. As usual, Macs are a step ahead but that creates some side effects:

  • Inability to boot from exotic CDs like UBCD, Manufacturers HDD diagnostics and so on…
  • Inability to clone Windows partitions using standard tools like Ghost or Acronis.

Hopefully, there are workarounds. First of all, if you have HDD issues, you can move the drive to another computer (PC) to perform extensive testing, especially at the logical and mechanical level. You don’t need to actually boot on the HDD – that would be impossible anyway – to analyze it. Moving a drive is not hard and doesn’t void the warranty if done properly.

Cloning is now fairly easy, there is an awesome tool called WinClone from TwoCanoes that allows you to backup and restore a functional Boot Camp partition. You can even shrink your Windows partition. They also claim that you can deploy Windows using ARD.

I also would like to share a few reminders:

  • Windows is not like Mac OS. You can’t have a generic Windows image just by cloning it as every model of Mac is different and requires different drivers and settings (especially on the ACPI side) unless you use a third-party tool.
  • Macs doesn’t support PXE for obvious reasons. You can use NetBoot though.
  • If you don’t absolutely need to boot natively into windows, consider using a VM as they are less platform dependant.
  • Use Time Machine!

Namaste.

Entourage issues with Exchange 2007.

How to resolve Entourage issues with Exchange 2007, especially the infamous “The user’s folder could not be found. Entourage could not find a mailbox for the user username_last, username_first.” The basic workaround is to instruct users to manually change the mailbox path to: mail.contoso.com/exchange/your.username@contoso.com. But wait! There is a permanent fix:

  • From a MMC, open the Exchange Console.
  • Select an affected user mailbox and click properties and go to the E-Mail Addresses tab.
  • Under the addresses you should see user@domain.com.
  • Add user@domain.local.
  • Try to access a shared mailbox/calendar with Entourage again… Voilà! You shouldnt see any error message anymore.
  • To do this to all the users in your domain, you will need to edit the default email policy and apply it to all the [existing and new] users.