fdisk and labels

Aldo Foot lunixer at gmail.com
Sat Oct 18 17:27:38 UTC 2008


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.

~af




More information about the fedora-list mailing list