File sharing for a settlement works best as one directory tree on a server, exported by NFS to Linux machines or by Samba to others, with a group for each team, write access only to a team’s own folder, and a nightly copy to a second machine. A 250 GB first copy takes about 5.6 hours at 100 Mbps but about 23 days at 1 Mbps, so move only changes over slow radio links. Shared storage and RAID are not backups, because both faithfully preserve a deleted file’s deletion.

Part of Networking

Shared storage services for a settlement: folder layout, group permissions, NFS and Samba exports, and the time it takes to copy data over different links.

The Protocols Are Covered, The Layout And Permissions Decide Whether It Works

Resource Sharing explains the two main protocols, NFS (native to Unix and Linux) and SMB through Samba (native to Windows, supported everywhere), and what a network storage server is, along with RAID and why it is not a backup. Shared Resources covers locking, access control lists and quotas. File Transfer covers FTP, SFTP, SCP and rsync for moving files, and verification by hash. This article is the part those leave out: how to lay out the tree and set the permissions so that people can work together without overwriting each other.

The carrier Internet Infrastructure lists three options: NFS, Samba, and a plain web directory listing. FTP appears in this node’s subtitle, and the right place for it is limited: it sends passwords and data in the clear (File Transfer), so use it only to offer public files for reading and use SFTP for anything else.

What You Need

  • A server with two mirrored disks (Server Deployment)
  • A group per team and an account per person (Access Control)
  • NFS or Samba, and their documentation, in the offline archive
  • A second machine for the nightly copy

Method: Share A Tree

Step 1: Lay out the tree by team For example /srv/shared/clinic, /srv/shared/workshop, /srv/shared/library and /srv/shared/public. One folder per team, one folder everyone can read.

Step 2: Give each team’s folder to that team’s group Make the group the owner and set the folder so that new files inherit the group (the setgid bit, general knowledge). Group members get read and write; everyone else gets read, or nothing for private folders.

Step 3: Export it NFS, in the server’s exports file, naming the settlement’s network (general knowledge, not from the other articles; test on a spare machine first):

/srv/shared 10.1.0.0/24(rw,sync,no_subtree_check)

and on a client: mount -t nfs 10.1.0.2:/srv/shared /mnt/shared. Samba, in its configuration file:

[shared]
   path = /srv/shared
   read only = no
   valid users = @settlers

NFS in its basic form trusts the user identity that the client machine claims, so it suits a network where you control every client. Samba asks for a password. Both statements are general knowledge, not from the other articles.

Step 4: Set quotas and rely on locks sensibly A quota of 20 GB against typical use of 5 GB catches a runaway process (Shared Resources). Most locking is advisory: two people editing one file can still overwrite each other unless the program asks for a lock.

Step 5: Copy to a second machine every night, and verify rsync sends only what changed (File Transfer).

Worked Example: Permissions And Copy Times

Mode digits. Each digit is read 4 + 2 + 1 for read, write, execute. Mode 775 is 7 = 4+2+1 (rwx), 7 (rwx), 5 = 4+1 (r-x): owner and group read, write and enter; others read and enter. Mode 770 gives others nothing. Mode 640 on a file is 6 = 4+2 (rw-), 4 (r—), 0 (---).

Copy times. The server holds 250 GB (the example in Server Deployment). 250 GB = 250 x 10^9 bytes x 8 = 2 x 10^12 bits.

  • At 100 Mbps: 2 x 10^12 / 10^8 = 20,000 s = 5.6 hours at the full rate. Network Fundamentals gives 90-95% for large transfers on a healthy link, which makes it 20,000 / 0.95 = 21,053 s = 5.8 hours to 20,000 / 0.90 = 22,222 s = 6.2 hours.
  • At 1 Mbps: 2 x 10^12 / 10^6 = 2,000,000 s = 23 days.

So the first full copy to a remote settlement is a job for a person carrying a disk, and the nightly job afterwards sends only the changes.

Common Mistakes

  • One shared folder for everybody with write access — a deletion is everybody’s loss
  • Exposing NFS to a network you do not control — it trusts the client’s word about who is asking
  • Treating the mirrored disks as the backup — a deleted file is deleted from both
  • Never testing a restore — a backup you have not restored from is a hope

What’s Next