• Adding a hardware swap partition

    From bp@3:633/10 to All on Thu Mar 12 10:00:01 2026
    Is there a "recipe" for adding a hardware swap partition to an
    existing RasPiOS installation? Ideally I'd like a traditional
    layout, with swap situated between / and /usr. I know how to
    do it with FreeBSD during the install process but this particular
    case involves a running, somewhat valuable RasPiOS installation
    and the tools offered on RasPiOS are different enough to warrant
    a study of prior art if it's available.

    What I'd like to do is resize the existing root to roughly its
    present, occupied size, add a swap partition in the freed space
    and then create /usr in the remaining space, copying the old
    /usr to the new, cleaning out usr files from the original root
    partition and mounting the new /usr on the empty mountpoint.

    This needs to be done under single-user mode and I don't know
    how to get at single-user in RasPiOS. It could be done via booting
    from a microSD, but that pitches me into the installer which isn't
    exactly familiar territory.

    In case it matters, this is on an 8GB Pi5 running Bookworm with
    dual monitors and a 1 TB mechanical hard drive. df reports

    Filesystem 1K-blocks Used Available Use% Mounted on
    udev 4081296 0 4081296 0% /dev
    tmpfs 1650304 6512 1643792 1% /run
    /dev/sda2 961067256 61907904 850331260 7% /
    tmpfs 4125728 163136 3962592 4% /dev/shm
    tmpfs 5120 48 5072 1% /run/lock
    /dev/sda1 522230 79520 442710 16% /boot/firmware
    tmpfs 825136 272 824864 1% /run/user/1000

    The need for "real" swap arises when Chromium and Firefox are both
    running with multiple tabs open.

    Thanks for reading, and any suggestions!

    bob prohaska


    --- PyGate Linux v1.5.12
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Thu Mar 12 10:00:01 2026
    On Wed, 11 Mar 2026 16:20:15 -0000 (UTC), bp wrote:

    This needs to be done under single-user mode and I don't know
    how to get at single-user in RasPiOS.

    This is done by modifying the kernel command line -- there should be a bootloader option to do this on a one-time basis before actually
    loading the kernel.

    The option ?single? should do the trick, though I think it will prompt
    for the root password before allowing you in.

    Another option to try is ?init=/bin/bash?.

    These options should be common across Linux kernels, independent of architecture or bootloader.

    --- PyGate Linux v1.5.12
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From The Natural Philosopher@3:633/10 to All on Wed Mar 11 16:43:39 2026
    On 11/03/2026 16:20, bp@www.zefox.net wrote:
    Is there a "recipe" for adding a hardware swap partition to an
    existing RasPiOS installation? Ideally I'd like a traditional
    layout, with swap situated between / and /usr. I know how to
    do it with FreeBSD during the install process but this particular
    case involves a running, somewhat valuable RasPiOS installation
    and the tools offered on RasPiOS are different enough to warrant
    a study of prior art if it's available.

    What I'd like to do is resize the existing root to roughly its
    present, occupied size, add a swap partition in the freed space
    and then create /usr in the remaining space, copying the old
    /usr to the new, cleaning out usr files from the original root
    partition and mounting the new /usr on the empty mountpoint.

    This needs to be done under single-user mode and I don't know
    how to get at single-user in RasPiOS. It could be done via booting
    from a microSD, but that pitches me into the installer which isn't
    exactly familiar territory.


    I don't think that is necessarily true.

    If you create a bootable SD card, you can do all you want to the sda
    disk whilst it's online

    You could also create a swap file in / and add that as an alternative



    In case it matters, this is on an 8GB Pi5 running Bookworm with
    dual monitors and a 1 TB mechanical hard drive. df reports

    Filesystem 1K-blocks Used Available Use% Mounted on
    udev 4081296 0 4081296 0% /dev
    tmpfs 1650304 6512 1643792 1% /run
    /dev/sda2 961067256 61907904 850331260 7% /
    tmpfs 4125728 163136 3962592 4% /dev/shm
    tmpfs 5120 48 5072 1% /run/lock
    /dev/sda1 522230 79520 442710 16% /boot/firmware
    tmpfs 825136 272 824864 1% /run/user/1000

    The need for "real" swap arises when Chromium and Firefox are both
    running with multiple tabs open.

    Yaj well no fine

    I'd add a swap file. work of a few minutes only

    $ dd if=/dev/zero of=/path/to/swapfile bs=1M count=1024 # For 1GB swap file
    $ mkswap /path/to/swapfile
    $ swapon /path/to/swapfile



    Thanks for reading, and any suggestions!

    bob prohaska


    --
    Climate is what you expect but weather is what you get.
    Mark Twain


    --- PyGate Linux v1.5.12
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Jim Jackson@3:633/10 to All on Fri Mar 13 10:00:02 2026
    Newsgroups: comp.sys.raspberry-pi
    From: Jim Jackson <jj@franjam.org.uk>
    Subject: Re: Adding a hardware swap partition
    References: <10os4nv$17t1j$1@dont-email.me>
    Followup-To:

    On 2026-03-11, bp@www.zefox.net <bp@www.zefox.net> wrote:
    Is there a "recipe" for adding a hardware swap partition to an
    existing RasPiOS installation? Ideally I'd like a traditional
    layout, with swap situated between / and /usr.


    AFAIK modern PIOS versions all use merged /usr, as they are based on
    debian which /usr merged. This means that the /usr directory has to
    reside on the root partition. I usually put my swap partition between
    root and /home partitions.

    I'm assuming your PIOS is running systemd so try looking at

    man systemd.swap

    I remember that on a SYSV init system I think I ran mkswap on the disk partition, then added an entry to /etc/fstab like

    /dev/sda2 none swap sw 0 0

    and just rebooted.

    I tend to use a swap file nowadays.

    cheers
    Jim







    --- PyGate Linux v1.5.12
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Fri Mar 13 10:00:02 2026
    On Thu, 12 Mar 2026 15:37:29 -0000 (UTC), bp wrote:

    Lawrence D?Oliveiro <ldo@nz.invalid> wrote:

    This is done by modifying the kernel command line -- there should
    be a bootloader option to do this on a one-time basis before
    actually loading the kernel.

    I can understand editing cmdline.txt and rebooting as a way to get
    single user ...

    No, this is using one of the options in the bootloader menu
    (?advanced?, I think it is) to do a one-time edit to the command line
    for that boot. You don?t want to permanently put the system to booting
    into single-user mode every time, do you?

    --- PyGate Linux v1.5.12
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From bp@3:633/10 to All on Fri Mar 13 10:00:02 2026
    Lawrence D?Oliveiro <ldo@nz.invalid> wrote:
    On Wed, 11 Mar 2026 16:20:15 -0000 (UTC), bp wrote:

    This needs to be done under single-user mode and I don't know
    how to get at single-user in RasPiOS.

    This is done by modifying the kernel command line -- there should be a bootloader option to do this on a one-time basis before actually
    loading the kernel.

    The option ?single? should do the trick, though I think it will prompt
    for the root password before allowing you in.

    Another option to try is ?init=/bin/bash?.

    These options should be common across Linux kernels, independent of architecture or bootloader.

    I can understand editing cmdline.txt and rebooting as a way to get single
    user, but by the time there's anything visible on the monitor the kernel
    is already starting services and well past any opportunity to intervene.

    It looks as if swap files have their advocates. Just how much slower is
    a swap file? It certainly looks easier and might be a good experiment.

    Thanks to everybody for replying!

    bob prohaska


    --- PyGate Linux v1.5.12
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From bp@3:633/10 to All on Fri Mar 13 13:00:01 2026
    Lawrence D?Oliveiro <ldo@nz.invalid> wrote:
    On Thu, 12 Mar 2026 15:37:29 -0000 (UTC), bp wrote:

    Lawrence D?Oliveiro <ldo@nz.invalid> wrote:

    This is done by modifying the kernel command line -- there should
    be a bootloader option to do this on a one-time basis before
    actually loading the kernel.

    I can understand editing cmdline.txt and rebooting as a way to get
    single user ...

    No, this is using one of the options in the bootloader menu
    (?advanced?, I think it is) to do a one-time edit to the command line
    for that boot.

    I'm not familiar with such a menu, how is it invoked?

    You don?t want to permanently put the system to booting
    into single-user mode every time, do you?
    No, but I could edit cmdline.txt, reboot to single-user,
    finish my business, re-edit cmdline.txt and reboot again.

    I was hopeful somebody would respond to my query regarding
    the relative speeds of swapfiles vs swap partitions. If
    they're anywhere close in performance a swapfile seems
    worth trying.

    Thanks for writing!

    bob prohaska


    --- PyGate Linux v1.5.12
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From The Natural Philosopher@3:633/10 to All on Fri Mar 13 11:15:10 2026
    On 13/03/2026 01:26, bp@www.zefox.net wrote:
    I was hopeful somebody would respond to my query regarding
    the relative speeds of swapfiles vs swap partitions. If
    they're anywhere close in performance a swapfile seems
    worth trying.

    That is an interesting thought.

    Google AI sez

    "Key Differences and Performance Factors:

    - Performance: A swap partition is technically faster as it writes
    directly to the disk, bypassing the filesystem, but this advantage is
    rarely noticeable in daily use.

    - Flexibility: Swap files are much easier to resize, create, or delete without modifying disk partitions, making them the preferred choice for
    most modern setups.

    - Fragmentation: On traditional HDDs, a fragmented swap file can be
    slower, but this is not an issue on SSDs.

    - Hard Drive Placement: On spinning HDDs, a partition placed at the
    start of the drive is slightly faster, but this does not apply to SSDs.

    Recommendation:

    For the majority of users (especially on SSDs), a swap file is
    recommended for its convenience without any meaningful loss in speed. A
    swap partition is only recommended if you have specific,
    high-performance needs or are using older, heavily fragmented hard drives. "

    I think that is an interesting summary, the point being made that speed
    is dominated today by disk access times, not CPU cycles in addressing a
    file system.
    And with the demise of spinning rust, there is no seek delay either, so
    the theoretical advantages of an actual partition in the disks low
    sector area, no longer outweigh the operational simplicity of a swap file.

    Like so many other things that grew out of limited RAM and slow spinning
    rust disks, the swap partition is really no longer necessary...


    --
    ?People believe certain stories because everyone important tells them,
    and people tell those stories because everyone important believes them. Indeed, when a conventional wisdom is at its fullest strength, one?s
    agreement with that conventional wisdom becomes almost a litmus test of
    one?s suitability to be taken seriously.?

    Paul Krugman


    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Theo@3:633/10 to All on Fri Mar 13 18:28:05 2026
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 13/03/2026 14:16, Theo wrote:
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    I think that is an interesting summary, the point being made that speed
    is dominated today by disk access times, not CPU cycles in addressing a >> file system.
    And with the demise of spinning rust, there is no seek delay either, so
    the theoretical advantages of an actual partition in the disks low
    sector area, no longer outweigh the operational simplicity of a swap file. >>
    Like so many other things that grew out of limited RAM and slow spinning >> rust disks, the swap partition is really no longer necessary...

    One advantage of a swap partition is that it's a dedicated space - if you start running low on space it may limit the size of swapfile that can be created, which has a knock-on impact on performance.

    I dont think you understand the nature of a swapfile.

    It is a fixed length file.

    Ah, it seems only Windows does variable length files.

    Depending on the filesystem the swapfile may not be backed by physical
    blocks, ie the file exists but the space is not preallocated. It looks like you have to explicitly force that.

    Another reason is if you're using hibernate. You need swap space at least as large as RAM to save out your memory contents to, so that can prevent hibernate working if you are running low on space. Also hibernate/restore is a fairly low-level process and swap partitions are easier to setup for that than swap files.

    Again, you are talking bollocks. Swap files are pre-allocated, of fixed size, and zero filled.

    For swap files, hibernation appears to be more complicated:

    https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition

    indicates you need to tell the kernel the offset of the swapfile within the partition, which suggests that the kernel is reading it directly rather than via the filesystem. That implies the filesystem must allocate it
    contiguously and is not allowed to have any kind of fragmentation. That
    means it could be impossible to set up on a machine that's been running a while.

    Theo

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Jim Diamond@3:633/10 to All on Sat Mar 14 07:30:01 2026
    On 2026-03-11 at 13:20 ADT, bp@www.zefox.net <bp@www.zefox.net> wrote:

    What I'd like to do is resize the existing root to roughly its
    present, occupied size,

    I think you will rue that decision later, unless you are sure that you are never going to add more packages (which will occupy some space in /etc and /var, even with the bulk of the space being in /usr), never do updates
    which may use more space in /boot, /etc/ or /var, and so on.

    I haven't had a separate /usr partition on any system in a long time (and
    I'm wondering why you want to do that), so I can't give any helpful amounts
    on the minimum extra space you should leave. But I strongly advise you to
    give yourself enough extra space in / to handle future updates to your
    system.

    Jim

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Theo@3:633/10 to All on Fri Mar 13 14:16:26 2026
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    I think that is an interesting summary, the point being made that speed
    is dominated today by disk access times, not CPU cycles in addressing a file system.
    And with the demise of spinning rust, there is no seek delay either, so
    the theoretical advantages of an actual partition in the disks low
    sector area, no longer outweigh the operational simplicity of a swap file.

    Like so many other things that grew out of limited RAM and slow spinning rust disks, the swap partition is really no longer necessary...

    One advantage of a swap partition is that it's a dedicated space - if you
    start running low on space it may limit the size of swapfile that can be created, which has a knock-on impact on performance.

    Another reason is if you're using hibernate. You need swap space at least
    as large as RAM to save out your memory contents to, so that can prevent hibernate working if you are running low on space. Also hibernate/restore
    is a fairly low-level process and swap partitions are easier to setup for
    that than swap files.

    Theo

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From The Natural Philosopher@3:633/10 to All on Fri Mar 13 16:01:50 2026
    On 13/03/2026 14:16, Theo wrote:
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    I think that is an interesting summary, the point being made that speed
    is dominated today by disk access times, not CPU cycles in addressing a
    file system.
    And with the demise of spinning rust, there is no seek delay either, so
    the theoretical advantages of an actual partition in the disks low
    sector area, no longer outweigh the operational simplicity of a swap file. >>
    Like so many other things that grew out of limited RAM and slow spinning
    rust disks, the swap partition is really no longer necessary...

    One advantage of a swap partition is that it's a dedicated space - if you start running low on space it may limit the size of swapfile that can be created, which has a knock-on impact on performance.

    I dont think you understand the nature of a swapfile.

    It is a fixed length file.


    Another reason is if you're using hibernate. You need swap space at least
    as large as RAM to save out your memory contents to, so that can prevent hibernate working if you are running low on space. Also hibernate/restore
    is a fairly low-level process and swap partitions are easier to setup for that than swap files.

    Again, you are talking bollocks. Swap files are pre-allocated, of fixed
    size, and zero filled.


    Theo

    --
    You can get much farther with a kind word and a gun than you can with a
    kind word alone.

    Al Capone




    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Kees Nuyt@3:633/10 to All on Fri Mar 13 22:25:32 2026
    On 2026-03-13 02:26, bp@www.zefox.net wrote:

    I was hopeful somebody would respond to my query regarding
    the relative speeds of swapfiles vs swap partitions. If
    they're anywhere close in performance a swapfile seems
    worth trying.

    Run:
    vmstat -t 10 60
    in a terminal while you are doing your daily tasks in other
    windows to see how much swap I/O there really is.

    This command does 60 measurements with an interval of 10
    seconds, the si and so columns show the swap I/O.

    Usually it is not much, so I wouldn't worry too much about
    performance.
    --
    Regards,
    Kees

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From The Natural Philosopher@3:633/10 to All on Fri Mar 13 21:50:20 2026
    On 13/03/2026 18:28, Theo wrote:
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 13/03/2026 14:16, Theo wrote:
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    I think that is an interesting summary, the point being made that speed >>>> is dominated today by disk access times, not CPU cycles in addressing a >>>> file system.
    And with the demise of spinning rust, there is no seek delay either, so >>>> the theoretical advantages of an actual partition in the disks low
    sector area, no longer outweigh the operational simplicity of a swap file. >>>>
    Like so many other things that grew out of limited RAM and slow spinning >>>> rust disks, the swap partition is really no longer necessary...

    One advantage of a swap partition is that it's a dedicated space - if you >>> start running low on space it may limit the size of swapfile that can be >>> created, which has a knock-on impact on performance.

    I dont think you understand the nature of a swapfile.

    It is a fixed length file.

    Ah, it seems only Windows does variable length files.

    Depending on the filesystem the swapfile may not be backed by physical blocks, ie the file exists but the space is not preallocated. It looks like you have to explicitly force that.
    I posted the magic spell
    you create a file and write the required length using dd with zeros.

    sudo dd if=/dev/zero of=/var/swapfile bs=1K count=4M etc.


    Another reason is if you're using hibernate. You need swap space at least >>> as large as RAM to save out your memory contents to, so that can prevent >>> hibernate working if you are running low on space. Also hibernate/restore >>> is a fairly low-level process and swap partitions are easier to setup for >>> that than swap files.

    Again, you are talking bollocks. Swap files are pre-allocated, of fixed
    size, and zero filled.

    For swap files, hibernation appears to be more complicated:

    https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition

    indicates you need to tell the kernel the offset of the swapfile within the partition, which suggests that the kernel is reading it directly rather than via the filesystem. That implies the filesystem must allocate it contiguously and is not allowed to have any kind of fragmentation. That means it could be impossible to set up on a machine that's been running a while.

    Raspberry Pi OS (RaspiOS) does not natively support traditional ACPI hibernation (suspend-to-disk) out of the box

    Because Raspberry Pi lacks proper ACPI support, traditional hibernation
    is difficult and often requires a custom kernel, though it is "in
    theory" possible.

    Workaround: Users often use a swapfile combined with systemd-sleep to enable this functionality.

    GPIO Shutdown: A common "shutdown" alternative is to connect a button
    to GPIO3 to perform a safe shutdown rather than true hibernation.


    Theo

    --
    ?It is dangerous to be right in matters on which the established
    authorities are wrong.?

    ? Voltaire, The Age of Louis XIV


    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Jim Diamond@3:633/10 to All on Mon Mar 16 10:00:02 2026
    On 2026-03-15 at 11:02 ADT, The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 15/03/2026 13:25, druck wrote:
    The whole separate partition thing was way back in the days of
    unreliable filing systems on small discs. It just isn't needed these
    days when you can just have everything on one large partition and not
    have to try and work out the high water mark needed for each part.

    Whilst that is true, there are newer reasons for partitioning..

    - You cant fill a root partition with user data if that is on a separate partition.
    - You cant e.g. fill /var with e.g. MySQL data if that is on a separate partition..

    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.

    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.

    OP, where are you... ?

    Jim

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Josef Möllers@3:633/10 to All on Sun Mar 15 17:02:06 2026
    On 3/15/26 15:02, The Natural Philosopher wrote:
    On 15/03/2026 13:25, druck wrote:
    The whole separate partition thing was way back in the days of
    unreliable filing systems on small discs. It just isn't needed these
    days when you can just have everything on one large partition and not
    have to try and work out the high water mark needed for each part.

    Whilst that is true, there are newer reasons for partitioning..

    - You cant fill a root partition with user data if that is on a separate partition.

    I'm helping a local IT person with Linux (he's a Windows person) and we
    have had a notebook from a customer which didn't start the GUI for
    exactly that reason: she had kept files and large files and huge files
    in her $HOME and at one point the partition was 100% full, no space left
    for the GUI temporary files.
    My friend sold her a new disk and I partitioned it such that there is a
    root partition and a /home and we haven't heard from her since.

    Just thought I'd share some hands-on experience.

    Josef

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From The Natural Philosopher@3:633/10 to All on Sun Mar 15 14:02:43 2026
    On 15/03/2026 13:25, druck wrote:
    The whole separate partition thing was way back in the days of
    unreliable filing systems on small discs. It just isn't needed these
    days when you can just have everything on one large partition and not
    have to try and work out the high water mark needed for each part.

    Whilst that is true, there are newer reasons for partitioning..

    - You cant fill a root partition with user data if that is on a separate partition.
    - You cant e.g. fill /var with e.g. MySQL data if that is on a separate partition..

    That is while performance issues are completely irrelevant with large
    SSDs, some security issues still remain.

    Do my NAS server has a small but adequate root partition, and separate
    var, home and backup partitions



    --
    ?Politics is the art of looking for trouble, finding it everywhere,
    diagnosing it incorrectly and applying the wrong remedies.?
    ? Groucho Marx


    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Mon Mar 16 10:00:02 2026
    On Sun, 15 Mar 2026 18:04:10 -0300, Jim Diamond wrote:

    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.

    There was this conventional separation into two levels:

    Absolutely core, indispensable stuff:

    /bin
    /lib
    /sbin

    Somewhat less important stuff:

    /usr/bin
    /usr/lib
    /usr/sbin

    The core point being that things in the first group had no
    dependencies on things in the second group. So, for example, there
    would be no executable in /bin or /sbin that depended on a shared
    library in /usr/lib. But everything could safely depend on things in
    the first group, since pretty much by definition, you wouldn?t have a functional system without that.

    That distinction has gone out the window nowadays. It was too much
    trouble to maintain, since nobody really cares about it any more.
    Hence the merging of the two groups.

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From bp@3:633/10 to All on Mon Mar 16 14:30:01 2026
    Jim Diamond <zsd@jdvb.ca> 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-)

    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.

    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.

    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.

    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.

    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.
    Whether /home/, /var/ and /tmp/ can be links to /usr is less clear to
    me at this point.

    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.

    OP, where are you... ?

    Busy trying to drink from a firehose 8-) And, thanks to those at the pumps!

    bob prohaska


    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Mon Mar 16 14:30:01 2026
    On Sun, 15 Mar 2026 22:53:24 -0000 (UTC), bp wrote:

    The system was short of memory. It needed swap to cope this those
    occasions.

    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.

    It may still be true with moving-head disks, but all that geometrical information is hidden from the OS these days, behind linear sector
    addressing done within the drive itself.

    I think the basic thinking nowadays is that, if you?ve having to do
    disk I/O, you?ve already lost several orders of magnitude in transfer
    speed, and no amount of trying to optimize head movement is going to
    make much of a difference to that.

    In other words, if you have to swap, your system is in trouble,
    anyway.

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From The Natural Philosopher@3:633/10 to All on Mon Mar 16 12:38:21 2026
    On 15/03/2026 21:04, Jim Diamond wrote:
    On 2026-03-15 at 11:02 ADT, The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 15/03/2026 13:25, druck wrote:
    The whole separate partition thing was way back in the days of
    unreliable filing systems on small discs. It just isn't needed these
    days when you can just have everything on one large partition and not
    have to try and work out the high water mark needed for each part.

    Whilst that is true, there are newer reasons for partitioning..

    - You cant fill a root partition with user data if that is on a separate
    partition.
    - You cant e.g. fill /var with e.g. MySQL data if that is on a separate
    partition..

    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.


    Agreed


    --
    Any fool can believe in principles - and most of them do!




    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Richard Kettlewell@3:633/10 to All on Mon Mar 16 09:54:11 2026
    bp@www.zefox.net writes:
    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.

    Separate /usr probably still works, but I doubt it gets much testing.

    It?s really not going to make swapping significantly faster. Nor is
    trying to find an optimal location for swap - you have quite possibly
    already spent more time on the matter in this thread than you could ever possibly save.

    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.

    $ ls -ld /sbin
    lrwxrwxrwx 1 root root 8 Nov 17 2023 /sbin -> usr/sbin

    However I believe this is neither here nor there since initramfs is
    responsible for mounting /usr if it?s separate. If it fails to mount you
    will most likely end up in an initramfs shell (which is a pretty
    reasonable recovery environment).

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

    You might run into trouble with AppArmor. Not particularly hard to fix.


    If all this is about adding some swap space then you are massively overcomplicating matters. If there?s no unpartitioned space left then
    just create a swapfile and get on with your life. If you do anything
    more complicated than that then make sure your backups are up to date
    first.

    --
    https://www.greenend.org.uk/rjk/

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Theo@3:633/10 to All on Mon Mar 16 16:01:36 2026
    Lawrence D?Oliveiro <ldo@nz.invalid> wrote:
    On Sun, 15 Mar 2026 18:04:10 -0300, Jim Diamond wrote:

    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.

    There was this conventional separation into two levels:

    Absolutely core, indispensable stuff:

    /bin
    /lib
    /sbin

    Somewhat less important stuff:

    /usr/bin
    /usr/lib
    /usr/sbin

    The core point being that things in the first group had no
    dependencies on things in the second group. So, for example, there
    would be no executable in /bin or /sbin that depended on a shared
    library in /usr/lib. But everything could safely depend on things in
    the first group, since pretty much by definition, you wouldn?t have a functional system without that.

    It was also that you could then make /usr an NFS share, to be shared by all
    the computers on the network. /bin /lib etc would be local to the machine (perhaps in ROM, on a small HDD or even on floppy) which was just enough to connect to the network, mount the NFS and load all the real stuff from /usr over the network. If the NFS mount failed for some reason, you still had
    some local tools to fix problems.

    Of course network boot has moved on a lot since then.

    Theo

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Richard Kettlewell@3:633/10 to All on Mon Mar 16 12:18:24 2026
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 16/03/2026 09:54, Richard Kettlewell wrote:
    bp@www.zefox.net writes:
    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.
    Separate /usr probably still works, but I doubt it gets much
    testing.

    Can you guarantee that /usr will be mounted at boot time?

    It depends what you mean by ?boot time?. On a mainstream Linux system
    /usr needs to be mounted by the time initramfs hands over to the real
    root and init. So in practice unit files/init scripts/etc can safely
    assume it?s mounted.

    I remember having to use /bin/sh in init.d scripts because
    /usr/bin/ksh didn't exist yet. That may have changed.

    A long time ago, and not on an rpi. AIX or HP/UX or something.

    Historically making sure /usr was mounted (if it was separate) was
    init?s job (via an init.d scripts), so very early in boot, /usr might
    not have been there. But mounting filesystems was, necessarily, a pretty
    early step in the boot process, so by the time it was running (say) the
    init script for an X display manager, /usr would have been mounted.

    For all I know HPUX and AIX still work that way, I?m glad to say I
    don?t have to care any more.

    --
    https://www.greenend.org.uk/rjk/

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Richard Harnden@3:633/10 to All on Mon Mar 16 11:49:01 2026
    On 16/03/2026 09:54, Richard Kettlewell wrote:
    bp@www.zefox.net writes:
    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.

    Separate /usr probably still works, but I doubt it gets much testing.

    Can you guarantee that /usr will be mounted at boot time?

    I remember having to use /bin/sh in init.d scripts because /usr/bin/ksh
    didn't exist yet. That may have changed.

    A long time ago, and not on an rpi. AIX or HP/UX or something.

    Anyway, I'd keep /usr under / just to be safe.

    /home on its own partition.



    It?s really not going to make swapping significantly faster. Nor is
    trying to find an optimal location for swap - you have quite possibly
    already spent more time on the matter in this thread than you could ever possibly save.

    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.

    $ ls -ld /sbin
    lrwxrwxrwx 1 root root 8 Nov 17 2023 /sbin -> usr/sbin

    However I believe this is neither here nor there since initramfs is responsible for mounting /usr if it?s separate. If it fails to mount you
    will most likely end up in an initramfs shell (which is a pretty
    reasonable recovery environment).

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

    You might run into trouble with AppArmor. Not particularly hard to fix.


    If all this is about adding some swap space then you are massively overcomplicating matters. If there?s no unpartitioned space left then
    just create a swapfile and get on with your life. If you do anything
    more complicated than that then make sure your backups are up to date
    first.



    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Lawrence D?Oliveiro@3:633/10 to All on Tue Mar 17 10:30:02 2026
    On 16 Mar 2026 16:01:36 +0000 (GMT), Theo wrote:

    It was also that you could then make /usr an NFS share, to be shared
    by all the computers on the network. ...

    Of course network boot has moved on a lot since then.

    With PXE boot and the Linux pivot_root() system call, you could have
    the entire root file system mounted via NFS.

    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Jim Diamond@3:633/10 to All on Wed Mar 18 10:00:02 2026
    On 2026-03-15 at 19:53 ADT, bp@www.zefox.net <bp@www.zefox.net> wrote:
    Jim Diamond <zsd@jdvb.ca> 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)
  • From bp@3:633/10 to All on Thu Mar 19 16:00:02 2026
    Jim Diamond <zsd@jdvb.ca> wrote:
    On 2026-03-15 at 19:53 ADT, bp@www.zefox.net <bp@www.zefox.net> wrote:
    Jim Diamond <zsd@jdvb.ca> 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.

    If I was going to set up swap it seemed prudent to make it as fast
    as I reasonably could. I didn't (and so far still don't) have a clear
    idea how much difference a swap file versus a swap partition makes.



    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.)


    I'm a little embarassed to admit I didn't know /sbin was merely a link.
    /sbin is part of / on FreeBSD and I never thought to check RasPiOS.



    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 /.


    Typically I put home on /usr/home when I'm setting up a machine by
    hand. In this case I planned to leave it in /, supposing it wasn't
    important to the question at hand.

    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.


    Point taken 8-)

    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.


    The plan was to resize / to what's occupied now, add a 16GB swap partitiion, add another partition after that and copy the contents of usr to the new partition. The next step would be to clean out the old /usr tree and mount
    the new usr partition on the old mountpoint. That would free space in /.

    Since /sbin isn't a freestanding directory, this seems impossible without booting from a separate root device, likely a microSD. I didn't see this
    hurdle coming, at all. It isn't a fatal blunder, but it's a blunder.

    In the meantime it has developed the machine has a swapfile, but it
    was limited to 2GB, which on an 8GB machine makes little sense. The
    limit is now removed and the machine has about 16GB swap.

    It'll take some time to see how the machine behaves. At the moment
    YouTube seems quite sluggish with only 80MB swap in use. Perhaps
    my notion that lack of memory was the main culprint is mistaken.



    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.

    I've definitely gotten a snootful, but have learned at lot in the bargain.

    Thanks for writing,

    bob prohaska


    --- PyGate Linux v1.5.13
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Richard Kettlewell@3:633/10 to All on Thu Mar 19 08:52:30 2026
    bp@www.zefox.net writes:
    If I was going to set up swap it seemed prudent to make it as fast
    as I reasonably could. I didn't (and so far still don't) have a clear
    idea how much difference a swap file versus a swap partition makes.

    The only way to be find out is to measure it under a representative
    workload, but the likely outcome is that the difference will be
    negligible or undetectable.

    Since /sbin isn't a freestanding directory, this seems impossible
    without booting from a separate root device, likely a microSD. I
    didn't see this hurdle coming, at all. It isn't a fatal blunder, but
    it's a blunder.

    You seem to have a misapprehension about /sbin. It?s not some kind of
    ?stuff you need to boot? directory. It?s for utilities used for system administration and other root-only commands.

    The way to make a separate-/usr system bootable is to ensure that the
    initramfs mounts /usr, as already discussed. You don?t need a separate
    device for that.

    --
    https://www.greenend.org.uk/rjk/

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