Skip to contentSkip to conversation

msdos/vfat defaults are annoying

DISCUSSION John Richard Moser 11 participants 19 messages Feb 6, 2005 – Feb 8, 2005

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So I've noticed, again, much annoyed, that if I rely on -t auto, horrible horrible things happen.

I have had floppies and compact flash cards that I've done mkfs.vfat to make fat32 filesystems on (not fat16), and mounting them brings the thing on as msdos by default (autodetect). Furthermore, I build msdos out, and mount says the msdos FS isn't supported. In either case I need to use -t vfat.

Vfat is much more common and should be backwards compatible with msdos.
When there's a ton of foo~1 files around after mounting, something's
wrong.

Shouldn't vfat be the automatic default? Or at least, if only vfat and not msdos is available, use vfat. For that matter, can msdos and vfat be collapsed? As I recall, the difference is that vfat makes more inodes to store long file names, one for each 13 characters (in reverse?)

I dunno. I can never understand the innards of the kernel devs' minds.

- --
All content of all messages exchanged herein are left in the Public Domain, unless otherwise explicitly stated.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCBaw3hDd4aOud5P8RAtBGAJsE8I1510nLSNqM6MRwPFGnl9l2UQCfSaGy HPGDuNVPvMZq8nkI34DlfPI=
=uNx9
-----END PGP SIGNATURE-----

#1 lore raw
Quoted 1 line · John Richard Moser

I dunno. I can never understand the innards of the kernel devs' minds.

filesystem detection isn't handled at the kerne level.

#18 lore raw
In reply to John Richard Moser

Hello John,

Am 2005-02-06 00:33:43, schrieb John Richard Moser:

Quoted 2 lines

So I've noticed, again, much annoyed, that if I rely on -t auto, horrible horrible things happen.

Maybe you add the file

__( '/etc/filesystems' )______________________________________________
/

|       ext3
|       ext2
|       minix
|       vfat
|       msdos
|       iso9660
|       hfsplus
|       hfs
| nodev	proc

\______________________________________________________________________

and if you use 'mount -t auto ...' it
will try the filesystems in this order.

Greetings
Michelle

Signature · 4 lines
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)
#2 lore raw
In reply to Christoph Hellwig

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Christoph Hellwig
Quoted 1 line · John Richard Moser

I dunno. I can never understand the innards of the kernel devs' minds.

filesystem detection isn't handled at the kerne level.

o_o

. . . then I shall bug baselayout@!

Quoted 1 line

- --
All content of all messages exchanged herein are left in the Public Domain, unless otherwise explicitly stated.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCBkXqhDd4aOud5P8RAt3CAJ4uOZFfhAIDlF8crE4SXfLSoDLDrACfSDWG LSaHLkMAGdKq8TuNFIHNQXM=
=SbC+
-----END PGP SIGNATURE-----

#3 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · John Richard Moser

I dunno. I can never understand the innards of the kernel devs' minds.

filesystem detection isn't handled at the kerne level.

Yeah, but the link order could be changed... Patch inlined.

Signature · 17 lines
pozsy

diff -Naurd a/fs/Makefile b/fs/Makefile
--- a/fs/Makefile	2004-08-04 10:52:28.000000000 +0200
+++ b/fs/Makefile	2004-08-04 11:32:04.510913663 +0200
@@ -57,8 +57,8 @@
 obj-$(CONFIG_MINIX_FS)		+= minix/
 obj-$(CONFIG_FAT_FS)		+= fat/
 obj-$(CONFIG_UMSDOS_FS)		+= umsdos/
-obj-$(CONFIG_MSDOS_FS)		+= msdos/
 obj-$(CONFIG_VFAT_FS)		+= vfat/
+obj-$(CONFIG_MSDOS_FS)		+= msdos/
 obj-$(CONFIG_BFS_FS)		+= bfs/
 obj-$(CONFIG_ISO9660_FS)	+= isofs/
 obj-$(CONFIG_DEVFS_FS)		+= devfs/

Signed-off-by: Pozsar Balazs <[email protected]>
#4 lore raw
Quoted 7 lines · Pozsar Balazs
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · John Richard Moser

I dunno. I can never understand the innards of the kernel devs' minds.

filesystem detection isn't handled at the kerne level.

Yeah, but the link order could be changed... Patch inlined.

And just what does the link order (or changes thereof) have to do with that?

