Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This 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.


  Search this Thread
Old 01-08-2003, 06:12 PM   #1
LQ Newbie
Registered: Jan 2003
Location: Boulder, CO
Distribution: RH 7.1, RH 8.0
Posts: 3

Rep: Reputation: 0
Problem displaying MSDOS volume name

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.

Anyone know the magic incantation?

Old 01-08-2003, 07:02 PM   #2
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 49
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
Old 01-09-2003, 10:18 AM   #3
LQ Newbie
Registered: Jan 2003
Location: Boulder, CO
Distribution: RH 7.1, RH 8.0
Posts: 3

Original Poster
Rep: Reputation: 0
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.
Old 01-09-2003, 09:20 PM   #4
Senior Member
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,187

Rep: Reputation: 53
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.
Old 01-10-2003, 07:43 PM   #5
LQ Newbie
Registered: Jan 2003
Location: Boulder, CO
Distribution: RH 7.1, RH 8.0
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for the suggestion.

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:

cat > /tmp/mtools.conf << EOF
drive c: file="/dev/sdb1"
mlabel -s c: | awk '{ print $4 }'
rm /tmp/mtools.conf

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem displaying Bash array values. shinobi59 Programming 3 01-17-2006 06:45 PM
idesk problem - icons not displaying right cs-cam Linux - Software 0 01-21-2005 08:08 PM
Problem displaying KDE. Running on a Compaq 1800t Xoliath Linux - Laptop and Netbook 1 10-13-2004 04:07 PM
php4 problem _ downloading index.php instead of displaying tharris Debian 2 10-24-2003 07:13 PM
Problem with Displaying 8/24bit XWD Images yrraja Programming 2 04-22-2003 06:33 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration