fdisk and labels

Trapper trapper at ledduk.net
Mon Oct 20 13:38:11 UTC 2008


Aldo Foot wrote:
> On Sat, Oct 18, 2008 at 8:42 AM, Trapper <trapper at ledduk.net> wrote:
>>
>> Michael Schwendt wrote:
>>> On Fri, 17 Oct 2008 19:01:30 -0700, gary artim wrote:
>>>
>>>> On Fri, Oct 17, 2008 at 10:50 AM, Trapper <trapper at ledduk.net> wrote:
>>>>> Somewhere along the line I saw a small script that provides a display of
>>>>> label information as a part of "fdisk -l" results. My searches have
>>>>> proved
>>>>> fruitless. Anyone recall such a script?
>>>>>
>>>> do you mean /sbin/e2label /dev/yourdevname
>>> or /sbin/blkid
>>>
>>> Both are not part of fdisk -l results, though. ;)
>>>
>> What I mean is this:
>>
>> When I "fdisk" -l I get:
>>
>> /dev/sdb1      1         338     2714953+  82  Linux swap
>> /dev/sdb2   *  339        5560    41945715   83  Linux
>> /dev/sdb3      5561       12087    52428127+  83  Linux
>>
>> There's a crafty little script running around somewhere that gives you the
>> fdisk readout plus the partition labels when you run it:
>>
>> /dev/sdb1      1         338     2714953+  82  Linux swap
>> /dev/sdb2   *  339        5560    41945715   83  Linux    Fedora9-32
>> /dev/sdb3      5561       12087    52428127+  83  Linux   Fedora9-64
>>
>> I "think" someone provided this in the web forum but I've been unable to
>> locate it.
>>
>> Trapper
>>
> 
> The "mount -l" command gives you all the info you want, not in nice format.
> The next command is just one way of doing it:
> 
>> mount -l | grep dev | egrep -v 'tmpfs|pts' | awk '{print $1"\t" $3"\t" $5"\t" $6"\t" $7}'
> 
> the output gives you the device name, mount point, fs type, mount
> options and filesystem label if it exists.
> 
> To label a partition use "e2label /dev/sdaX myLabel".
> The e2label man page has more info.
> 

Well, mount -l gives me output but mount -l | grep dev | egrep -v
'tmpfs|pts' | awk '{print $1"\t" $3"\t" $5"\t" $6"\t" $7}' gives me
nothing at all.

As for e2label, I've been using it for years and have no difficulty
actually labeling partitions. My desire here is to get a listing of all
dev labels on all hd's on the machine.

As someone suggested, I tried /sbin/blkid. Results are mixed. It appears
that it also provides previous and now nonexistent partition information.

Whatever, I am still searching the old web forum threads to see if I can
locate the script I am wanting.

I also woke up and installed the gnome gui of gparted. That provides me 
with the label info for all hd's. Would be nice if fdisk was designed 
with the same function to list dev labels though.

Thanks all,
    Trapper




More information about the users mailing list