#5 lore raw
Quoted 10 lines · Al Viro
Quoted 7 lines · Pozsar Balazs
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · John Richard Moser

I dunno. I can never understand the innards of the kernel devs' minds.

filesystem detection isn't handled at the kerne level.

Yeah, but the link order could be changed... Patch inlined.

And just what does the link order (or changes thereof) have to do with that?

IIRC currently if both msdos and vfat are compiled in (not modules), and you try to mount a vfat filesystem without explicitly specifying the fs type, it will be mounted with the msdos type. With the, it will mounted vfat.

Signature · 1 line
pozsy
#6 lore raw
Quoted 4 lines · Pozsár Balázs
Quoted 3 lines · Al Viro
Quoted 2 lines · Pozsar Balazs
Quoted 1 line · Christoph Hellwig

filesystem detection isn't handled at the kerne level.

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 7 lines

IIRC currently if both msdos and vfat are compiled in (not modules), and

you try to mount a vfat filesystem without explicitly specifying the fs type, it will be mounted with the msdos type. With the, it will mounted vfat.

But since filesystem detection isn't handled in the kernel, changing the link order is pointless. Please fix your /etc/filesystems instead.

~# grep camera /etc/fstab
/dev/sda1 /mnt/camera auto users,noauto 0 0 ~# strace -o mount.trace mount /mnt/camera ~# grep filesystems mount.trace open("/etc/filesystems", O_RDONLY|O_LARGEFILE) = 3 ~# cat /etc/filesystems
ext2
ext3
nodev proc
nodev devpts
iso9660
reiserfs
vfat
udf

Also check man 8 mount, specifically option -t:

[...] Creating a file /etc/filesystems can be useful to change the probe order (e.g., to try vfat before msdos) ...

This is from man-pages 1.66, btw.

Regards,

Nuno

#12 lore raw
In reply to Al Viro

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 6 lines · Al Viro
Quoted 4 lines · Pozsar Balazs
Quoted 2 lines · Christoph Hellwig

On Sun, Feb 06, 2005 at 12:33:43AM -0500, John Richard Moser wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I dunno. I can never understand the innards of the kernel devs' minds.

filesystem detection isn't handled at the kerne level.

Yeah, but the link order could be changed... Patch inlined.

And just what does the link order (or changes thereof) have to do with that?

because some distributions (eg gentoo) make a symlink to /proc/filesystems

jupiter root # ls -l /etc/filesystems
lrwxrwxrwx 1 root root 19 Oct 25 11:18 /etc/filesystems -> ../proc/filesystems

and then its impossible to change the order. (unless you make a "hand made" file of course).

