Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mount and unmount an iPod from the Terminal UNIX
There is a neat little utility called disktool that allows you to mount and unmount disks (and iPods) from the Terminal. Here are some of the commands that I use...
  1. List all the disks that are mounted:
     % disktool -l
  2. Mount a specified disk:
     % disktool -m diskXYZ
    Replace XYZ with the disk number of your iPod, which you can find using the "-l" option when the iPod is mounted; my iPod is "2s3", so the command I would use is "mount -m disk2s3".

  3. Unmount any disk:
     % disktool -u diskXYZ
    Follow the example above to replace XYZ with your iPod's number. It does not tell you that is ok to disconnect the iPod.

  4. Eject any disk:
     % disktool -e diskXYZ
    However, this does not allow you to remount the disk. Use it after you are sure that you don't want to remount your iPod.
I recommend that you run 'disktool -l' while the iPod is connected to find out how the system recognizes it. Once you have that, you can unmount or mount without having to physically disconnect the iPod from your computer.
    •    
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[31,503 views]  

Mount and unmount an iPod from the Terminal | 6 comments | Create New Account
Click here to return to the 'Mount and unmount an iPod from the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
difference between mount and disktool?
Authored by: zedwards on Sep 20, '02 10:51:39AM

This is interesting, as I have been trying to figure out how os x mounts disks. Does anyone know if this is how mac mounts disks as opposed to disktool? In linux, one would just run "mount -t hfs /dev/hda9 /mnt" trying anything like that in os x gets some errors. I understand that mac mounts disks to "Volumes" and the device name is different (/dev/rdisk0s9).

\Does anybody have any thoughts? Is this a BSD thing?



[ Reply to This | # ]
Helps with Sync tricks
Authored by: DAC on Sep 20, '02 12:56:39PM

Great job!

This is just the sort thing that I needed to help me with some sync stuff I am doing with iCal (until iSync comes out).

I did note in playing with this that the iPod has to be set to a state that lets it be using in disk mode, ie you can not mount an ipod with the disktool command unless it was already in diskmode. Oh well, at least I can automatical eject it now from my scripts when I am done.



[ Reply to This | # ]
disktool is obsolete
Authored by: bhines on Sep 20, '02 03:14:30PM
I believe disktool is obsolete. The new preferred tool is "diskutil". I believe it mentions that in the 10.2 tech note:


• Supplemented the "disktool" command line tool (which was always intended as a test tool) with a more user-oriented "diskutil" command line tool. (r. 2817377).


Disk Utility Tool ©2002, Apple Computer, Inc.
Utility to manage disks and volumes.
Most options require root access to the device

Usage: diskutil
is one of the following:
list (List the partitions of a disk)
information | info (Get information on a disk or volume)

unmount (Unmount a single volume)
unmountDisk (Unmount an entire disk (all volumes))
eject (Eject a disk)
mount (Mount a single volume)
mountDisk (Mount an entire disk (all mountable volumes))
rename (Rename a volume)

verifyDisk (Verify the structure of a volume)
repairDisk (Repair the structure of a volume)

verifyPermissions (Verify the permissions of a volume)
repairPermissions (Repair the permissions of a volume)

eraseDisk (Erase an existing disk, removing all volumes)
eraseVolume (Erase an existing volume)
eraseOptical (Erase an optical media (CD/RW, DVD/RW, etc.))

partitionDisk ((re)Partition a disk, removing all volumes)

createRAID (Create a RAID set on multiple disks)
destroyRAID (Destroy an existing RAID set)
checkRAID (Check a RAID set for errors)
repairMirror (Repair a damaged RAID mirror set)



[ Reply to This | # ]
disktool is obsolete
Authored by: elcuco on Sep 20, '02 03:22:38PM

disktool is still available in Jaguar. there may be an alternative, but i prefer using disktool.



[ Reply to This | # ]
diskutil anomaly
Authored by: pumasalad on Sep 20, '02 05:47:16PM
when I use diskutil unmount disk2s3 , the Mac unmounts the iPod with no problem, but the iPod still has the flashing "do not disconnect" message on it's screen. Other than that, diskutil works as advertised. anyone know why? or does it matter?

[ Reply to This | # ]
ipod forgotten, but not gone
Authored by: hooperw on Mar 03, '06 07:05:06PM

In reply to the last post, the eject options in disktool or diskutil (either one) will unmount the ipod and detach it from /dev/disk?s?, so you can pull it out of the cradle. I have the 'disktool -e' command in my backup script, and it *usually* works fine.

There is an odd problem that occurs, though, if you eject an ipod (from disktool, diskutil, or iTunes) without taking it out. The ipod sits in the cradle, charging happily, as long as your Mac is awake, and even after it goes to sleep.

If you wake up your Mac with an ejected iPod still in the cradle, though, the iPod goes into a twilight zone. The iPod dislay warns "Do not disconnect," but there's no iPod icon on the desktop, and neither disktool nor diskutil can find the device. I can get my iPod back on the desktop within iTunes, but I really want a command-line tool to rescan the firewire port and remount the ipod and/or eject it properly.

Any help would be appreciated.



[ Reply to This | # ]