Comment 12 for bug 388207

Revision history for this message
Aleve Sicofante (sicofante) wrote :

>>is the volume naming something standard or something which needs to understand the filesystem in use?
Non-standar. That's why there's step #3 in my proposed solution.

>> is there any system api to do that or only command line tools?
There's probably both. My solution relies on command lines only, so it can be used in a simple script. Here are the command lines needed:

To check file system type: mount or fdisk
To change label:
- For FAT16 and FAT32 partitions, use mtools.
- For NTFS partitions, use ntfsprogs.
- For ext2, ext3, or ext4 partitions, use e2label.
- For JFS partitions, use jfs_tune.
- For ReiserFS (v3) partitions, use reiserfstune.
- For XFS partitions, use xfs_admin

(from https://help.ubuntu.com/community/RenameUSBDrive)

If you're asking yourself why I don't go ahead and code it myself: I was a programmer like 20 years ago. I knew my system well (IRIX) and I knew my languages well (C and C-shell), but I've been away from programming for more than 15 years. That's why I sort of "know" my solution is possible and workable. However I don't see myself doing it because my knowledge of Linux and bash programming is very limited and my practice is non-existent.

Now that I think of it, before step #1 there's actually a step #0 required: check if the action is being done on a file or a file system. Renaming files is directly supported by Nautilus. In that case no need to replace the default action for "Rename". If it's a file system, then go ahead with the script to change the disk label.