9

I'm trying to mount a partition with -o option, however I get this error

root@blackbox:~# mount /dev/sda1 /media/ownclouddrive -o uid=33,gid=33
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

[  365.432693] EXT4-fs (sda1): Unrecognized mount option "uid=33" or missing value

If I checl my /etc/passwd I can see the user there

www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin

Any idea why?

Thanks

6
  • 6
    uid and gid are options for filesystems that don’t support permissions, e. g. vfat. They’d make little sense for ext4.
    – phg
    Jul 25, 2016 at 13:27
  • And to override ownership for all files on a file-system (without actually modifying the file metadata stored on the filesystem), you could look at bindfs Jul 25, 2016 at 13:30
  • So, the suggestion is to change the partition in NTFS?
    – Federi
    Jul 25, 2016 at 13:39
  • 1
    A first suggestion would be to remove the uid=33,gid=33 options to the mount command. If that's not acceptable please edit your question to explain what you're trying to achieve. Jul 25, 2016 at 13:47
  • 2
    @Federi In addition to what @roaima recommends, if you need all 33:33 permissions on that filesystem, then just chown -R its contents once after mounting.
    – phg
    Jul 25, 2016 at 14:01

2 Answers 2

14

You are getting that error message because you specify mount options that don’t apply to the filesystem on the device.

The mount options uid= and gid= are not valid for all available filesystems. The ones that support proper permissions usually don’t accept them, as is the case for that ext4 device you’re attempting to mount.

For filesystems with limited functionality like VFAT, the options uid and gid allow mapping the ownership of the entire contents of a mounted filesystem to a single local user. Similar options exist for other properties like the umask.

Note that this is not the proper way to grant permissions to the contents, but rather a workaround to integrate certain FS into a unixoid environment. On an ext4 partition like the one you’re attempting to mount, just change the ownership directly:

mount -t ext4 /dev/sda1 /media/ownclouddrive
chown -R 33:33 /media/ownclouddrive/*
1
  • 2
    Yes! Thanks for this answer. It seems obvious, in hindsight, that changing the ownership directly is the right approach, but... I just caught myself trying to do the exact same thing as the OP, i.e., manipulating permissions for an EXT4-formatted partition via the uid= option in /etc/fstab. Glad my Google search for Unrecognized mount option "uid= led me to this answer!
    – evadeflow
    Dec 17, 2018 at 18:26
0

In addition to phg, you can use option user i.e.

mount /dev/sda1 /media/ownclouddrive -o user=www-data,rw

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .