NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: /var on tmpfs
On 11/16/2018 11:12 AM, Jeremy C. Reed wrote:
On Thu, 15 Nov 2018, Don NetBSD wrote:
I've a box with a DoM. I'd like to mount / as ro and create a
tmpfs for /var (and /tmp). I don't think anything else NEEDS to
be rw (the infrequent changes to /etc can be made by unlocking /
to make those changes).
I imagine I can just make a tarball of a skeletal /var and
unpack this over /var, once mounted?
Is there a preexisting mechanism for this sort of thing?
Or, do I roll my own?
Have a look at the /etc/mtree/ specifications. Many /var/ entries in
there. You could use it to create your own spec file for your required
files and directories with correct ownership and permissions and then
run mtree to generate them.
Ah, that would be a clever approach -- and, add little/nothing to the
image size as the entries would already exist in the existing specs
(I'd just be "moving" them into another spec).
But, it won't let me create *files*.
So, if I wanted to symlink all or part of /etc to, for example, /var/etc
(to eliminate the need for creating a second tmpfs -- and incurring a
second "overhead"), I'd still need a mechanism to instantiate those
files under /var.
Or (looking at my notes from 2002), I used a /var.copy directory
pre-populated as needed and after the /var was mounted and "cp -R -p
/var.copy/* /var" into it.
I'd thought:
# mount_tmpfs tmpfs /var
-- populate /var, as needed
# mount -u /
# tar czpf /somewhere/var.tgz /var
Then, just unpack the tarball onto the newly mounted /var in rc(5).
But, regardless, the point is that there is no preexisting mechanism
in place for this sort of thing? E.g., FBSD had an rc.diskless
(a bit of overkill) that could be modified to achieve these sorts of
results.
Home |
Main Index |
Thread Index |
Old Index