Fertiges Skript: https://wiki.ubuntuusers.de/_attachment/?target=Labels%2Fset_msdos_label.sh
Check the current label
sudo mlabel -i <device> -s ::
ex: sudo mlabel -i /dev/sdb1 -s ::
Note that we're using the special "::" drive which allows us to specify the device descriptor on the command line; otherwise we'd have to edit ~/.mtoolsrc to assign a drive letter (see Option 2 under "Change the label").
Option 1
After unmounting and checking the current label (above), use
sudo mlabel -i <device> ::<label>
2x ausführen: sudo mlabel -i /dev/sdb1 ::my_label
Ignore the "Volume label is XYZ" output as this is the old label. Jump to the Verify the Change section below.
Option 2
For Ubuntu 8.10 and up, edit mtools.conf as sudo
sudo nano /etc/mtools.conf
add something like for each drive:
etc.
Then use
sudo mlabel p:new_label
ex: sudo mlabel p:30GB_FAT32
(note the underscore _ should be used, as spaces are not allowed)
http://ubuntuforums.org/showpost.php?p=6356016&postcount=9
Error message
If you get a message like this:
Total number of sectors (7831520) not a multiple of sectors per track (63)!
You can easily ignore the check by running this command:
echo mtools_skip_check=1 >> ~/.mtoolsrc
This filesystem is most often found on external USB and firewire hard drives or other Windows formatted disks. Check the current label
sudo ntfslabel <device>
ex: sudo ntfslabel /dev/sdb1
Change the label
Note: 128 characters maximum.
sudo ntfslabel <device> <label>
ex: sudo ntfslabel /dev/sdb1 my_external
Ubuntu caches the drive's label so to see the full affects of the change it is not enough just to umount and mount it again. You have to umount, remove, put back, mount again.
Check the current label
sudo e2label <device>
ex: sudo e2label /dev/sdb1
Change the label
Note: 16 characters maximum.
sudo e2label <device> <label>
ex: sudo e2label /dev/sdb1 my_external
These filesystems are most often found on IBM and some linux formatted disks. Check the current label
sudo jfs_tune -l <device>
ex: sudo jfs_tune /dev/sdb1
Change the label
Note: 16 characters maximum.
sudo jfs_tune -L <label> <device>
ex: sudo jfs_tune -L my_external /dev/sdb1
This filesystem is most often found on linux formatted disks.
Note: this could work with ReiserFS 4 too, I have not tried. Change the label
Note: 16 characters maximum.
sudo reiserfstune -l <label> <device>
ex: sudo reiserfstune -l my_external /dev/sdb1
This filesystem is most often found on UNIX formatted disks. Check the current label
xfs_admin -l <device>
ex: xfs_admin -l /dev/sdb1
Change the label
Note: 12 characters maximum.
sudo xfs_admin -L <label> <device>
ex: xfs_admin -l my_external /dev/sdb1
Verify the Change
Now for the easiest part: unplug the drive, wait a second, then plug it back in. It should appear on your desktop with the new label and have its new mount point.
Without unplugging and having the device remount, you can also just run:
sudo blkid
Im Editor folgende Zeilen eingeben:
mtools_skip_check=1 drive g: file="/dev/sdc1"
Beenden und speichern. Nun sind wir endlich(!) so weit, dass wir, wie weiland unter MS-DOS, die Datenträgerbezeichnung ändern können.
DEVICE=/dev/sdb1 echo -n "stick01 "|dd bs=1 seek=71 count=11 of=$DEVICE;echo -n "$NAME"|dd bs=1 seek=71 count=11 of=$DEVICE
Was macht diese Befehlszeile? Zunächst wird die Stelle, wo das Label gespeichert ist, mit Leerzeichen uberschrieben, um eventuelle vorherige Labels zu löschen. Danach wird das neue Label in den Bereich geschrieben. die Angabe “count=11″ sorgt dafür dass höchstens 11 Zeichen geschrieben werden, da das Label nicht länger sein darf. So wird die Bezeichnung im Zweifelsfall abgeschnitten wodurch verhindert wird dass die Daten nach der Label-Position zerstört werden.