LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-27-2014, 10:25 PM   #1
ghborrmann
Member
 
Registered: May 2004
Location: Louisville KY
Distribution: Fedora 25
Posts: 32

Rep: Reputation: 0
Multiple Volume Labels for Usb Stick FAT System?


Can anyone explain to me how to deal with the fact that there are at least two different volume labels for FAT systems on Usb Sticks? One is displayed by blkid and dosfslabel, while the other shows up in gparted and cfdisk. The second one is the one displayed in Windows7 under the disk's properties. The fact that Linux is not consistent means that any time I need to use a volume label I can't be sure which one is required or how to create it.

I found where the first label is stored: it is in the first sector of the partition, just where it was on floppy disks many years ago. However, I haven't been able to locate the second label as yet.
 
Old 10-28-2014, 04:23 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by ghborrmann View Post
Can anyone explain to me how to deal with the fact that there are at least two different volume labels for FAT systems on Usb Sticks?
I'm not sure, but I think that's a misunderstanding on your side. FAT file systems can have a volume label (but that's optional), and they have a volume serial number (which is mandatory). The volume serial number, introducewd with DOS 4.0, is a 32bit number chosen randomly when the file system is created. It's stored somewhere in the first 100 bytes of the partition's boot sector. Years ago, I used to know by heart where all that stuff is, but that useless knowledge has faded.

Quote:
Originally Posted by ghborrmann View Post
One is displayed by blkid and dosfslabel, while the other shows up in gparted and cfdisk.
In my test case, dosfslabel and gparted display the same - the traditional DOS volume label which can be set and changed anytime, or an empty string if the partition has no volume label. However, gparted always displays the volume serial number, too.

Quote:
Originally Posted by ghborrmann View Post
The second one is the one displayed in Windows7 under the disk's properties.
That would be the volume serial number, I guess.

Quote:
Originally Posted by ghborrmann View Post
The fact that Linux is not consistent means that any time I need to use a volume label I can't be sure which one is required or how to create it.
For all I know, Linux uses the DOS volume label if one is assigned, and the volume serial number if not.

Quote:
Originally Posted by ghborrmann View Post
I found where the first label is stored: it is in the first sector of the partition, just where it was on floppy disks many years ago.
That's only one place. It's also stored as a directory entry in the root directory with the "volume label" attribute set. Just like all DOS versions since 3.0 did it.

[X] Doc CPU
 
1 members found this post helpful.
Old 10-28-2014, 09:28 PM   #3
ghborrmann
Member
 
Registered: May 2004
Location: Louisville KY
Distribution: Fedora 25
Posts: 32

Original Poster
Rep: Reputation: 0
[SOLVED] Multiple Volume Labels for Usb Stick FAT System?

Part of my confusion was caused by the fact that some of the Linux utilities use the volume serial number if there is no volume label. I have discovered a bug (reported here: URL="https://bugzilla.redhat.com/show_bug.cgi?id=1158101")
in the fatlabel utility. Apparently, fatlabel assumes that the first entry in the root directory is a volume label. If there is no volume label, or if a volume label is not the first entry, fatlabel still tries to interpret the first entry as a volume label, and overwrites the entry if asked to create or change the label.

Based on what I now know, I would strongly recommend avoiding the use of fatlabel to generate a volume label on anything other than a clean system, until this bug is patched.

Thanks for your help.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Booting a USB stick with GRUB2 and Labels ljones0 Slackware 1 02-14-2011 08:53 PM
[SOLVED] Booting from FAT file system on USB stick fwmiller Linux From Scratch 3 11-23-2009 03:39 PM
Mounting FAT fs on usb stick K05T9 Slackware 17 05-06-2007 10:13 PM
Mounting FAT fs on usb stick K05T9 Slackware 8 05-06-2007 07:26 AM
Mount my USB stick (FAT) hyllplan Linux - Hardware 3 11-05-2004 04:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:10 AM.

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