You are not logged in.
Hello guys,
I'd like to change the volume label of my usb drive. It is formated with fat32. I tried the command mlabel -i /dev/sdb1 ::"cnmemory" but I always get the new label name presented in capital letters. In my case as CNMEMORY.
Can't mlabel handle small letters?
Last edited by orschiro (2010-01-28 12:27:15)
Offline
Use 'dosfslabel' from the dosfstools package instead of mtools.
Offline
Hello Gusar,
I tried dosfslabel and "dosfslabel /dev/sdb1" gives me "cnmemory" back. Right the way it should be. But the device is stil mounted as /media/CNMEMORY.
Perhaps this is a problem that occurs because of my udev-rule I use to mount it?
KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid -p %N", GOTO="media_by_label_auto_mount_end"
# Open luks partition if necessary
PROGRAM=="/sbin/blkid -o value -p -s TYPE %N", RESULT=="crypto_LUKS", ENV{crypto}="mapper/", ENV{device}="/dev/mapper/%k"
ENV{crypto}!="?*", ENV{device}="%N"
ACTION=="add", ENV{crypto}=="?*", PROGRAM=="/usr/bin/xterm -display :0.0 -e '/usr/sbin/cryptsetup luksOpen %N %k'"
ACTION=="add", ENV{crypto}=="?*", TEST!="/dev/mapper/%k", GOTO="media_by_label_auto_mount_end"
# Global mount options
ACTION=="add", ENV{mount_options}="noatime,users"
# Filesystem specific options
ACTION=="add", PROGRAM=="/sbin/blkid -o value -p -s TYPE %E{device}", RESULT=="vfat|ntfs", ENV{mount_options}="%E{mount_options},utf8,gid=100,umask=002"
# Get label
ACTION=="add", PROGRAM=="/sbin/blkid -o value -p -s LABEL %E{device}", ENV{dir_name}="%c"
ACTION=="add", ENV{dir_name}!="?*", ENV{dir_name}="usbhd-%k"
ACTION=="add", ENV{dir_name}=="?*", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o %E{mount_options} /dev/%E{crypto}%k /media/%E{dir_name}"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
ACTION=="remove", ENV{crypto}=="?*", RUN+="/usr/sbin/cryptsetup luksClose %k"
LABEL="media_by_label_auto_mount_end"
Last edited by orschiro (2010-01-27 22:31:39)
Offline
No idea, I don't use custom udev rules, I let hal mount my sticks. If dosfslabel doesn't work, then make a backup of the files on the stick and then reformat it, specifying the label on the mkfs.vfat command. Not exactly elegant, but it will work for sure.
Oh, another idea... change the label with dosfslabel to something else, then to what you actually want. Maybe it doesn't get overwritten if you specify the same label just with different casing.
Offline
It's definitely not an issue of the udev rule. Actually, I use devices with lower case labels and even mixed ones every day.
Offline
Offline