Work around a NTFS-3G/Boot Camp/Startup Disk issue

Jan 23, '08 07:30:00AM

Contributed by: Anonymous

I've recently discovered the NTFS-3G/MacFuse plugin that allows you to both read and write to NTFS disks. This was a great joy, as I was able to use it along with this hint to resize and restore a big windows partition.

However, as others have found, it is not possible to select your NTFS Windows partition as a startup disk. One workaround is to simply make the partition non-writable, as described in this hint, but that defeats the purpose.

Below is an AppleScript cobbled together from bits and pieces on the internet that works around the problem. Note that you have to change the first two lines to match your system.

The first item, Untitiled has to be the name of the NTFS disk as it appears on your desktop. The second item is the firmware address of the disk. To find this, open a terminal window and type diskutil list, then press Return. For me, this gives:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *298.1 Gi   disk0
   1:                        EFI                         200.0 Mi   disk0s1
   2:                  Apple_HFS Macintosh HD            216.9 Gi   disk0s2
   3:       Microsoft Basic Data                         216.9 Gi   disk0s3
The bit I want is the NTFS volume, which for me is disk0s3. Here then is the script:
set WinDisk to "Untitled"
set WinDevice to "disk0s3"

-- Eject the disk.
tell application "Finder"
  if disk WinDisk exists then
    eject disk WinDisk
  end if
end tell

-- Set it up for the next reboot.
do shell script "bless -device /dev/" & WinDevice & " -legacy -setBoot -nextonly" with administrator privileges

-- Reboot.
do shell script "shutdown -r now" with administrator privileges
Extra bonus! I like to use sudo so much that I set up my /etc/sudoers file so that I don't need to use a password. If you do this, then the script becomes simpler to use:
set WinDisk to "Untitled"
set WinDevice to "disk0s3"
tell application "Finder"
  if disk WinDisk exists then
    eject disk WinDisk
  end if
end tell
do shell script "sudo bless -device /dev/" & WinDevice & " -legacy -setBoot -nextonly"
set doit to button returned of (display dialog "Will boot into Windoze on next restart. Restart now?" with icon 2 buttons {"Not now", "Reboot"} default button 2)
if doit is "Reboot" then
  do shell script "sudo shutdown -r now"
end if
[robg adds: I haven't tested this one...]

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080116093511246