- --
[ Clemens Schwaighofer -----=====:::::~ ]
[ TBWA\ && TEQUILA\ Japan IT Group ]
[ 6-17-2 Ginza Chuo-ku, Tokyo 104-0061, JAPAN ]
[ Tel: +81-(0)3-3545-7703 Fax: +81-(0)3-3545-7343 ]
[ http://www.tequila.co.jp http://www.tbwajapan.co.jp ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCBxBLjBz/yQjBxz8RAsCXAKCHwURn6UJjrtEOhjaXHa0min94NQCdFlBa EgBrVpGuASFNepZigjV1p5E=
=ol2B
-----END PGP SIGNATURE-----

#7 lore raw
In reply to Nuno Monteiro
Quoted 10 lines · Nuno Monteiro
Quoted 4 lines · Pozsár Balázs
Quoted 3 lines · Al Viro
Quoted 2 lines · Pozsar Balazs
Quoted 1 line · Christoph Hellwig

filesystem detection isn't handled at the kerne level.

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

But since filesystem detection isn't handled in the kernel, changing the link order is pointless. Please fix your /etc/filesystems instead.

But the contents of /proc/filesystems comes from the kernel. And the order of filesystems comes from the link order.

Let me show you, why it is _not_ pointless:
If you do not have /etc/filesystems, mount will read /proc/filesystems:

# strace -o mount.trace mount -t auto /dev/sda1 /mnt
# grep filesystems mount.trace
open("/etc/filesystems", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/proc/filesystems", O_RDONLY|O_LARGEFILE) = 3
# grep ^mount mount.trace
mount("/dev/sda1", "/mnt", "squashfs", 0xc0ed0000, 0) = -1 EINVAL (Invalid argument)
mount("/dev/sda1", "/mnt", "vfat", 0xc0ed0000, 0) = 0

See? I _have_ that patch applied, that's why it tried vfat and not msdos first.

Granted, I could override the default order by using a /etc/filesystems file. But the kernel should have a much more sane default on its own, namely "try vfat before msdos".

Signature · 1 line
pozsy
#13 lore raw
In reply to Clemens Schwaighofer
Quoted 4 lines · Clemens Schwaighofer
Quoted 3 lines
Quoted 1 line

Yeah, but the link order could be changed... Patch inlined.

And just what does the link order (or changes thereof) have to do with that?

Quoted 8 lines

because some distributions (eg gentoo) make a symlink to /proc/filesystems

jupiter root # ls -l /etc/filesystems
lrwxrwxrwx 1 root root 19 Oct 25 11:18 /etc/filesystems -> ../proc/filesystems

and then its impossible to change the order. (unless you make a "hand made" file of course).

Ah, I had not met this particular form of brokenness before.

If one does not specify a filesystem type to mount, mount will try its own collection of heuristics, looking for known magic numbers. This stuff comes in two versions, depending on whether mount was linked against the blkid library or not.

When no magic is recognized, mount will try all filesystems listed in /proc/filesystems that were not rejected already because of wrong magic. The list in /proc/filesystems can be overridden by the file /etc/filesystems. That is useful for two reasons: (i) sometimes the kernel crashes when one tries to mount something with the wrong type, so /etc/filesystems can skip the types that must never be tried, and (ii) sometimes several types would succeed (e.g. msdos/vfat) and the user can override the kernel order.

Making a symlink /etc/filesystems -> /proc/filesystems is meaningless.

By the way, it is best to consider the kernel order as undefined. It plays a role when mounting the rootfs. If you get undesirable results at boot time, specify the rootfstype= boot option. It plays a role when generating /proc/filesystems.
If you get undesirable results, adapt /etc/filesystems.

It is not true that vfat is universally better than msdos. Some need one, some need the other.

Instead of having a global order, one can have a per-mountpoint list in /etc/fstab. For example,

/dev/foo /mnt ext2,msdos noauto 0 0

Finally, guessing is always bad. It is convenient in the short run but may lead to crashes and data loss in the long run.

Andries

#14 lore raw
Quoted 2 lines · Andries Brouwer

and (ii) sometimes several types would succeed (e.g. msdos/vfat) and the user can override the kernel order.

But we are talking about the default order.

Quoted 1 line

By the way, it is best to consider the kernel order as undefined.

But it is not undefined, and if it is a well-defined order (and it is), then it should have a sane order.

Quoted 5 lines

It is not true that vfat is universally better than msdos. Some need one, some need the other.

Finally, guessing is always bad. It is convenient in the short run but may lead to crashes and data loss in the long run.

Well, it can be bad, maybe it should be avoided. But if someone wants guessing, why not provide him a (imho) more reasonable order of guessing? I do think vfat should be tried first. If you are doing for example some kind of recovery you wont bet on autoguessing. But if you just want to use it, use might, and in that case you want long filenames, ie vfat.

Signature · 1 line
pozsy
#8 lore raw
In reply to Pozsár Balázs

Am 2005-02-07 09:47:09, schrieb Pozsár Balázs:

Quoted 2 lines

See? I _have_ that patch applied, that's why it tried vfat and not msdos first.

With this, you will nerver mount a Filesystem "msdos".

Because "vfat" IS "msdos" + "lfn".

You can attach to ALL "msdos" media "lfn" and you will have "vfat".

Quoted 3 lines

Granted, I could override the default order by using a /etc/filesystems file. But the kernel should have a much more sane default on its own, namely "try vfat before msdos".

This will give many errors here at work...

Greetings
Michelle

Signature · 4 lines
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)
#15 lore raw
In reply to Andries Brouwer

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · Andries Brouwer

Making a symlink /etc/filesystems -> /proc/filesystems is meaningless.

well to be honest, I didn't even know Gentoo makes a symlink here, but I'll definitly will make bug entry for that.

Perhaps its a default setting. eg Debian doesn't have a /etc/filesystems file by defauly anyway.

Quoted 2 lines

It is not true that vfat is universally better than msdos. Some need one, some need the other.

but to be honest, most times I need vfat, and I actually haven't encountered a time when I need msdos.

lg, clemens

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD4DBQFCB3RpjBz/yQjBxz8RAlQBAJjj0IIhxCPWvWinMpi6J5UOJ9bBAJ9oQnI4 A6sIi+MzKiFbvpLIiQI1YQ==
=rmlN
-----END PGP SIGNATURE-----

#10 lore raw
In reply to Pozsár Balázs
Quoted 6 lines · Pozsár Balázs
Quoted 1 line · Nuno Monteiro

But the contents of /proc/filesystems comes from the kernel. And the order of filesystems comes from the link order.

Yes, but /proc/filesystems is only processed after two other checks have failed first: specifying a filesystem type (-t), and reading /etc/filesystems. Relying on mount to do the guesswork is asking for trouble if you realy value your data. And /etc/filesystems is the mechanism mount(8) has in place to change the probe order, in case you really want that. This is entirely a userspace problem, the kernel shouldn't have anything to do with it.

But, anyway, for the sake of argument let's suppose link order is effectively changed. You just effectively broke people's working setups, because like you want to rely on fs/ link order to mount your vfats as vfat and not as msdos, there's people out there relying on that (broken) assumption to have their msdos filesystems mounted as msdos. Now, with the new link order, they'll be mounted as vfat, and pop-goes-the-weasel. Tomorrow, someone unhappy that their msdos fs is now mounted as vfat will send a patch changing it back, thus breaking vfats. Rinse, repeat. ;-)

