1

I'm trying to create an fstab entry for /dev/fd0 so that user can mount a floppy formatted either with VFAT or ext32. The simple fstab entry

/dev/fd0 /mnt/floppy auto noauto,user,sync,gid=users,umask=000 0 2

can only mount DOS floppies. If I change the entry to

/dev/fd0 /mnt/floppy ext2 noauto,user,sync 0 2

then I can only mount a floppy with ext2 filesystem. Obviously, I can issue a root mount command with appropriate -t option and mount either floppies. Is there a way to mount floppy as user with the simple command

mount /mnt/floppy

for floppies with either VFAT or ext2 filesystem?

migrated from stackoverflow.com Oct 11 '17 at 13:45

This question came from our site for professional and enthusiast programmers.

0

From man 8 mount on Linux:

If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. Mount uses the blkid library for guessing the filesystem type; if that does not turn up anything that looks familiar, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled nodev (e.g. devpts, proc and nfs). If /etc/filesystems ends in a line with a single *, mount will read /proc/filesystems afterwards. While trying, all filesystem types will be mounted with the mount option silent.

So just create a file /etc/filesystems containing something like this:

ext4
ext3
ext2
vfat
msdos
ntfs
iso9660
ufs
xfs

Add more filetypes if you need. Then you can use type auto in fstab.

  • @Sato Katsura - thanks for your interest in responding to my question. I do have the /etc/filesystems file that contains ext2 and vfat entries, yet fstab with auto entry gives error suach as "bad superblock..." if using mount command without -t option. The cat /proc/filesystem shows only filesystems currently used by mounted devices. This problem happens only with /dev/fd0; I can mount auto sda devices (usb sticks formatted either vfat or ext2). Strange behavior for fd0? – Janos Oct 18 '17 at 15:19
  • @Janos The order is important, the entries are tried in order. If msdos comes before vfat and you try to mount a vfat filesystem you'll get an error, because the filesystems are similar enough for msdos to match. – Satō Katsura Oct 18 '17 at 15:31
  • @sato Katsura - it works now! Thanks again, Janos – Janos Oct 20 '17 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.