Re: Unique Identifier for Disk
Re: Unique Identifier for Disk
- Subject: Re: Unique Identifier for Disk
- From: Michael Bartosh <email@hidden>
- Date: Thu, 29 Apr 2004 06:35:42 -0600 (MDT)
On Thu, 29 Apr 2004, Jeffrey Berman wrote:
>
On 4/29/04 3:47 AM, Michael Ziober <email@hidden> wrote:
>
>
> On Wed, 28 Apr 2004 20:18:41 -0500, Jeffrey Berman
>
> <email@hidden> wrote:
>
>
>
>> On 4/28/04 2:42 PM, "John C. Welch" <email@hidden> wrote:
>
>>
>
>>> On 4/28/04 1:47 PM, "Jeffrey Berman" <email@hidden> wrote:
>
>>>
>
>>>> At least on my system (OS X 10.2.8), the help text from the 'hfs.util'
>
>>>> command does not list a -k option and the command returns nothing when I
>
>>>> use it with a device file name. For example, the main partition of my
>
>>>> startup disk is associated with the device file "disk0s9" but the command:
>
>>>>
>
>>>> /System/Library/Filesystems/hfs.fs/hfs.util -k disk0s9
>
>>>>
>
>>>> does not return anything.
>
>>>
>
>>> Try that with a sudo
>
>>
>
>> Still no luck. The command:
>
>>
>
>> sudo /System/Library/Filesystems/hfs.fs/hfs.util -k disk0s9
>
>>
>
>> does not return anything.
>
>>
>
>> -Jeffrey Berman
>
>
>
> I am running 10.3.3. The usage information for hfs.util on my system
>
> makes no reference to the -k switch either. It is documented in the
>
> hfs.util(8) man page.
>
>
Yes, it is the same situation on my system running 10.2.8. No -k option
>
listed from help text issued by hfs.util but the option does appear on the
>
hfs.util man page.
>
>
>
> Is it possible that your disk was originally formatted with OS 9?
>
>
No, the disk was formatted with OS X, using some version of 10.2.x.
>
>
>
> Device identifiers are assigned dynamically. The startup volume is
>
> disk0. Additional volumes are assigned as needed: disk1, disk2, diskN.
>
> If you eject them and then mount them in a different order, they will
>
> have different device identifiers, but the UUIDs will not change.
>
>
Because the particular volume I am trying to track is on the device also
>
containing the startup volume, it sounds like the relevant disk device file
>
will always start with "disk0". If the minor number representing a specific
>
partition remains constant across restarts, the device file name for that
>
volume (e.g., "disk0s10") could serve as an identifier across restarts.
>
>
Then I could depend on getting the current name of the disk object for use
>
in AppleScript with:
>
>
do shell script "df -t hfs | awk -F/ '/disk0s10/ {print $5}'"
>
>
As long as the focus is on disk objects on the same physical disk as the
>
startup disk, does anyone see a flaw in using this approach as a way to
>
identify a disk in AppleScript even if the name of the disk changes?
>
>
>
> Here is what I get on my system with an internal drive, external
>
> FireWire drive, and three disk images:
>
>
>
> df -t hfs | tail +2 | sed -e 's|^/dev/||' | while read d b u a c m; do
>
> x=$(/System/Library/Filesystems/hfs.fs/hfs.util -k "$d"); echo "$x $m";
>
> done
>
> DCDD2EEB67C3E568 /
>
> 857B4FD1CA49F3B7 /Volumes/Fantom 120
>
> 44C5C87063BF8427 /Volumes/Themes
>
> F3489772D542BC37 /Volumes/Resources
>
> ED2834C2BE41B7E1 /Volumes/Sparse
>
>
On my machine, these commands return just the mount points for the volumes
>
without any UUID values.
>
>
>
> As an aside, I don't see any reason to use sudo as hfs.util is
>
> generally executable:
>
>
>
> ls -l /System/Library/Filesystems/hfs.fs/hfs.util
>
> -rwxr-xr-x 1 root wheel 43848 17 Apr 15:23
>
> /System/Library/Filesystems/hfs.fs/hfs.util
>
>
Yes, there is no warning when issuing the command without sudo. And whether
>
or not sudo is used, the command returns just the mount points.
In 10.2 I definitely had to use sodo. In 10.3 I never tested w out it.
:-)
>
>
-Jeffrey Berman
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.