BBS:      TELESC.NET.BR
Assunto:  Re: Adding a hardware swap partition
De:       Jim Diamond
Data:     Wed, 18 Mar 2026 10:00:02 +1100
-----------------------------------------------------------
On 2026-03-15 at 19:53 ADT, bp@www.zefox.net  wrote:
> Jim Diamond  wrote:

>> Yes, but that has nothing much to do with the OP's plan to put /usr on its
>> own partition.  He didn't indicate where /home was going, but if he puts it
>> on the root partition, he can still fill that up.  And if /var is on /root,
>> also problems.

>> Which is why I was curious about why he wants to a separate /usr partition.

> Since you ask...8-)

Thanks.  :-)

> On rare occasions my 8GB Pi5 slowed to a crawl.  Eventually I realized it
> was happening when I had two browsers (firefox and chromium) both running
> with too many tabs open.  The system was short of memory.  It needed swap
> to cope this those occasions.

So far, I follow you.

> Hardware swap is _supposed_ to be faster than a swap partition, which
> made it, at least in principle, more attractive. Also, in principle, a
> physical swap partition can be placed _between_ (in the sense of seek
> stroke) /uar and /, minimizing the amount of head movevent.  This was true
> in the days of st506 disks, I'm not sure how true it is with SATA.  So, I
> inquired about how this might be done under RasPiOS. It's not hurgely
> hard under FreeBSD and I thought there might be some nifty tools for the
> purpose in RasPiOS.

Assuming you are using a mechanical disk (I don't think you said anywhere,
did you?), there is some (a smallish?) gain to be had for minimizing head
movement.  If you are using an SSD through some SATA-USB dongle, then you
can completely forget about worrying where on the disk to put swap... the
end is fine.

Carrying on with the assumption that you are using a mechanical disk...

Someone else already pointed out that /sbin is (on Raspberrry Pi OS and
many others) just yet another sym link.  On current systems where /bin is
just a link to /usr/bin, except for occasional updates for log files, I
doubt that your system would be accessing / (the "without /usr" version of
/) very often.  (Unless your /tmp is not a tmpfs and you are using /tmp a
lot, for whatever reason.)

You also didn't tell us where /home is going to be.  Were you thinking
of having it on its own partition?  That decision may be more significant
than any possible benefit from separating /usr from /.

> The answers received have now led me to question the orignal premises.
> No nifty tools have come to light.  The relative speed of
> file-vs-hardware swap haven't been quantified.  The need for occasional
> swap use remains, but it's sporadic.  Maybe a swapfile is good
> enough.... it's certainly easier.

That is true.

> It was a surprise to learn that a single partition is somehow required
> for RasPiOS to function correctly.  If true, it's a good thing to know.

You mean "a single partition for / and /usr" ?
I'm not sure that it is required, but I wouldn't be surprised if having
/usr on its own partition caused problems.  But I'm happy to be educated
about that!

>> Back in the good old days there were enough programs in /bin (which was an
>> actual directory, not a link to /usr/bin) to recover a system with disk
>> errors (when possible, anyway).  But now that /bin is a link, I wonder if
>> the system will even boot properly, since "user space" would have to mount
>> /usr before almost all (all?) programs are available.  Including systemd.

> Given that RasPiOS has an /sbin directory, I'm pretty sure the machine
> will come up at worst in single-user if /usr can't be mounted normally.

See above.

> Whether /home/, /var/ and  /tmp/  can be links to /usr is less clear to 
> me at this point.

/home certainly can, and if /usr gets mounted "early enough" during boot,
maybe /var and /tmp can be too.  But if you do that, you now have a
minuscule amount of stuff sitting there by itself on /, and I can't imagine
the benefit of having swap between "almost nothing" and "almost everything".

> The original plan would have left the machine with a /root of around
> 100GB and a /usr of around 800GB so running out of space isn't a problem.

OK.  I thought it your original message you said something about making /
as small as possible.

>> OP, where are you... ?

> Busy trying to drink from a firehose 8-)

Tricky to not drown.  Although I've seen dogs trying to drink from garden
hoses, it might just be a matter of scale.

Cheers.
                                Jim

--- PyGate Linux v1.5.13
 * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)

-----------------------------------------------------------
[Voltar]