After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 338528 - Implement reading and writing volume-labels
Implement reading and writing volume-labels
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.2.4
Other Linux
: Normal enhancement
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
: 358626 467922 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-04-14 19:48 UTC by gbz
Modified: 2008-04-08 17:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
kind of labels (638 bytes, text/plain)
2006-06-18 09:56 UTC, Laurent de Trogoff
  Details
label seen from FC5 (61.49 KB, image/jpeg)
2006-06-18 10:22 UTC, Laurent de Trogoff
  Details
Read labels on mounted xfs partitions (525 bytes, patch)
2008-03-04 13:55 UTC, Gerard Neil
none Details | Review

Description gbz 2006-04-14 19:48:55 UTC
Can there be a possibility to view and set volume-labels? I.e. labels of the type discussed in Bug 321035, that can be set with the tune2fs utility.
Comment 1 Plors (Bart H) 2006-04-14 20:04:43 UTC
good point, i think libparted supports this, so it shouldn't be that hard to implement.
Feel like writing a patch? ;-)
Comment 2 gbz 2006-04-14 20:33:55 UTC
I could try. But I found nothing on "label" in parted-1.6.25/API that didn't treat disk labels (partition tables).
Comment 3 Plors (Bart H) 2006-04-14 20:59:46 UTC
I'm not sure, but maybe this might help you..

int ped_partition_set_name (PedPartition* part, const char* name)
const char* ped_partition_get_name (const PedPartition* part)
ped_disk_type_check_feature (part->disk->type, PED_DISK_TYPE_PARTITION_NAME);

How should we implement this from a user POV? maybe just as an editable cell in the treeview?
Comment 4 Plors (Bart H) 2006-04-15 13:01:08 UTC
i did a little testing today and it seems not all disklabeltypes (e.g. msdos and sun) support volume-labels (called 'partitionnames' in parted interface).
Comment 5 Laurent de Trogoff 2006-06-18 09:56:33 UTC
Created attachment 67560 [details]
kind of labels

i 'm interesting to about label. i add attachement about the commands that give me the label of each fs
Comment 6 Laurent de Trogoff 2006-06-18 10:00:34 UTC
and to know or change a ext label it is of course : e2label
-> e2label /dev/hdaX returns the label of the partition
Comment 7 Plors (Bart H) 2006-06-18 10:07:08 UTC
thanks for the info, it's on my TODO :)
Comment 8 Laurent de Trogoff 2006-06-18 10:22:48 UTC
Created attachment 67562 [details]
label seen from FC5

clicking on icon "computer" on my FC5, i can see all the labels of my disks...
Comment 9 Plors (Bart H) 2006-09-06 07:39:58 UTC
can one of you provide the commands necessary to read and set labels on all the supported filesystems?
This would greatly reduce the time it will take to implement this.

e.g.
ext2: e2label device [newlabel]

etc...

thanks!
Comment 10 Laurent de Trogoff 2006-09-06 07:55:35 UTC
Here is what i have in my personal doc-site :

-------------------
To give a label to a swap part' :
mkswap -L <label> /device (---> see man page)

---------------------
To give a label to NTFS part':
ntfslabel /device <newlabel>(---> comes with ntfsprogs ;  see man page)

--------------------
To give a label to a vfat partition :

To give a label at creation : mkfs.vfat -n thename /device

------------------
EXT2/3 : 
e2label /dev/hdaX -------------> returns label name
e2label /dev/hda NOM------> change the label name
Comment 11 Plors (Bart H) 2006-09-06 08:09:22 UTC
great!
now we have:

swap, ext2/3, ntfs, fat16/32

we still need: reiser3/4, xfs, jfs, hfs(+), ufs


Comment 12 Laurent de Trogoff 2006-09-06 09:15:11 UTC
BTW : if you want to change the label AFTER the partition is created, it is a bit different, and you need mtools installed.
Look there : http://ubuntu.wordpress.com/2006/03/01/editing-fat32-partition-labels-using-mtools/
 :
editing mtools,
adding a line : drive [letter]: file="/dev/hdXY" 
        (e.g. : drive c: file="/dev/hda1")

and then : mlabel c:newlabel
Comment 13 Plors (Bart H) 2006-09-06 09:27:47 UTC
ok, but this only goes for fat filesystems. And indeed we want to be able to change the labels of already existing filesystems.
Comment 14 Laurent de Trogoff 2006-09-06 10:57:06 UTC
herhe is what i could get :

---------------------------
mkfs.xfs -L label device
from manpage
-----------------------------
Format 3rd partition on 2nd hard disk with the volume label "JFS_hdb3":

    jfs_mkfs -L JFS_hdb3 /dev/hdb3
from : http://www.die.net/doc/linux/man/man8/mkfs.jfs.8.html

******
mkfs.jfs -L volume_label device
from manpage
------------------------------

mkfs.hfs : http://devrsrc1.external.hp.com/STK/cgi-bin/man2html?debug=0&manpage=/usr/share/man/man1m.Z/mkfs_hfs.1m
-----------------------------

UFS : seems there is no label setting :
http://www.tpu.fi/cgi-bin/man-cgi?mkfs_ufs+1

