s3fs-deploy.sh: LAN DNS, faster defaults, and a menu to change a mount's settings #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/s3fs-lan-dns"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Jellyfin's container (LXC 125) found its S3 mount painfully slow. Its DNS servers are 192.168.0.1 and 1.1.1.1, exactly what this script advises for a name that doesn't resolve. Neither has a LAN answer for
s3.au-syd.cloud.mungessunges.com: both return the public edge, 168.144.174.255. So every s3fs request left for the internet and came back.From inside that container, a plain 1 GiB read of a test object:
The change
pct set <vmid> --nameserver '192.168.0.53 192.168.0.54'.pctcommand. It's a warning, not a failure, because a machine really outside the network should use the public path. IP endpoints are skipped, as before.dd'sfdatasyncand read back, through Junction:multipart_size=64is always set. It helps a little everywhere.parallel_count=16,multireq_max=32,max_background=64are added only on machines with 4 or more CPUs. With 8 CPUs, reads went from 248 to 320 MB/s and ten 4 MiB seeks from 3.2 s to 2.1 s. With 1 CPU the extra encryption made reads slower, 129 against 82 MB/s.-ostill overrides any of them, since it comes later on the mount line.-o streamuploadis documented for faster writes, on s3fs 1.93 or newer. A 1 GiB write went from 133 to 184 MB/s with 2 CPUs, and from 159 to 275 with 8. s3fs's manual still calls it experimental, so it isn't on by default. The README now also warns that a write fails when the temp directory fills (see below).Changing a mount's settings (
e7a3422)Run with no arguments on a machine that already has s3fs mounts, and the script lists them. That covers mounts in
/etc/fstaband those mounted with--no-fstab. Picking one opens a menu of its settings:max_dirty_data.How the menu explains itself:
Saving and the other ways in:
--list,--edit MOUNTwith--set,--unsetor-o, and--remove.--pct. The menu runs inside the container, on the host's terminal.Running the deploy again now keeps a mount's settings. The options are merged in this order: this machine's defaults, then the existing line, then the script's own options, then
-o. Before, a re-run replaced the line and threw away anything changed since.The guidance comes from measurements with s3fs 1.95 against a local SeaweedFS, which changed some of it:
/tmpis a RAM disk, new mounts now use/var/tmp/s3fs./tmp, which is what qBittorrent's VM has, would refuse once the VM has 4 CPUs. The defaults now drop to s3fs's 5 parallel transfers when they wouldn't fit, and--editchecks before it touches anything./tmp; they don't.max_dirty_data=256kept a 512 MiB write to 256 MiB of temp space, with the write slowing from 129 to 107 MB/s.Tests
The harness in a throwaway Debian 13 container passes 46 of 46. That's the original 11 scenarios plus 17 new ones, each with one or more checks.
-oreplaces a default in place, and a new mount on one CPU getsmultipart_size=64only, since an existing mount now keeps its settings.--list, as root and as an ordinary user, shows all six mounts,--no-fstabones included. Naming a bucket mounted in several places asks for the mount point.--setand--unsetchange the fstab line in place and remount. The disk cache fills on a read.multipart_size=1) is rolled back, and the bucket stays mounted.--no-fstabmount is changed by remounting it, and stays out of fstab./tmpis a RAM disk getstmpdir=/var/tmp/s3fs.--removeunmounts and removes the line, and keeps credentials another mount still uses.--list,--editand the menu go through--pct, with a stand-in forpct, and the copy pushed into the container is cleaned up.--setvalues that would break fstab are refused.The script is shellcheck-clean at warning level.
🤖 Generated with Claude Code
Run with no arguments on a machine that has s3fs mounts (in /etc/fstab, or mounted with --no-fstab), the script lists them and opens a menu of a mount's settings: caching, speed, temp space, access and timeouts. Each line shows its value and its trade-off in a few words; choosing one explains what it does and what raising it costs before asking. Tips above the menu name what this machine gets wrong: a temp directory on a RAM disk, more parallel transfers than its CPUs can encrypt, settings s3fs would refuse to mount with. Saving rewrites the fstab line in place and remounts; if s3fs refuses, the old line goes back and the bucket is mounted as it was. --list, --edit with --set/--unset/-o, and --remove do the same without the menu, and all of it works through --pct. The guidance is measured with s3fs 1.95, not assumed: - s3fs itself stays at 10-13 MiB whatever the part size or parallel count - it holds every open file whole in its temp directory, read or written, so a RAM-disk /tmp holds them in memory: new mounts on such a machine use /var/tmp/s3fs instead - it won't mount unless its temp disk has part size x parallel transfers free over its 10% floor; the defaults now fit, and --edit checks first - stream uploads fail a write ("No space left on device") when the temp directory fills, where s3fs otherwise slows down; the README no longer says they avoid the copy into /tmp - max_dirty_data=256 kept a 512 MiB write to 256 MiB of temp space Running the deploy again keeps a mount's settings (defaults, then the existing line, then the script's own options, then -o), so it no longer undoes changes made with --edit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>s3fs-deploy.sh: the LAN DNS, a warning for a public answer, and faster defaultsto s3fs-deploy.sh: LAN DNS, faster defaults, and a menu to change a mount's settings