Getting hard drive serial number from USB devices
Madison Kelly
linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Mon Jan 16 22:22:43 UTC 2006
Lennart Sorensen wrote:
> On Mon, Jan 16, 2006 at 04:25:13PM -0500, Madison Kelly wrote:
>> Currently I use the 'UUID' of a partition as assigned by 'blkid' and
>> that works fine with a few exceptions. Those exceptions are the cases I
>> am trying to work around. Specifically;
>>
>> - The UUID of a permission changes if that partition is reformatted.
>> - No UUID is assigned to some file systems (ie: NTFS).
>
> Hmm, I thought NTFS also had a 32bit ID like FAT does.
It may, but if so I don't know where to find it. I was hoping to not
need to find out... :p
>> - On some file systems 'blkid' assigns a generic '0000-0000' UUID (ie:
>> 'vfat' on digital cameras).
>
> Well what can you do on those cameras. :) I suppose you could always
> assign one to it whenever you see 0000-0000 since it was obviously
> formated by a brain dead device and ought to be fixed.
>
> I thought you were using it to identify backup targets, not backup
> sources.
Yeah, my program tracks source and destination devices so that it can
identify their data regardless of where (or even if) they are mounted. I
don't know why someone would assign something like a digital camera as a
source device but I don't want to prevent that feature, if I can.
>> Being a backup program I want to, ideally, support all file systems.
>> This is why reading the serial number would be so ideal; I could create
>> a (slightly modified) MD5 hash of the drive's serial number +
>> partition/slice number to create a file system agnostic, portable ID.
>
> But a drive with multiple partitions would still be a problem then. The
> drive serial number is not a solution either.
How so? If the person changes the number or partitions then yeah, the
missing ones will be toast (as is the case currently when a partition is
reformatted) and new ones will be unassigned but it is still a more
stable setup than relying in the UUID alone.
Of course I could be missing something, too. ^.^;
>> If I *can't* get the serial number over a USB interface (as seems to
>> be the case now), then I need to find another method to uniquely
>> identify a physical disk. The problem is, often people who use my
>> program will buy a bunch of disk drives at once, often only in a series
>> of serial numbers. So relying on things like the model number or date
>> code would also be troublesome.
>>
>> Gah!
>>
>> Why couldn't disk drive manufacturer's put a small sector or two
>> aside with the information always available and outside the view of the
>> rest of the disk space? That would be sooooo nice!
>
> No one prevents anyone from doing that. Try convincing existing users
> to change their disk setup after the fact though. :)
>
> Len Sorensen
Oh heck, asking users to alter their partitions for my program is
*very* much not an option. Heck, I don't even want to "sign" their disks
with a small file, if I can avoid it. Anything that requires altering a
user's existing partition is /any/ way is a *very* last resort. I've
always work on the philosophy that my program should only ever modify a
destination device and even then, do so only to store source data.
Madison
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Madison Kelly (Digimer)
TLE-BU; The Linux Experience, Back Up
Main Project Page: http://tle-bu.org
Community Forum: http://forum.tle-bu.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list