sd, sd, who's got the sd - f7 work required before release!

Styma, Robert E (Robert) stymar at alcatel-lucent.com
Mon Apr 30 17:00:56 UTC 2007


 
> 
> Hm.  Did you try before this 'man -k label'?  On a resulting list
> it is not difficult to notice entries like:
> 
> e2label              (8)  - Change the label on an ext2/ext3 
> filesystem
> findfs               (8)  - Find a filesystem by label or UUID
> mlabel               (1)  - make an MSDOS volume label
> 
> If you will peek at 'e2label' you will notice too:
> 
...

The following perl script will list all the labels for a machine.

------------------------- start after here
------------------------------ 
#!/usr/bin/perl
use strict;

my   @proc_partitions;
my   @fdisk_out;
my   $p;
my   $line;

@proc_partitions = `cat /proc/partitions`;

foreach $p (@proc_partitions)
{
   chomp($p);
   $p =~ s/.* //;
   next if $p eq "name";
   next if $p eq "";
   if ( $p =~ m/...[0-9]/ )
   {
      #partitions like /dev/hda1 or /dev/sda1 end up here
      $line = `blkid /dev/$p`;
      # You can massage the output from blkid to your liking.
      print "$line";
   }
   else
   {
      # Devices like /dev/hda or /dev/sda end up here
      # print "device: $p\n";
   }
}
------------------------- end before here ------------------------------






More information about the fedora-test-list mailing list