Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

svenbox

macrumors newbie
Original poster
Apr 24, 2006
3
0
Hi all,
I was getting a little annoyed with seeing my WindowsXP partition in the Finder and on the desktop all the time, so I looked around for a way to easily mount and unmount it. This bash script comes from a hint on Macosxhints.com, I didn't write it, just modified it a little bit! I've added it as a startup item, and whenever I need my WindowsXP volume mounted (it's a FAT32 formatted partition) I just run the script again and the volume will get mounted. This script sort of toggles the mounting status of my partition.

What you need to do is to find out a) your volumes name and b) your volumes partition (you can do this by showing info on the partition in Disk Utility. Put this in the script, save the script in for example /usr/local/bin and make it execute (chmod 777) and off you go.

Code:
#!/bin/bash
NAME=WINDOWSXP
PART=disk0s3

if [ -z `ls -1 /Volumes/ | grep $NAME` ] ; then 
    # check that PART appears to be a disk partition
    echo Checking $NAME $PART
    if [ `file /dev/$PART | awk '{print $2}'` = "block" ] ; then
  echo Mounting $NAME $PART
     diskutil mount /dev/$PART
    else
       echo /dev/$PART does not appear to be a disk partition - exiting
  exit 1
    fi
else
    echo unmounting $NAME
    diskutil unmount /Volumes/$NAME
fi

If you want to make this more gui friendly, you can wrap it in an Applescript app (with the line do shell script "/usr/local/bin/WindowsXPmount" for example), add the Windows XP logo and wowee you got a little app that toggles the visibility for your Win partition.

Now if I only could find out a way to make the Volume name lowercase, eg WindowsXP instead of WINDOWSXP, I would be really happy. Somehow FAT32 formatting makes it impossible to get rid of these screamin CAPS in drive names...

/S
 

Gordy

macrumors 6502a
May 22, 2005
663
0
Bristol, UK
svenbox said:
Hi all,
I was getting a little annoyed with seeing my WindowsXP partition in the Finder and on the desktop all the time, so I looked around for a way to easily mount and unmount it. This bash script comes from a hint on Macosxhints.com, I didn't write it, just modified it a little bit! I've added it as a startup item, and whenever I need my WindowsXP volume mounted (it's a FAT32 formatted partition) I just run the script again and the volume will get mounted. This script sort of toggles the mounting status of my partition.

What you need to do is to find out a) your volumes name and b) your volumes partition (you can do this by showing info on the partition in Disk Utility. Put this in the script, save the script in for example /usr/local/bin and make it execute (chmod 777) and off you go.

Code:
#!/bin/bash
NAME=WINDOWSXP
PART=disk0s3

if [ -z `ls -1 /Volumes/ | grep $NAME` ] ; then 
    # check that PART appears to be a disk partition
    echo Checking $NAME $PART
    if [ `file /dev/$PART | awk '{print $2}'` = "block" ] ; then
  echo Mounting $NAME $PART
     diskutil mount /dev/$PART
    else
       echo /dev/$PART does not appear to be a disk partition - exiting
  exit 1
    fi
else
    echo unmounting $NAME
    diskutil unmount /Volumes/$NAME
fi

If you want to make this more gui friendly, you can wrap it in an Applescript app (with the line do shell script "/usr/local/bin/WindowsXPmount" for example), add the Windows XP logo and wowee you got a little app that toggles the visibility for your Win partition.

Now if I only could find out a way to make the Volume name lowercase, eg WindowsXP instead of WINDOWSXP, I would be really happy. Somehow FAT32 formatting makes it impossible to get rid of these screamin CAPS in drive names...

/S

To change the volume name boot into windows and change the name of the hard disc to whatever you want :)

Great script by the way! :)
 

svenbox

macrumors newbie
Original poster
Apr 24, 2006
3
0
Gordy said:
To change the volume name boot into windows and change the name of the hard disc to whatever you want :)

Great script by the way! :)

Hi, If you would have read my post, you would have seen that I have problems getting the drive name to be in lower case characters instead of CAPITALS, renaming the drive is not a problem to do (even in os x i think).

/S
 

Gordy

macrumors 6502a
May 22, 2005
663
0
Bristol, UK
svenbox said:
Hi, If you would have read my post, you would have seen that I have problems getting the drive name to be in lower case characters instead of CAPITALS, renaming the drive is not a problem to do (even in os x i think).

/S

I renamed mine in windows to Windows HD and it shows up on the desktop as that. No capitols except where I specified them. It shows up in disc utility as Windows HD too.

I just booted up in windows loaded my computer or windows explorer clicked on the hard disc and pressed f2 to rename.

Hope that works for you
 

svenbox

macrumors newbie
Original poster
Apr 24, 2006
3
0
Gordy said:
I renamed mine in windows to Windows HD and it shows up on the desktop as that. No capitols except where I specified them. It shows up in disc utility as Windows HD too.

NTFS or FAT32?

/S
 

Gordy

macrumors 6502a
May 22, 2005
663
0
Bristol, UK
svenbox said:
NTFS or FAT32?

/S

NTFS. Don't know why I chose that over fat32 it would have been easier to go for fat32 and allow me to use it on either partition.

I need to do a reinstall at some time so I will sort it out then.
 

MRU

macrumors Penryn
Aug 23, 2005
25,370
8,952
a better place
Or simply in windows rename c:local disk to .windows

then when your in OSX it wont appear on the desktop ever. Life is simple why complicate it? :D
 

elcid

macrumors 6502
May 5, 2007
427
0
Or simply in windows rename c:local disk to .windows

then when your in OSX it wont appear on the desktop ever. Life is simple why complicate it? :D

Not to raise an old post from the dead, but this doesn't work for me. I try and rename the drive under My Computer from Local Disc (C) to .Windows and it says it is an illegal naming. Any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.