Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Command to unmount iPod

Command to unmount iPod
Thread Tools
Turnpike
Mac Enthusiast
Join Date: Mar 2004
Status: Offline
Reply With Quote
Feb 10, 2005, 01:51 AM
 
No matter what I do, my iPod seems to say "do not disconnect" about 40% of the time when I wake up in the morning. I'd rather not make a whole lot of noise and disturb my roommates by sitting down at the computer, turning on the monitor, logging in, and then ejecting the iPod. I don't have it set to sync automatically or anything.

so, I figured the best way to solve this would be to set up cron jobs to eject the iPod 10-15 minutes before I leave every morning. I have no problem setting cron jobs, but I don't know what command I should be using. I read the man pages for both umount and hdiutil but I'm too unfamiliar with the terminology to know what I should be doing.

Oh, also a command to determine if the iPod is mounted would be nice, too. That way I could just run a shell script a bit before I leave in the morning that would check first before trying to unmount a volume that doesn't exist.

Thanks!
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Feb 10, 2005, 09:39 AM
 
If you know the name of the iPod (I'm assuming you do) then you can grep the output of `df -l' (or 'ls /Volumes', if you like) for it to check if it is mounted.

To unmount it use `hdiutil detach /Volumes/iPod' (assuming it's name is actually 'iPod') or it's device name (e.g. /dev/disk2)

I'll let you work out the script
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Turnpike  (op)
Mac Enthusiast
Join Date: Mar 2004
Status: Offline
Reply With Quote
Feb 10, 2005, 02:57 PM
 
sweet, thanks a lot!
     
Turnpike  (op)
Mac Enthusiast
Join Date: Mar 2004
Status: Offline
Reply With Quote
Feb 11, 2005, 06:23 PM
 
okay, so this doesn't work...

Code:
hdiutil: detach failed - No such file or directory
when I
Code:
cd /Volumes ls
my iPod shows up just fine (it's name is Apollo). I find it interesting that using the tab key to auto complete will work just fine when typing in the command...

perhaps I have to use the device name. How would I go about finding this?

EDIT: Nevermind, found it with df -l

using hdiutil detach with /dev/disk2s3 (as it is in this case) works great. Thanks again!

Guess this post has turned into most a "for future people referencing this thread, using /Volumes/iPodName doesn't work" post
( Last edited by Turnpike; Feb 11, 2005 at 06:35 PM. )
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Feb 11, 2005, 11:06 PM
 
Well I must say I'm surprised that using /Volumes/name didn't work. However, after reading the man page, it was most definitely an error on my part.

Sorry. I'll look into things more thoroughly in the future
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Turnpike  (op)
Mac Enthusiast
Join Date: Mar 2004
Status: Offline
Reply With Quote
Feb 13, 2005, 04:14 AM
 
hah, no worries, you told me exactly what I needed to hear
     
Detrius
Professional Poster
Join Date: Apr 2001
Location: Asheville, NC
Status: Offline
Reply With Quote
Feb 13, 2005, 08:34 PM
 
Originally posted by Turnpike:
okay, so this doesn't work...

Code:
hdiutil: detach failed - No such file or directory
when I
Code:
cd /Volumes ls
my iPod shows up just fine (it's name is Apollo). I find it interesting that using the tab key to auto complete will work just fine when typing in the command...

perhaps I have to use the device name. How would I go about finding this?

EDIT: Nevermind, found it with df -l

using hdiutil detach with /dev/disk2s3 (as it is in this case) works great. Thanks again!

Guess this post has turned into most a "for future people referencing this thread, using /Volumes/iPodName doesn't work" post
Keep in mind that the disk number is not static. You may want to do something like

hdiutil detach `df | awk '/\/Volumes\/iPod/ {print $1}'`

(I've been reading up on sed and awk... spiffy stuff. )
ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
Turnpike  (op)
Mac Enthusiast
Join Date: Mar 2004
Status: Offline
Reply With Quote
Feb 15, 2005, 08:32 PM
 
I actually do that in my script, but thanks! (actually, I'm using cut instead of awk... but I should be using awk, probably. looks cooler that way, at least)
     
leira
Junior Member
Join Date: May 2004
Status: Offline
Reply With Quote
Feb 15, 2005, 09:50 PM
 
i like 'diskutil eject' better. you can use the mount point rather than the device name.
Code:
diskutil eject /Volumes/ipod
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:47 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,