http://www.perlmonks.org?node_id=681549


in reply to (OT) how to identify a partition

I am not sure that I understood what you need but maybe Sys::Filesystem fits your needs.

Update:
After you specified your question this could be helpful
#!/usr/bin/perl -w # # use strict; my $partitions = `hdparm -i /dev/hda|grep Model`; my ($model,$firmware,$serial_no)=split /,/,$partitions; my @model = split /=/,$model; my @serial_no=split /=/,$serial_no; my @firmware=split /=/,$firmware; print "Model = $model[1]\tFirmware=$firmware[1]\tSerial No=$serial_no[ +1]\n";
The script must be run with root priviliges. If you use sudo you can use
my $partitions = `sudo hdparm -i /dev/hda|grep Model`;

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

    Sys::Filesystem is a little bit helpful, yes.

    Your suggestion hdparm is spectacularly useful. I can get a serial id off the drive this way! This helps identify a drive, marvelously.

    I'm still looking into identifying an actual partition. I have a hack to identify a filesystem, via the filesystem. But there must be something in the fs format that has this as well.

    Thank you, very useful!