Friday, April 08, 2022

Re: map/mount a directory/partition into memory

Mihai Popescu wrote (2022-04-08 05:17 CEST):
> Since my computer is struggling with chromium and I suspect it's the
> disk access being too slow, I want to map the directory accessed by
> chromium ( i think it is ~/.cache) into the memory.
>
> Looking in the man, i spotted rd, but i think i need to setup this in
> the kernel.
> The next choice is tmpfs.
> The next one is mfs.
>
> I have no experience with this stuff, so does it worth to take this approach?
> If so, what is the recommended fs, please?
> Is it possible to map/mount a directory from a partition only, or is
> it the entire partition only accepted as a mount argument?

I haven't played with rd or tmpfs, but this works:

cat /etc/fstab:
swap /tmp mfs rw,nodev,nosuid,-s=1g 0 0
(my setup, tweak to your likings)

Then:
mkdir /tmp/chromecache
XDG_CACHE_HOME=/tmp/chromecache chrome

There's more XDG variables if you want to shuffle things around:
https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html

With more creative setups, you might need to adapt chromes unveil
configuration in /etc/chromium.

Best Regards,
Stefan

No comments:

Post a Comment