NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: reducing laptop storage wear and tear for cache objects



Hauke Fath (SPG) wrote in
 <dd347ed1-48f1-a33f-5f80-330155ba2a65%spg.tu-darmstadt.de@localhost>:
 |On 2024-10-22 09:29, RVP wrote:
 |> On Tue, 22 Oct 2024, Van Ly wrote:
 |> 
 |>> In homedir/.cache directory, the web browser will leave ½Gb data files.
 |>> [...]
 |>> Is there anything I can do to suggest the system use RAM and not laptop
 |>> disk storage for cache objects?
 |>>
 |> 
 |> Assuming /tmp is mounted on a tmpfs, you can just set XDG_CACHE_HOME for 
 |> the browser.
 |
 |Generalizing the concept, you could look at 
 |sysutils/p5-Unburden-Home-Dir, which we use here successfully on Arch 
 |Linux clients with nfs-mounted home directories.

On Linux one could of course simply over-mount a single path/file.
Having said all that (eh: it is below now), if a browser actually
honours XDG_ it is surely not firefox, but still, in my ~/.profile
i have

  for i in .bogofilter .cache .config .dbus .vim traffic; do
          [ -d /var/tmp/$LOGNAME/$i ] || mkdir -m 0700 /var/tmp/$LOGNAME/$i
          [ -h ./$i ] && continue
          ln -s /var/tmp/$LOGNAME/$i
  done

and that ends up as volume

  ID 376 gen 529110 top level 5 path kent/var-tmp

Problem is of course the user needs to want it, as symbolic links
cannot be protected that easily i think.  But with real forced
directory etc --bind mounts that would work.  (Well, unless the
user has symbolic links, and --bind will then follow it.  :/

  For browsers i in fact use namespace boxes, with that

    $ findmnt ~/.mozilla/
    TARGET                 SOURCE FSTYPE     OPTIONS
    /home/steffen/.mozilla encfs  fuse.encfs rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,default_permissions

  being the one with passwords (aka bank, isp contact, etc;
  unfortunately this includes github, even wikipedia, and such, but
  i yet refrained from diversifying into "very-detached" and
  "mildly-detached", yet i am happy that *that* firefox gets away
  with "Your stored cookies, site data, and cache are currently
  using 877 KB of disk space." *without* cleanup; this encfs is
  unmounted when i close the LID etc), and a special partition one

    #?0|kent:~# btrfs su li .|grep -F ' vole/'
    ID 382 gen 529106 top level 5 path vole/browse.home
  ^
    ID 383 gen 528159 top level 5 path vole/usr-src
    ID 873 gen 529106 top level 5 path vole/browse.var-tmp
  ^

  for "browse", which earns several hundred megabytes of disc
  storage each week, and gets cleaned every week.  Ie that is
  mounted into some place, with an overlay mount on top for disc
  encapsulation and space restriction (only one shared accessible
  download directory, plus the .mozilla/ thing).
  Ie i only, eh,
    doas /x/pub/box-web.sh browse firefox
  or
    doas /x/pub/box-web.sh secweb firefox
  (or
    doas /x/pub/box-web.sh priwse firefox
  which *is* secweb but uses the real DNS service, as the others
  would go via VPN if local dnsmasq has to perform a lookup).  Ie

    permit nopass nolog keepenv setenv { -SSH_AGENT_PID -SSH_AUTH_SOCK } :shared as root cmd /x/pub/box-web.sh

Yes, i think i would try to enwrap browser instances at all costs.  
These devilish beasts.  And i only hope the SML IETF WG does not
bring scripting to email, or there will be a monster more.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Home | Main Index | Thread Index | Old Index