Re: How to eject a USB Hard drive
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com --- At Fri, 18 Jan 2008 12:05:48 +0530, Elango C wrote:
Duane,
I tried with "unmountdisk" but the device is not getting removed from Mac.
I'm not sure what you are expecting to happen then. diskutil unmountdisk disk1 will unmount the disk and all of it's volumes. You can then safely remove the disk. If all of the volumes do not unmount then there is a file open on that volume and the disk cannot be safely unmounted. USB drives and FireWire drives are slightly different with unmountdisk. USB will/should unmount and be gone from the system. In order to remount you have to remove the cable and replug the cable. FireWire drives stay in the system and can be remounted. This has been my experience primarily with USB flash drives. I haven't tried USB hard drives in a long while so I don't recall if they work the same way.
Can you give me some code reference for this DiskArbitration to proceed.
#include <DiskArbitration/DiskArbitration.h> There is minimal documentation but if you Google a bit, you can find some examples.
On Jan 18, 2008 11:28 AM, Duane Murphy <duanemurphy@mac.com> wrote: --- At Fri, 18 Jan 2008 11:18:24 +0530, Elango C wrote:
Hello,
I am currently trying to eject the USB Drive by writing a small carbon application. Can you guys can give me some idea.
FYI: I tried calling the Diskutil using System call
system ("diskutil eject disk1");
but the volume present in the disk1 gets unmounted but the device is not getting ejected. ( i.e. After doing this If I open the Diskutilty application I am able see the USB HDD entry) but if I click on the eject button from the Diskutilty then the entries are disappeared from the diskutility app.
Dear guys please help me on this issue.
Try unmountdisk instead of eject.
You can do all this from the DiskArbitration framework as well.
...Duane -- "Design is an interplay of science and art - the instinct of using exactly the right methods and resources that the application requires." - Bernard Friedland, "Control System Design" _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Duane Murphy