Reducing ram used by Puppy

Moderator: Forum moderators

Post Reply
User avatar
wizard
Posts: 2071
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2814 times
Been thanked: 746 times

Reducing ram used by Puppy

Post by wizard »

Reducing ram used by Puppy

Computers using Grub4Dos as the boot loader.
Use Geany editor.
-open the file: menu.lst
-find: pfix=fsck
-replace with: pfix=nocopy,fsck
Note: nocopy and fsck are separated by a comma and no spaces
-save

Computers using Grub2 as the boot loader.
Use Geany editor.
-open the file: grub.cfg
-find: pfix=fsck
-replace with: pfix=nocopy,fsck
Note: nocopy and fsck are separated by a comma and no spaces
-save

In addition to reducing ram use, you will also see a slightly faster boot speed.

wizard

Big pile of OLD computers

JusGellin
Posts: 744
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 90 times
Been thanked: 92 times

Re: Reducing ram used by Puppy

Post by JusGellin »

@wizard
How would that work for KLs?

For one I'm using - KLV-vmHost-rc3, it doesn't have pfix=fsck in its grub.cfg.
It does have something called w_changes=RAM2 though.
Would something like you show just be added somewhere on the linux line?
Also is the order it is placed on the line important?

Thanks

User avatar
rockedge
Site Admin
Posts: 6813
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2965 times
Been thanked: 2793 times
Contact:

Re: Reducing ram used by Puppy

Post by rockedge »

@JusGellin,

KLV can't use the Puppy Linux kernel command line parameter and options like pfix=fsck. The initrd is different.

There is a list of the KLV parameters I'll dig out the link for

I'll consult @wiak if we can manage an additional command line option for a something similar in KLV

User avatar
Chelsea80
Posts: 379
Joined: Tue Mar 09, 2021 12:44 am
Has thanked: 48 times
Been thanked: 81 times

Re: Reducing ram used by Puppy

Post by Chelsea80 »

@wizard

wizard wrote: Tue Oct 22, 2024 9:33 pm

Reducing ram used by Puppy

Computers using Grub4Dos as the boot loader.
Use Geany editor.
-open the file: menu.lst
-find: pfix=fsck
-replace with: pfix=nocopy,fsck
Note: nocopy and fsck are separated by a comma and no spaces
-save

Computers using Grub2 as the boot loader.
Use Geany editor.
-open the file: grub.cfg
-find: pfix=fsck
-replace with: pfix=nocopy,fsck
Note: nocopy and fsck are separated by a comma and no spaces
-save

In addition to reducing ram use, you will also see a slightly faster boot speed.

wizard

Interesting and thank you.

I'm not the brightest bulb in the internal workings of Puppy, so looked into fsck.

An AI answer came back as (which can be and has been sometimes misleading):

What does fsck do in Puppy Linux

Sources
forum.manjaro.org favicon
puppylinux-woof-ce.github.io favicon
oldforum.puppylinux.com favicon
reddit.com favicon
forums.opensuse.org favicon

Answer
Fsck (file system check) is an important utility in Puppy Linux that checks and repairs file systems. Here are the key points about fsck in Puppy Linux:

Purpose and Function
Fsck examines the file system for errors and inconsistencies, and can repair many common issues.
It helps ensure the integrity and stability of the file system.

Usage in Puppy Linux
Fsck can be run automatically at boot time by adding the "pfix=fsck" boot parameter.
This tells Puppy to perform a file system check during the boot process.
It's commonly used to check and repair the Puppy save file, which stores persistent changes.

When It Runs
With "pfix=fsck", fsck will run at boot time before mounting file systems.
It only runs a full check if the file system is marked as "dirty" or if the maximum mount count is reached.
The maximum mount count and check interval can be configured with tune2fs.

Benefits
Helps prevent data corruption and file system errors
Can fix issues that may prevent Puppy from booting properly
Maintains the health of the save file and storage devices

Manual Usage
Fsck can also be run manually from a live Puppy USB if needed to repair a system that won't boot

By using fsck regularly, either automatically or manually, Puppy Linux users can help maintain the stability and reliability of their systems. The "pfix=fsck" boot option provides a convenient way to integrate file system checks into the normal boot process.

So my question is:

