I hope I am asking in the correct sub forum.
I just installed an optibay style hard drive. I have my HDD in the dedicated hard drive space, and my SDD (boot drive) in the optibay. Everything is fine with the drives and setup itself. This is in 2009 13" MBP
I am trying to write an Apple Script to mount and unmount the drive (it is 2 partitions but I would be mounting the entire disk, not selective volumes). I wanted a single script to do both action for simplicity sake. I use this MacBook for school, so I wanted to be able to 'turn off' the HDD to save power/wear and tear since it houses my iTunes, Aperture library, Downloads folder etc.
What I have so far.
This works to MOUNT the drive if I have already manually unmounted it, but it does not work to UMOUNT the drive if it is currently mounted and showing on my desktop. I tried substituting eject instead of unmountDisk but that didn't work.
the disk name disk1 is correct. The two partitions are disk1s2 and disk1s3 if that matters at all.
I also tried using the disk name ST95005620AS Media (which shows up in info pane for the drive in Disk Utility) on the if and if not lines of the script.
Any help with what I am missing would be appreciated.
I just installed an optibay style hard drive. I have my HDD in the dedicated hard drive space, and my SDD (boot drive) in the optibay. Everything is fine with the drives and setup itself. This is in 2009 13" MBP
I am trying to write an Apple Script to mount and unmount the drive (it is 2 partitions but I would be mounting the entire disk, not selective volumes). I wanted a single script to do both action for simplicity sake. I use this MacBook for school, so I wanted to be able to 'turn off' the HDD to save power/wear and tear since it houses my iTunes, Aperture library, Downloads folder etc.
What I have so far.
Code:
tell application "Finder"
if not (exists the disk "disk1") then
do shell script "diskutil mountDisk /dev/disk1"
delay 2
end if
end tell
tell application "Finder"
if (exists the disk "disk1") then
do shell script "diskutil unmountDisk /dev/disk1"
end if
end tell
This works to MOUNT the drive if I have already manually unmounted it, but it does not work to UMOUNT the drive if it is currently mounted and showing on my desktop. I tried substituting eject instead of unmountDisk but that didn't work.
the disk name disk1 is correct. The two partitions are disk1s2 and disk1s3 if that matters at all.
I also tried using the disk name ST95005620AS Media (which shows up in info pane for the drive in Disk Utility) on the if and if not lines of the script.
Any help with what I am missing would be appreciated.