----------------------------------
Comment 15 Plors (Bart H) 2006-09-12 20:35:59 UTC
ok, i added readonly support, but atm only ext2/3 are supported. What i need is the command to READ the volume-labels from existing filesystems.
As soon as i have these commands i can add support for these filesystem to gparted. I don't have time to find them myself, so it's up to you guys.

good luck! :)
Comment 16 Plors (Bart H) 2006-09-14 08:13:04 UTC
@gbz, tonight i have some time, so if you could do the necessary research (as requested in earlier comments) i can add it tonight.

You requested this functionality in the first place, so it only seems logical you do some work for it as well :)

thnx
Comment 17 Laurent de Trogoff 2006-09-14 13:58:28 UTC
makde some tests : atm it read ext2 labels and one can give label to ext2 !
It cant read ext3 labels ! Neither primary nor logical

(from cvs 060914)
Comment 18 Plors (Bart H) 2006-09-14 14:04:43 UTC
ah yes, i forgot to enable it for ext3 :)
i'll fix this as soon as i get home, thnx for reporting!
Comment 19 Plors (Bart H) 2006-09-14 16:43:34 UTC
ok, fix for ext3 in CVS.

@gbz: please let us know if you don't have time/motivation, then we know we have to do it ourselves.

thanks
Comment 20 gbz 2006-09-14 23:41:27 UTC
Sorry, I read this a little late. You are right of course, although I'm not very technical. I'll check tomorrow.
Comment 21 gbz 2006-09-15 19:32:45 UTC
These are the commands that I found:
reiser3/4	reiserfstune
xfs		xfs_admin
jfs		jfs_tune
hfs(+)		xhfs -> hvol (http://www.mars.org/home/rob/proj/hfs/)

I couldn't find a command for ufs.
Comment 22 Elijah Newren 2006-09-30 22:20:23 UTC
*** Bug 358626 has been marked as a duplicate of this bug. ***
Comment 23 Plors (Bart H) 2006-10-01 13:12:09 UTC
implemented is reading of label for all filesystems, except:
- fat16/32
- hfsplus
- linuxswap
- ufs

i hope one of you has the time to find out which commands/libraries to use to read the label from these filesystems.

thnx!
Comment 24 fdupoux 2006-12-12 20:31:34 UTC
If you want to read FAT16 / FAT32 labels and you don't want to depond on mtools, here are my comments:
- what about dosfstools ?
- for FAT16, that's very easy. The label is a string stored in a fixed offset in the bootsector of the fat16. It is limited to 11 chars. You just have to open the partition file and read 11 bytes at the offset 0x2b. Have a look at this: http://en.wikipedia.org/wiki/File_Allocation_Table
- for FAT32 that's really more difficult. The fat16 bootsector remains but the label written in the bootsector must be ignored. The partition label is stored as a special file. We need to write a lot more code, in order to be able to read a simple file. It's quite a big job because you have to read the FAT32 allocation table, and find when this special file is stored. But this is not so hard to write.
Comment 25 Plors (Bart H) 2006-12-18 21:15:26 UTC
thanks for your comments!

I don't think dosfstools can read to volumelabel, however i could be mistaken. As soon as i have time i'll have a look at the fat stuff :)

btw, if you have time and motivation i would welcome a patch :)
Comment 26 Curtis Gedak 2008-02-12 21:36:46 UTC
I've made an astonishing discovery.

The e2fsprogs package contains a utility called "blkid".  The "blkid" utility appears to be able to locate and print out the LABEL and UUID for most any partition type!

Just try typing in "blkid", and it will search all devices for NAME="value" pairs.

This will aid greatly in reading partition labels.
Comment 27 Gerard Neil 2008-03-04 13:55:37 UTC
Created attachment 106552 [details] [review]
Read labels on mounted xfs partitions

This patch allows reading labels on mounted xfs partitions... without the '-r' option, xfs_db will always fail on a mounted partition.
Comment 28 Curtis Gedak 2008-03-04 14:59:44 UTC
Gerald, thank you for the tip about the xfs_db -r flag.  I have added it to the SourceForge repository for inclusion in the next release.
Comment 29 Curtis Gedak 2008-03-26 14:10:59 UTC
*** Bug 467922 has been marked as a duplicate of this bug. ***
Comment 30 Curtis Gedak 2008-03-26 14:13:13 UTC
Volume label support has been added to GParted and checked into the new Source Forge code repository.

Full partition label (read and write) is available for the following file systems:  ext2, ext3, fat16, fat32, jfs, ntfs, reiserfs, and xfs.
Partial support (set volume label on filesystem creation) is available for: hfs, linux-swap, and reiser4.

New Dependencies (Optional):
Fat16 and fat32 requires mtools for full volume label support.
Linux-swap requires vol_id command to read volume labels.
Comment 31 Federico Muciaccia 2008-04-06 22:46:10 UTC
Good work!
It's a very useful feature.
I would only report that the "change label" window have a minor problem: 
the label field partially covers the button under it.
I'm using a murrina theme in Debian GNU/Linux
Again congratulations

Regards
Federico
Comment 32 Curtis Gedak 2008-04-08 17:13:53 UTC
Federico, thank you for the note about the label field partially covering the buttons under it.  I will increase the size of this dialog box.