Does the benefit of reducing RAM use (by how much?) with a slightly faster boot speed outweigh the 'security' of having fsck run at boot time?

Chelsea80

1. BionicPup32+28 19.03 - Linux 4.9.163 - lxpup - 32-pae [i686] - (UPup Bionic Beaver)
....Frugal Install - Internal HDD - Gateway MX8716b - HDD 120GB - RAM 2GB

2. Friendly-Bionic32 v1.1
....USB Stick 2GB

User avatar
wizard
Posts: 2071
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2814 times
Been thanked: 746 times

Re: Reducing ram used by Puppy

Post by wizard »

@Chelsea80

Does the benefit of reducing RAM use (by how much?) with a slightly faster boot speed outweigh the 'security' of having fsck run at boot time?

The change from pfix=fsck to pfix=nocopy,fsck does not negate fsck at boot. Nocopy is a separate parameter and simply reduces the amount of Puppy that is copied and stored in ram. The amount varies with each distro.

Thanks
wizard

Big pile of OLD computers

User avatar
Chelsea80
Posts: 379
Joined: Tue Mar 09, 2021 12:44 am
Has thanked: 48 times
Been thanked: 81 times

Re: Reducing ram used by Puppy

Post by Chelsea80 »

@wizard

OK. Thanks for the breakdown.

So now my understanding is that nocopy and fsck are two different requests combined into one request.

This is what AI (again) says about nocopy

What does nocopy do in Puppy Linux

Sources
linuxinsider.com favicon
oldforum.puppylinux.com favicon
puppylinux-woof-ce.github.io favicon
reddit.com favicon

Answer
The "nocopy" option in Puppy Linux affects how the system loads files into RAM during boot. Here are the key points about the nocopy option:

Purpose of nocopy
By default, Puppy Linux copies certain system files (SFS files) into RAM during boot for faster performance.
The "nocopy" option prevents this copying, keeping the files on the boot media instead of loading them into RAM.

Effects of using nocopy
Faster boot: Boot time is reduced since files are not copied to RAM.
Slower running: Overall system performance may be slower since files are accessed from the boot media rather than RAM.
Lower RAM usage: Less RAM is used since files are not copied into memory.

When to use nocopy
On systems with limited RAM, to prevent filling up memory.
When you want a quicker boot and don't mind slightly slower performance.
If you plan to install large programs and need to conserve RAM.

How to use nocopy
Add "pfix=nocopy" to the boot parameters.
This tells Puppy Linux not to copy the SFS files into RAM during boot.

The nocopy option provides a trade-off between boot speed, runtime performance, and RAM usage. It can be useful for optimizing Puppy Linux on systems with limited resources or for specific use cases.

Told you I wasn't the brightest bulb although my Wattage has just been increased a little.

Keep up the good info posts :thumbup2:

Chelsea80

1. BionicPup32+28 19.03 - Linux 4.9.163 - lxpup - 32-pae [i686] - (UPup Bionic Beaver)
....Frugal Install - Internal HDD - Gateway MX8716b - HDD 120GB - RAM 2GB

2. Friendly-Bionic32 v1.1
....USB Stick 2GB

User avatar
wiak
Posts: 4243
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 70 times
Been thanked: 1257 times
Contact:

Re: Reducing ram used by Puppy

Post by wiak »

rockedge wrote: Tue Oct 22, 2024 11:16 pm

@JusGellin,

KLV can't use the Puppy Linux kernel command line parameter and options like pfix=fsck. The initrd is different.

There is a list of the KLV parameters I'll dig out the link for

I'll consult @wiak if we can manage an additional command line option for a something similar in KLV

A somewhat major reason I didn't include auto-fsck support (not yet or as priority anyway):

FR initrd was designed to be generic meaning it doesn't care what the root filesystem contains, which is why it is so useful in booting most anything.

Likeliest time an fsck 'may' be needed is sudden power failure or holding off button. However to account for that would need a flag or similar in the root filesystem that gets set as unclean until proper shutdown marks it as clean. If unclean that signifies to possibly do an automatic fsck on next boot. Puppy probably has this flag in its main root filesystem. The Puppy initrd is not generic so no doubt looks for that. Other distro's will name and set such facility differently - likely therefore need at least somewhat non-generic initrd to thus handle such fsck facility.

