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

Force dismount a stuck volume Desktop
I found that the command
 % hdiutil eject -force device_name
is able to simply force eject a unit witch refuses to unmount due to files still "in use". The device_name can be estabilished by consulting the df command.

I wonder if there is any drawback in using 'hdiutil' in this way.

[Editor's note: Please note that there is a hint about Ejecting a busy disk image with a different method of solving the problem - namely, identifying the processes that are preventing the ejection in the first place. I believe this would be the preferred manner of resolving a stuck Volume problem, as it cleans everything up prior to unmounting the volume. I've chosen to publish this "brute force" method in the event that the first method fails to solve the problem ... and in the hopes that it sparks some conversation about the possible dangers -- what can go wrong if you force eject a busy volume? Thoughts?]
    •    
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[48,816 views]  

Force dismount a stuck volume | 6 comments | Create New Account
Click here to return to the 'Force dismount a stuck volume' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
What can go wrong...
Authored by: ashevin on Apr 26, '02 08:50:43AM

Hi all,

What can go wrong is the same thing that can go wrong when you yank the cord on an external drive... Any app that had files open on that drive will suddenly find that it can't read or write them anymore. What this does to the app will vary by app. You will also be leaving the filesystem on that drive in an inconsistant state, and it would be a very good idea to run First Aid against it before using it again.

- Avi



[ Reply to This | # ]
What can go wrong...
Authored by: garbanzito on Apr 26, '02 06:38:21PM

if the volume is a read-only disk image or a CD, then you needn't worry about this.



[ Reply to This | # ]
Hdiutil won't unmount
Authored by: skydiver on Mar 21, '04 09:05:42AM

I seem to have a pooched partition on my drive. I try to fix or re-format it, Disk Utility tells me that it is in use, and can't unmount it.

When I run hdiutil to try to force the eject, I get this message:

"hdiutil: detach: "disk1s9" failed to unmount due to error 22 (dissenter -1)."

This is a big problem since it's my main OS X partition on this drive! I can't even re-partition or re-format the complete drive, since it simply won't un-mount the drive.

I run df, and it shows the volume, but fstat or lsof does not show that the volume is even in use!

I tried starting up with OS 9.2.2, but it seems to hang at startup, like it's trying to wait for this volume to open. When I have the drive in an external firewire port, I can start it up after booting, but Disk Setup says that it can't initialize it.

Any ideas how to fix this?


---
Blue Skies,
Tak



[ Reply to This | # ]
Wiping out your entire hard drive
Authored by: akejay on Mar 21, '04 10:05:14AM
The following is dangerous - proceed cautiously! Backup and/or disconnect all important devices before doing this! How to clear your entire primary drive and get it ready for repartitioning: 1. Boot the Mac OS X CD (hold C) 2. Go into single-user mode (hold Option-S) 3. Run these commands:

dd if=/dev/zero of=/dev/rdisk0 bs=1k count=1k
pdisk /dev/rdisk0 -initialize
reboot
4. Boot the Mac OS X CD (well, it happens by default now) 5. Use Disk Utility to partition the drive 6. Proceed with the installation as normal If you feel lucky, you can also edit the map (partition table) of /dev/rdisk0 interactively by just running "pdisk" and using the prompts. Have fun, - Jake

[ Reply to This | # ]
Force dismount a stuck volume
Authored by: fearless on May 20, '05 07:26:29PM
Is invoking df really necessary? From the help screen, in Tiger:
G4:~ peter$ hdiutil eject -help
        eject is a synonym for detach...
hdiutil detach: detach disk image from system
Usage:  hdiutil detach 

       Note: you can specify a mount point (e.g. /Volumes/MyDisk)
              instead of a dev node (e.g. /dev/disk1)

        Options:
            -force              forcibly detach

        Common options:
            -verbose
            -debug
            -quiet


[ Reply to This | # ]
Try to do it the right way
Authored by: simplebeep on May 03, '09 07:04:23AM
I could not live without What's Keeping Me. You type in the name of the volume you need to eject, and it tells you which processes are "keeping it" tied down to your system. That way, you can find the problem, and hopefully resolve it in a civilised way. Then bring out hdiutil.

[ Reply to This | # ]