Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://681546]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2018-08-15 01:35 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (158 votes). Check out past polls.