GNOME Bugzilla – Bug 338528
Implement reading and writing volume-labels
Last modified: 2008-04-08 17:13:53 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.
good point, i think libparted supports this, so it shouldn't be that hard to implement. Feel like writing a patch? ;-)
I could try. But I found nothing on "label" in parted-1.6.25/API that didn't treat disk labels (partition tables).
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?
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).
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
and to know or change a ext label it is of course : e2label -> e2label /dev/hdaX returns the label of the partition
thanks for the info, it's on my TODO :)
Created attachment 67562 [details] label seen from FC5 clicking on icon "computer" on my FC5, i can see all the labels of my disks...
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!
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
great! now we have: swap, ext2/3, ntfs, fat16/32 we still need: reiser3/4, xfs, jfs, hfs(+), ufs
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
ok, but this only goes for fat filesystems. And indeed we want to be able to change the labels of already existing filesystems.
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 ----------------------------------
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! :)
@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
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)
ah yes, i forgot to enable it for ext3 :) i'll fix this as soon as i get home, thnx for reporting!
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
Sorry, I read this a little late. You are right of course, although I'm not very technical. I'll check tomorrow.
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.
*** Bug 358626 has been marked as a duplicate of this bug. ***
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!
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.
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 :)
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.
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.
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.
*** Bug 467922 has been marked as a duplicate of this bug. ***
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.
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
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.