Linux – How to Setup a Shared Data Partition for Multiple Linux OSes

dual-bootfile-sharingfilesystems

Currently I have a NTFS partition that contains shared data. My rationale is, NTFS doesn't have any idea about file permissions, so I won't have any trouble using them in a multi-boot system (currently I have Gentoo and Ubuntu, and the data partition is auto-mounted on both). Now I want to get rid of the NTFS thing, if possible. So the question is, how can I use something like ext4 and setup the same thing?

Update: Sorry I should have made it clear that I only have Linux distributions, so no problem with ext4. I just want to have a partition that contains world-readable files and is automounted at boot.

Best Answer

NTFS does have file permissions. Either you squashed them through mount options or you used consistent user mappings or you made your files world-accessible.

If you use a filesystem whose driver doesn't support user mappings, you have several options:

  • Arrange to give corresponding users the same user IDs on all operating systems.

  • Make files world-accessible through an access control list (this requires a filesystem that supports ACLs; ext[234] do, but you may have to add the acl mount option in your /etc/fstab). Run the following commands to make a directory tree world-accessible, and to make files created there in the future world-accessible:

    setfacl -m other:rwx -d -R .
    setfacl -m other:rwx -R .
    
  • Mount the filesystem normally and provide a view of the filesystem with different ownership or permissions. This is possible with bindfs, for example:

    mount /dev/sdz99 /media/sdz99
    bindfs -u phunehehe /media/sdz99 /media/shared
    

    Or as an fstab entry:

    /dev/sdz99  /media/sdz99  auto  defaults  0 2
    bindfs#/media/sdz99  /media/shared  fuse  owner=phunehehe
    

NTFS has the advantage that it's straightforwardly sharable with Windows, it is not a requirement for Windows sharing.

Related Question