Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have formatted a firewire hard drive with the following command:
/sbin/mkfs.msdos -F 32 -I /dev/sdb -n TEST_VOLUME
It formats correctly and when mounted on Windows or
Mac OS X correctly displays the label TEST_VOLUME.
However, I have not been able to find a way to access the
volume name on Linux.
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
What do you mean you want to access the volume name? Do you
want to be able to mount the disk using the volume name, or do you
want to be able to find out what is the volume name after it's been
mounted?
The latter--after it's mounted I would like to be able to
display the volume name in a Java app, so either a Unix
command or a C program that can print it would be fine.
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304
Rep:
cfdisk will show a volume label, but i don't
know how to get it to list the info and exit.
I guess you could get the source take out
the part you want.
After much Googling and testing I came up with a solution that
does the job and seems fairly clean. The key is the mlabel
command, but rather than hardcoding every possible device
name into the mtools config file I create one on the fly that
defines only the device I'm interested in at the time I run the
commands. The following demonstrates the idea:
BTW, if anyone is interested, the volname command can
be used to print the label for an ISO-9660 filesystem and
e2label prints the label for an ext2 filesystem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.