Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: (OT) how to identify a partition

by mr_mischief (Monsignor)
on Apr 18, 2008 at 16:12 UTC ( #681546=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://681546]
help
Chatterbox?
and the radiator hisses contentedly...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2018-05-26 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?