NetBSD-Users archive

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

Re: create /tmp with ffs vs. tmpfs ?



On Mon, Aug 12, 2024 at 07:30:20AM -0400, Greg Troxel wrote:
> Steve Rikli <sr%genyosha.net@localhost> writes:
> 
> > 1) is my understanding correct? I.e. does tmpfs use main memory for
> >    backing, rather than swap or something else?
> 
> It uses virtual memory which can be paged.  So if you have swap space
> configured, it can be bigger than physical memory.  However, things in
> /tmp will compete with other memory usage.

Makes sense. It was that competition with other memory usage I was
hoping to avoid for this particular little system. With the newer and
larger machine I may not bother.

> > 2) can I configure /tmp as ffs rather than tmpfs?
> 
> Absolutely.   tmpfs is relatively new in the history of unix and having
> tmp as a real filesystem is entirely reasonable.

Oh, yes. To be clear, I was actually asking "can I?" in NetBSD with
sysinst, not more generally. :-)  Most of my systems (or at least the
servers) have separate /tmp with the default native unix filesystem
rather than tmpfs or other mfs.

> So you can make a 4GB /tmp
> separately so that when /tmp is full / is still ok.  Or you can just
> have one giant partition and take your chances, with more efficiency.

I'm generally OK with one big / e.g. for laptops and other "single user"
sort of systems, but for a multi-user system or a server with several
services active, I prefer separate /, /var/, /tmp/ and swap to start,
for much the same reasons you said.

> 128G isn't that big a disk.

Everything is relative. ;-)

My first NetBSD (2.0 IIRC) systems were SPARC with 4 or 9GB SCSI HDD.
Things are different now. :)  But I must say, I'm enjoying coming back
to NetBSD again.

> Definitely add swap, maybe even more then 4G depending on what you want
> to do.   But 4G is probably enough for anything you want to put up with
> waiting for anyway.

So far it has been, e.g. 1GB RAM + 4GB swap has been working for FreeBSD
world building. But i386 is apparently dropping out circa FreeBSD 15 so
I'm getting ready for moving this system to NetBSD.

> There is a really good question here.  Which is, for some reasonable
> workloads, building programs that use 100M of /tmp and 1.5 GB of /tmp, how
> things go with
> 
>   both system 4 GB swap
> 
>   A) big / with tmp just part of /
> 
>   B) big / with 2GB tmpfs
> 
> I am really not sure what is better.  I suspect tmpfs performance is
> better for the times when /tmp is only 100-200 MB or so.  I am really
> not sure how it would go with larger.

I'd guess if you have a system with enough RAM, that /tmp on tmpfs will
win, but 1GB RAM in this little VIA C7 ITX is all you get. :)

Now, I've been assuming that a src build for NetBSD kernel + world may
not run with 1GB RAM, ~250MB /tmp on tmpfs ("25%" from sysinst), and
whatever swap sysinst will default to with this 128GB SSD; but maybe
I'm being too pessemistic?

Maybe I should just try it. :)  Realistically though, I will probably
end up using sysupgrade for this little old i386 system.

> When building packages, some are ridiculous, e.g. thunderbird, which I
> think needs around 19 GB of $WRKDIR space.  I have code in mk.conf.local
> to flip from /tmp/work to /nfs/ztmp/work-$hostname where the latter is
> over NFS and a zfs filesystem on a big disk.  It's slow but the builds
> finish.  So you may be able to use a smallish tmpfs and point specific
> big jobs elsewhere.  That's more work but higher performance - after you
> get it right.

That's a good point; I'd done package and ports builds in the past to
NFS, but since most of my systems since then have "enough" diskspace
I've usually done it locally. I can remember some builds back then
being faster to a good NFS server than the (usually slow, small) local
disk, but I wasn't putting SSD in i386 or SPARC back then.  ;-)

Thanks,
sr.


Home | Main Index | Thread Index | Old Index