The problem of using a filesystem like
ext4 on a USB stick or memory card is that when it's mounted into another system the disk's UID/GID might not be present.
Can this be fixed with a mount option?
I assume you're hoping to find an equivalent of the
gid=N options supported by some of the other filesystems Linux's
mount command knows about. Sorry, but no, ext4 doesn't have that option.
These other filesystems have such an option in order to give permissions to files for a filesystem that may not have useful POSIX permissions. You're looking to take permissions away — or at least, reassign them — which is a bad idea from a security standpoint, which is doubtless why these options don't exist.
When you use a filesystem like ext4 on removable media, you're saying that you care about things like POSIX permissions. That means you have to take the same sort of steps to synchronize user and group IDs as you would for, say, NFS.
If you don't actually care about permissions, there is probably a more appropriate filesystem for your situation.
I tried UDF as a candidate for such a filesystem after the commentary below, but alas, it won't work:
If you create a UDF filesystem on one Linux box, add files to it, change their permissions, and mount them on another Linux box, it will obey the permissions it finds there, even if you give
uid=N,gid=N. You have to sync UIDs and GIDs here, as with NFS.
Mac OS X behaves as hoped: it believes it owns everything on a UDF filesystem created on a Linux box. But, add a file to the disk, and it will set the UID and GID of the file, which a Linux box will then obey.
If you then try to mount that filesystem on a FreeBSD box, it yells
invalid argument. I assume this is because the kernel devs didn't realize UDF could appear on non-optical media, simply because I couldn't find any reports of success online. Perhaps there is a magic incantation I have missed.
It is reportedly possible to get a UDF hard drive to work on Windows, but it is very picky about the way it is created. If you need this to work, it's probably best to format from within Windows. From the command line:
format /fs:udf x:
/q: that creates a filesystem that is less likely to mount on other OSes.
Note that UDF is only read/write on Vista and newer. XP will mount a UDF hard drive created on Vista, but won't be able to write to it.
NTFS might also work, if you're using recent enough Linux distros that they include reliable read/write support for NTFS.