Unable to set mount options for vfat device

I am trying to build a system running from a flash drive, while keeping the flash drive in regular use too. So I have created an ISOimage using SuseStudio and placed it on a flash drive using live-fat-stick (which is a script wrapping syslinux).

It’s working fine, but now I want to mount the flash drive itself, to use for persistent storage. It mounts just fine, but all files are set to root as owner, and writeable only by root. I did check that root can write successfully; but I don’t like the idea of running my applications as root, even on an “appliance” system.

I try to use mount options but they are roundly ignored, for example:

unount /vol/flash

mount -t vfat -o uid=1000,umask=0000,dmask=0000,fmask=0000 /dev/disk/by-label/MIKFL32 /vol/flash

cat /etc/mtab

(loads of stuff here)
/dev/sdb1 /vol/flash vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0

And ls -l /vol/flash lists the files as owner by root with rwxr-x-r-x
permissions.

Moreover, even the command (run as root, of course) “chmod -R 777 /vol/flash” does not change anything. “chmod -R myuser /vol/flash” gives loads of “operation not permitted” errors.

How can I make it mount the file system with either umask=0 (so r/w/x permissions for everyone), or else owned by the user with the UID of 1000?

I did try modifying /etc/fstab at runtime, adding a line like this:

/dev/disk/by-label/MIKFL32 /vol/flash vfat mode=0777 0 0

I tried various options instead of mode=0777, as in umask=0000 and gid=1000. In all cases, after doing “mount /vol/flash”, I still saw all files owned by root and set to 755 permissions.

Lots of gogling did not clarify the issue. I tried to add the “user” option but it would not work anyway. Also, no trace of anything in /var/log.

I suspect there is a workaround in creating a file and an ext2fs system within the file, which could then be mounted and used for persistence. But I would much prefer just accessing the FAT32 file system, so the files can be shared with Windows machines.

On 2015-01-13 01:16, ramendik wrote:

> # cat /etc/mtab
> (loads of stuff here)
> /dev/sdb1 /vol/flash vfat

> Moreover, even the command (run as root, of course) “chmod -R 777
> /vol/flash” does not change anything. “chmod -R myuser /vol/flash” gives
> loads of “operation not permitted” errors.

You plain simple can not chmod or chown any file in a FAT filesystem,
because FAT does store LINUX permissions: it stores MSDOS permissions.

The permissions are emulated at mount time. The system normally sets the
owner to be the same one as the one running the desktop - but as you are
running a “very strange system”… things on your “system” are strange.

> I did try modifying /etc/fstab at runtime, adding a line like this:

Not at run time, but at build time in susestudio.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

I understand they are emulated. But then, why does “mount -t vfat -o umask=000 /dev/whatever /vol/flash” does not work? Of if I use uid=1000 instead of the umask.

As for build time, /etc/fstab is just not there in the list of files. So I guess it gets created sometime during the boot. And, I don’t really even need it in fstab - I can place autorunning the mount command somewhere. Right now I can’t get this to work (as in, allow non-root to write) at all, not even when I use a root prompt to mount.

So something, somehow, makes mount ignore the uid, mask, fmask, dmask (tried those too) options when mounting vfat. Why could this happen?..

I have found the cause but I’m not sure what to do about it.

The device is already mounted as /isofrom with the default options. And it can not be unmounted as “target is busy”.

Looks like I need to get the mount options for /isofrom changed in the susestudio build. I would appreciate ideas how to do it. Or else somehow force a remount?

On 2015-01-13 03:26, ramendik wrote:
>
> I have found the cause but I’m not sure what to do about it.
>
> The device is already mounted as /isofrom with the default options. And
> it can not be unmounted as “target is busy”.

Well, it makes sense as the stick has to be mounted in order to read the
live image.

You might try a second mount, or a bind mount. Dunno, I’ve never done it.

You could partition the stick in two, a standard section for the running
live (or two, to make it persistent), and another biggish chunk in fat.

> Looks like I need to get the mount options for /isofrom changed in the
> susestudio build. I would appreciate ideas how to do it. Or else somehow
> force a remount?

You’d better ask in the susestudio subforum.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)