in reply to (OT) how to identify a partition

What drive are you looking to identify, and for what purpose?

You can easily see what partitions are mounted on most Unixes using a command similar to 'mount'. In the case of Linux (with the /proc system in place, at least, which should be true on any general-purpose system), you can read a file called /proc/mounts that gives you that information as well.

Are you looking for the partition device name, the DOS-compatible partition number, the drive's hardware serial number, or what?

Replies are listed 'Best First'.
Re^2: (OT) how to identify a partition
by leocharre (Priest) on Apr 18, 2008 at 16:24 UTC

    Thank you,
    I'm sorry, by identify- I mean track, I mean like.. tattoo it, like.. I want its soul.
    Thus, the basic mount info is useless- if I unplug a drive and plug it into another machine, for example.

    Drive serial number would be useful. I would like to do that via code, instead of busting the dang thing open.

    Getting an ID of the actual fs would be very interesting also- I am guessing some formats keep an id of some sort.

      You could look into hdparm or your could poke through the /proc entries for the hard drives.

      /proc/ide/ide0/hdb/ for instance will have lots of info on the second drive on your first IDE channel. /proc/ide3/hdg/model will have the model number of the first drive on your 4th IDE channel.

      I'm not entirely sure how unique it is, but I think it's partly from the serial number, so /proc/ide/ide0/hda/identify should have some identifying information for the first IDE drive on your first IDE channel. Hopefully it's universally unique.