See? This is just wrong. This is why mount(8) has a mechanism to change the probe order. Everybody's happy that way, and no one has to rely on the broken assumption that the kernel knows how you want your filesystems mounted.

So, to sum things up: this is entirely an userspace problem. Yours just appears to be in need of fixing or tuning.

Regards,

Nuno

#9 lore raw
In reply to Michelle Konzack
Quoted 9 lines · Michelle Konzack

Am 2005-02-07 09:47:09, schrieb Pozsár Balázs:

Quoted 2 lines

See? I _have_ that patch applied, that's why it tried vfat and not msdos first.

With this, you will nerver mount a Filesystem "msdos".

Because "vfat" IS "msdos" + "lfn".

You can attach to ALL "msdos" media "lfn" and you will have "vfat".

So msdos is vfat WITHOUT lfn, which is a a restriction like noatime or mounting ext3 as ext2.

That's why the default should be vfat indeed and the restriction should be "nolfn", which will not allow lfns to be created and is what you actually intend, right?

But this will break API today, so it should be added to list of features that will change.

Regards

Ingo Oeser

#16 lore raw
In reply to Clemens Schwaighofer

Clemens Schwaighofer <[email protected]> said:

[...]

Quoted 2 lines

but to be honest, most times I need vfat, and I actually haven't encountered a time when I need msdos.

But writing MSDOS on a VFAT filesystem is a sure way to screw it up, and AFAIU vice-versa.

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
#17 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · Horst von Brand

Clemens Schwaighofer <[email protected]> said:

[...]

Quoted 2 lines

but to be honest, most times I need vfat, and I actually haven't encountered a time when I need msdos.

But writing MSDOS on a VFAT filesystem is a sure way to screw it up, and AFAIU vice-versa.

well it doesn't screw it up if you write MS DOS on a VFAT, you just loose a lot of data.

I was kinda surprised when I came home and plugged in my USB stick to see just A3.CB instead of a nice long filename :)

- --
[ Clemens Schwaighofer -----=====:::::~ ]
[ TBWA\ && TEQUILA\ Japan IT Group ]
[ 6-17-2 Ginza Chuo-ku, Tokyo 104-0061, JAPAN ]
[ Tel: +81-(0)3-3545-7703 Fax: +81-(0)3-3545-7343 ]
[ http://www.tequila.co.jp http://www.tbwajapan.co.jp ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCCCLljBz/yQjBxz8RAvgyAJ4zRyjszLLuBeZz5lBAyegCTbm1ygCfYf2E UJKEEU0HJuLRTAjec3aEQ3s=
=g+L4
-----END PGP SIGNATURE-----

#11 lore raw
In reply to Pozsár Balázs
Followup to:  <[email protected]>
By author:    =?iso-8859-1?Q?Pozs=E1r_Bal=E1zs?= <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 5 lines

Granted, I could override the default order by using a /etc/filesystems file. But the kernel should have a much more sane default on its own, namely "try vfat before msdos".

What it really means is that mount(8) should know this is a special case; presumably it already knows to try ext3 over ext2.

-hpa