Re: Unique Identifier for Disk
Re: Unique Identifier for Disk
- Subject: Re: Unique Identifier for Disk
- From: Michael Bartosh <email@hidden>
- Date: Wed, 28 Apr 2004 08:44:28 -0600 (MDT)
On Wed, 28 Apr 2004, Jeffrey Berman wrote:
>
On 4/27/04 3:59 AM, Michael Ziober <email@hidden> wrote:
>
>
> On Mon, 26 Apr 2004 22:15:20 -0500, Jeffrey Berman
>
> <email@hidden> wrote:
>
>
>
>> One could get the disk name associated with "disk0s10" (and eliminate
>
>> the
>
>> grep pipe) using the following:
>
>>
>
>> df | awk -F/ '/disk0s10/ {print $5}'
>
>>
>
>> However, getting the disk name this way is not of much use unless the
>
>> associated device file name in the /dev directory is unique across
>
>> restarts.
>
>>
>
>> Does anyone know if this is the case?
>
>>
>
>> -Jeffrey Berman
>
>
>
> No, the device entry is not guaranteed to be the same across restarts.
>
> Internal drives (other than the startup drive) may spin up and be
>
> identified in a non-deterministic order. Removable media (flash memory
>
> devices, optical discs, etc.) may be present or absent. External
>
> devices (FireWire and USB drives) may be powered up or not. After boot,
>
> devices may be unmounted and remounted in a different order (Disk
>
> Utility). Disk images may be mounted and unmounted. All the while
>
> device identifiers are being dynamically assigned and revoked.
>
>
>
> But HFS formatted hard drives are assigned a unique identifier when
>
> they are formatted.
>
>
So are the device file names associated with HFS-formatted drive partitions
>
unique across restarts? Or is this "unique identifier" located elsewhere?
>
>
>
> For example, the following bash pipeline displays
>
> the unique identifier and mount point for all locally mounted volumes:
>
>
>
> 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
>
Yeah I noticed this wasn't totally portable last night.
The point is valid though:
mab9718:~ mbartosh$ sudo /System/Library/Filesystems/hfs.fs/hfs.util -k
disk0s9378711D88579000Amab9718:~ mbartosh$
>
At least on my machine, this code returns the volume mount points but not
>
any "unique identifier" values.
>
>
-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.