1

Topic: FAT32: Use dosfslabel from dosfstools

Package dosfstools is required for formatting and checking FAT32 file system. For changing label is needed mlabel utility from mtools package. But dosfstools contains also dosfslabel utility which can read/change label. Please add support for dosfslabel for ability to format FAT32 file system and change FAT32 label without need to install mtools package.

2

Re: FAT32: Use dosfslabel from dosfstools

For reasons why dosfslabel is not used, see Bug 576616 - Cannot set label of fat32 partition with dosfstools.

3

Re: FAT32: Use dosfslabel from dosfstools

Ah, so problems with dosfslabel is:
* it does not store label in upper case
* it reads label from boot sector instead from FAT root directory

Is there reported bug for this problem to dosfslabel/dosfstools project?

4

Re: FAT32: Use dosfslabel from dosfstools

pali wrote:

Is there reported bug for this problem to dosfslabel/dosfstools project?

I don't know.  Please feel free to check and raise the issue if it doesn't already exist.

5

Re: FAT32: Use dosfslabel from dosfstools

Ok, I did some investigation and it looks good!

pali wrote:

* it does not store label in upper case

* dosfstools since 3.0.16 disallow setting new label if is not upper case
* dosfstools since 3.0.22 allow setting new label in lower case, but throw warning

pali wrote:

* it reads label from boot sector instead from FAT root directory

* dosfstools since 3.0.16 read label from FAT directory, with fallback to boot sector

Plus since since 3.0.16 dosfslabel and mkdosfs creates entry in FAT directory if does not exists before storing them label. So label is always stored to both FAT directory and boot sector.

So if gparted detects existance of dosfslabel (resp. fatlabel) with version 3.0.16+ then it can be used for getting or setting FAT label. Still gparted need to correctly prepare label (in upper case).

Relevant commits:
https://github.com/dosfstools/dosfstool … 6519860cb4
a9fa87e758291fa2b4143ad6db07aa4a2ee72eb6

So... is there still any problem why gparted cannot use dosfslabel (resp. renamed fatlabel)?

6

Re: FAT32: Use dosfslabel from dosfstools

Thank you pali for the dosfslabel research.

The list of distros that we try to support can be found on the develop page.

Would you be able to check which version of dosfstools is used in each of the distros for the oldest distro version which is still supported?

For example, Ubuntu 14.04 LTS is the oldest still supported release (until 2019-04) of Ubuntu and uses dosfstools v3.0.26.

It would also help if you could test the interoperability of dosfslabel actions with Windows and vice versa to ensure compatibility.

7

Re: FAT32: Use dosfslabel from dosfstools

You can run "dosfslabel --version" or "fatlabel --version" to check for current version at runtime in gparted. That would allow to work with also without dosfslabel/fatlabel when mlabel is still present.

8

Re: FAT32: Use dosfslabel from dosfstools

The preference is to keep the code as simple as possible which makes it easier to maintain.  The reason for the research request is to see if it is currently feasible to replace mtools with dosfstools on every supported distro.

9

Re: FAT32: Use dosfslabel from dosfstools

Looks like we still need mtools for setting UUID as dosfstools does not have a way how to change or who UUID.

But on the other hand, action for changing UUID is not so common and lot of people can live without it. On the other hand changing label is really needed.

Therefore support for mtools is still needed (for UUID), but does not have to be requirement anymore for those who do not need to care about UUID.

10

Re: FAT32: Use dosfslabel from dosfstools

And there is another problem, even last version of dosfslabel/fatlabel does not handle empty fat label correctly. Empty label needs to be stored as "NO NAME    ".

11

Re: FAT32: Use dosfslabel from dosfstools

Thank you pali for your further research.

Since dosfstools is not yet able to replace the features of mtools used in GParted, it looks like we will continue to require mtools.  Since mtools works for labeling and setting UUID, and because the code to support mtools is already written and tested, there appears to be less impetus to implement dosfslabel at this time.

12

Re: FAT32: Use dosfslabel from dosfstools

I reported bug for empty label in fatlabel: https://github.com/dosfstools/dosfstools/issues/53

13

Re: FAT32: Use dosfslabel from dosfstools

And similar, but slightly different problem is in mkfs.fat. Bug reported: https://github.com/dosfstools/dosfstools/issues/54

Which means that when gparted formatting disk to FAT and user does not specify label, then empty label is not stored correctly. When label is not specified, then gparted should not pass -n "" option. I will prepare patch for this problem.

14

Re: FAT32: Use dosfslabel from dosfstools

Patch for gparted is there: https://bugzilla.gnome.org/show_bug.cgi?id=784564