Second point is that it is excessive in my opinion to force an fsck regularly in other circumstances. Crazy idea to me. You can always manually check partitions (or save image file if using save file rather than a save folder) when you want to or suspect issues. But let's imagine we want to force fsck on boot - aside from that flag situation, could it simply be forced anyway by extra code in FR initrd. Well, yes. Really it is just a matter prior to mounting partition to fsck it... or if a .ucimg savefile is detected (e.g. for use booting from ntfs or vfat) then just arrange to fsck that prior to mounting.

Needs a check format type function so correct fsck routine is used, but FR initrd already has one (though its 'case' statement would likely need slightly expanded to account for other filesystem types).

And of course is simple indeed to add new kernel line option to signify fsck force - one line FR initrd/init code addition.

In fact, savefile is easiest - just everytime prior to mounting one of these just make fsck of raw file happen...

But what about save folder, which is what most all prefer to use? Problem there is - where is the upper_changes being stored? Answer is usually the bootfrom partition, so that would need fsck'd. However if w_changes says to put upper_changes elsewhere then that alternative partition would need fsck'd. I'd argue that bootfrom partition should also be fsck'd in that case too since other components being used from there anyway.

All in all that is not difficult to arrange (though the flexibility of FR initrd alternative locations for everything does mean several related code lines would need to be added in several initrd/init code places.

One last thing, it seems to me, is that the FR initrd would have to have an fsck binary included (presumably with dependencies or static compiled).

Will I be doing this? Maybe one day, but then again... is not at all a soon priority and especially since it is always easy to boot a live system (or any distro, including KL, on a different partition or usb stick) and use that to fsck away at whatever you suspect or want to fsck anytimg (my own preferred simple approach; keeping FR build components as simple as possible to use and understand was an original part of the design idea in fact, so using different system utility for special purpose is to be expected).

Perhaps I have the wrong idea about what needs fsck'd such that I should lose sleep at night till I incorporate the facility, but five years since FR was created I can't say the omission matters to me personally since it isn't something I'd likely force on my grub kernel line anyway. Main thing though is I have other ideas I want to get on with that really interest me whereas auto use of fsck is not essential to me at all. Nice Puppy has that for non-technical users to get an fsck done automatically without them knowing anything about it. However I really don't feel that permanent pfix=fsck is a great thing to use.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
wiak
Posts: 4243
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 70 times
Been thanked: 1257 times
Contact:

Re: Reducing ram used by Puppy

Post by wiak »

I just thought I'd add to the above regarding another facility I haven't yet (and maybe won't) incorporate in FR initrd; one that I've considered now and again: encrypted filesystem or filesystem parts.

Again, incorporating that (for decryption during boot) would require additional binaries in the skeleton FR initrd and increase its code complexity (which could nevertheless be done of course). Fact is I don't like doing that because to me such increased complexity isn't necessary.

I feel that the main operating system doesn't at all need encrypted. Why would it???!

What people want to encrypt is simply their data (private information) and not always. Encryption/decryption involved some overhead in practice and if a person really wants a private encrypted storage location that can be done in userland after booting is complete. At least that would be my own preference: I'd set aside a partition or directory, make it encrypted from an already booted system, and I'd decrypt its contents from same already booted situation. Overall I think it verges on clumsy to put too much such user(rather than system)-related functionality into an initrd. I utterly hate the likes of BitLocker in Windows for example - what an (unnecessary) pain I find that boot partition encrypted situation in practice.

Of course others will disagree, but FR was designed to be as simple a build system as possible (involving as simple to read and understand code/scripts as possible) because it is that overall simplicity in terms of generic nature and build system methodology that makes it so accessible to most anyone wanting to create most any form of distro a user wants to. Funnily enough that same simplicity is what makes it so powerful in actual practice - including its abilities with sfs or uncompressed addons, simple layer numbering allowing rollbacks, and multi-instance power.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
Jasper
Posts: 1696
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 867 times
Been thanked: 352 times

Re: Reducing ram used by Puppy

Post by Jasper »

Is no-one going to mention creating 'Swap' files?

Maybe a new thread with reasons why and how to set one up.

This is provided already (circa 2022)

What is a Swap FIle?

viewtopic.php?t=5410

User avatar
wizard
Posts: 2071
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2814 times
Been thanked: 746 times

Re: Reducing ram used by Puppy

Post by wizard »

@Jasper
Think your swap file link post should be moved to a new topic, same area as "What is a low powered computer". Could be named something like "Using A Swap File To Increase Available Ram" Also, that linked document only applies to older Puppy versions, needs to be updated and expanded to include the newer Pups. Can do that part if you want to do the initial post

Thanks
wizard

Big pile of OLD computers

User avatar
Chelsea80
Posts: 379
Joined: Tue Mar 09, 2021 12:44 am
Has thanked: 48 times
Been thanked: 81 times

Re: Reducing ram used by Puppy

Post by Chelsea80 »

Here is my 2p worth.

Answer given by AI, what else with me.

What does a swap file in Puppy Linux do

Sources
bkhome.org favicon
reddit.com favicon
youtube.com favicon

Answer
A swap file in Puppy Linux serves as virtual memory to supplement the physical RAM. Here are the key points about swap files in Puppy Linux:

Purpose and Function
A swap file provides additional virtual memory when the physical RAM is fully utilized.
It allows the system to run more demanding programs without crashing, especially on computers with low amounts of RAM.

When It's Useful
Swap files are particularly beneficial for systems with less than 2GB of RAM.
They act as a safety net, preventing the system from freezing when memory-intensive tasks are performed.

Performance Considerations
Swap files are much slower than physical RAM.
Under light operation, there may be no noticeable difference in performance with or without a swap file.
The benefits become apparent during heavy usage, such as running multiple applications simultaneously.

Creation and Size
Puppy Linux may prompt you to create a swap file during the first shutdown.
For systems with less than 2GB of RAM, a 1024MB swap file is generally recommended.
Swap files are typically stored on internal drives or USB hard drives, not on USB flash drives or SD cards.

Comparison to Swap Partitions
In modern kernels, there is no significant performance difference between swap files and swap partitions.
Swap files offer more flexibility as they can be easily resized or deleted compared to swap partitions.

It's worth noting that while swap files can be helpful, they are not always necessary, especially on systems with ample RAM. Puppy Linux is designed to be efficient and can often run smoothly without a swap file on machines with sufficient memory.

I understand the Purpose and Function section to mean that if everything being used at the time fits in the physical memory RAM then OK.

If it doesn't then it 'swaps' it to the virtual memory RAM.

So is the 'whatever' that is too big to fit in the physical memory RAM split, making some of 'whatever' sit in physical memory RAM and the rest of 'whatever' sit in virtual RAM?

If this is the case then surely extra work is needed by the system to jump between the two for what is needed. I wonder if this would lead to a slower response time and possibly a higher system temperature.

Although if the use of more than 2GB of physical memory RAM outweighs the extra work put on the system it might be beneficial.

Chelsea80

1. BionicPup32+28 19.03 - Linux 4.9.163 - lxpup - 32-pae [i686] - (UPup Bionic Beaver)
....Frugal Install - Internal HDD - Gateway MX8716b - HDD 120GB - RAM 2GB

2. Friendly-Bionic32 v1.1
....USB Stick 2GB

User avatar
bigpup
Moderator
Posts: 7297
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 950 times
Been thanked: 1614 times

Re: Reducing ram used by Puppy

Post by bigpup »

The Puppy versions that are now using zram setup for memory.

Not sure a swap file or swap partition would help much.

Really, it is more about trying to use more RAM than the computer has, to do things.

Got 2GB of RAM.
Trying to run 5 programs at the same time, that each one needs .5GB of RAM to run.
Plus the around .5GB of RAM needed to run the operating system.

Kind of hard to make 2GB of RAM operate like it is 3GB of RAM.

Actually zram is kind of doing that.
Compressing what is in RAM, so it takes less space to be in RAM.
But a somewhat fast CPU is needed to do the compressing and read decompressing.
Not an issue with 4GB, 8GB, 16GB, etc.... RAM and modern available CPU's.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
amethyst
Posts: 2470
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 519 times

Re: Reducing ram used by Puppy

Post by amethyst »

bigpup wrote: Sun Oct 27, 2024 1:44 am

The Puppy versions that are now using zram setup for memory.

Not sure a swap file or swap partition would help much.

Really, it is more about trying to use more RAM than the computer has, to do things.

Got 2GB of RAM.
Trying to run 5 programs at the same time, that each one needs .5GB of RAM to run.
Plus the around .5GB of RAM needed to run the operating system.

Kind of hard to make 2GB of RAM operate like it is 3GB of RAM.

Actually zram is kind of doing that.
Compressing what is in RAM, so it takes less space to be in RAM.
But a somewhat fast CPU is needed to do the compressing and read decompressing.
Not an issue with 4GB, 8GB, 16GB, etc.... RAM and modern available CPU's.

zram swap works well to a point before it almost freezes the system (you can only go that far with the physical RAM you've got and it takes its toll on processing power in my experience ). Swap file or swap partition should ALWAYS work if the swapping is done sufficiently (swapping from disk will always be a bit slower). In Windows with their massive operating systems it's obvious that swap needs to work very well and it does. If you have a very low end computer (say 2Gig RAM and less), I would not recommend zram swap. In the latter case go the traditional swap file/swap partition route for a more stable and safer operational experience.

Last edited by amethyst on Sun Oct 27, 2024 7:55 am, edited 3 times in total.
User avatar
Jasper
Posts: 1696
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 867 times
Been thanked: 352 times

Re: Reducing ram used by Puppy

Post by Jasper »

@bigpup

Newer builds of PuppyOS do incorporate 'ZRAM' ......... but some users may be using older builds.

But a somewhat fast CPU is needed to do the compressing and read decompressing.
Not an issue with 4GB, 8GB, 16GB, etc.... RAM and modern available CPU's.

The conversation really is discussing 'older' hardware that has limitations.

Instead of using ZRAM could ZSWAP not used?

User avatar
amethyst
Posts: 2470
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 519 times

Re: Reducing ram used by Puppy

Post by amethyst »

Jasper wrote: Sun Oct 27, 2024 5:51 am

@bigpup

Newer builds of PuppyOS do incorporate 'ZRAM' ......... but some users may be using older builds.

But a somewhat fast CPU is needed to do the compressing and read decompressing.
Not an issue with 4GB, 8GB, 16GB, etc.... RAM and modern available CPU's.

The conversation really is discussing 'older' hardware that has limitations.

Instead of using ZRAM could ZSWAP not used?

zram swap can be used with older systems like Bionic.

User avatar
Jasper
Posts: 1696
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 867 times
Been thanked: 352 times

Re: Reducing ram used by Puppy

Post by Jasper »

@Clarity

Just to make sure we are discussing the same thing, here's a explanation from the ArchWiki

https://wiki.archlinux.org/title/Zswap

TLDR :lol:

zswap is a kernel feature that provides a compressed RAM cache for swap pages. Pages which would otherwise be swapped out to disk are instead compressed and stored into a memory pool in RAM. Once the pool is full or the RAM is exhausted, the least recently used (LRU) page is decompressed and written to disk, as if it had not been intercepted. After the page has been decompressed into the swap cache, the compressed version in the pool can be freed.

The difference compared to zram is that zswap works in conjunction with a swap device while zram with created swap on top of it is a swap device in RAM that does not require a backing swap device.

Clarity
Posts: 4055
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1702 times
Been thanked: 551 times

Re: Reducing ram used by Puppy

Post by Clarity »

Yes. The importance is having an 'out of RAM' place to manage subsystem/app overflows avoiding system lockups.

dimkr
Posts: 2477
Joined: Wed Dec 30, 2020 6:14 pm
Has thanked: 53 times
Been thanked: 1252 times

Re: Reducing ram used by Puppy

Post by dimkr »

AFAIK zswap is only useful if you have swap on disk - AFAIK it's compressed cache in RAM for frequently accessed pages that get swapped out.

Before you replace zram with swap on disk or replace zram with zswap, maybe you should try the combination of two swap devices, a small zram device with high priority, plus a big swap file/partition on disk with low priority. That will give you the best of both worlds: extra responsiveness when RAM is full but swap usage is low, and ability to run RAM intensive applications (maybe with slowness and freezing) but without crashing when both RAM and swap are full.

Post Reply

Return to “64 Bit”