You are not logged in.

#1 2010-01-27 21:31:09

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

[mlabel] only capital letters supported? [solved]

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

#2 2010-01-27 22:21:44

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [mlabel] only capital letters supported? [solved]

Use 'dosfslabel' from the dosfstools package instead of mtools.

Offline

#3 2010-01-27 22:30:57

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [mlabel] only capital letters supported? [solved]

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

#4 2010-01-27 23:55:13

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [mlabel] only capital letters supported? [solved]

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

#5 2010-01-28 08:25:47

xduugu
Member
Registered: 2008-10-16
Posts: 292

Re: [mlabel] only capital letters supported? [solved]

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

#6 2010-01-28 12:26:47

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [mlabel] only capital letters supported? [solved]

Hello xduugu,

you were right. It's not a problem of the udev rule but of fat32 in general. It only supports capital letters in labels. So thank you two, the topic is solved. smile

Offline

Board footer

Powered by FluxBB