Re: Ejecting An Image Disk
Re: Ejecting An Image Disk
- Subject: Re: Ejecting An Image Disk
- From: Axel Luttgens <email@hidden>
- Date: Fri, 31 Oct 2008 17:53:28 +0100
Le 31 oct. 08 à 15:29, Luther Fuller a écrit :
On Oct 31, 2008, at 8:26 AM, Axel Luttgens wrote:
do shell script "umount -f /dev/disk1s2; hdiutil detach /dev/disk1"
This illustrates a problem with the hdiutil man page. According to
the man page, there is a difference between 'umount' and 'detach',
but it's not clear, at least to me, exactly what the difference is.
A disk image is just a plain file (or a set of files, in the case of
sparse bundles) on one's disk.
That file must first be interpreted so that it may be viewed as a
device by the rest of the system, like any other physical disk.
Once this is done, the volume(s) on that pseudo-disk, if any, may be
mounted.
I think I will stick with telling the Finder to detach, since it's
the simplest code.
I have searched for info on hdiutil having illustrative techniques,
but found none. Usually, I just arrive at the man page again. I need
a tutorial on hdiutil which presents and explains technique.
The question I really need solved is: Why does 'hdiutil
imageinfo ...' refuse to return a disk image file's meta-data if the
file is encrypted or it's disk is mounted? This seems buggy to me,
but I'm not an expert.
Be reassured: nor am I. ;-)
So, I'll just guess.
Let's first consider the problem of hditutil -imageinfo applied to a
disk image having at least one mounted volume.
If that volume is R/W, items on that volume are liable to be changed/
created/deleted at any time from other parts of the system; this means
that the disk image itself is liable to be continuously modified.
hditutil thus needs to somehow freeze the disk image for a short time,
so as to extract the needed info, a *consistent* info, from the disk
image.
If you experiment with the -debug flag, you'll notice that hdiutil
resolves that problem by attempting to acquire a lock on the disk image.
This will always be successful when the disk image is R/O.
But this will (almost) always fail when the disk image is R/W.
The reason it seems buggy is its illogic ... the meta-data for a
disk image file contains the information
Properties:
Encrypted: false (or true)
but if Encrypted = true, you can't get the meta-data. And you can't
get the meta-data if the disk is mounted, either. You can workaround
this, but you have to eject the disk first.
The reason here seems to be that the "meta-data" itself is encrypted
(just do an hexdump on an unencrypted disk image, and compare to what
comes with an encrypted one).
From the point of view of security, this seems to be reasonable: it
would otherwise be possible to directly tamper with the disk image,
without having the fact noticed by the legitimate owner of that disk
image.
But of course, the password is then needed to fetch even the "meta-
data".
HTH,
Axel _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden