Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 Oct 2014, 20:45
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Here's a script for flushing RAM to USB on Puppy 3.01
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
andrei

Joined: 31 May 2006
Posts: 80

PostPosted: Thu 30 Aug 2007, 03:19    Post subject:  Here's a script for flushing RAM to USB on Puppy 3.01  

I have been testing a script in Puppy 2.17, which flushes RAM when running Puppy from the USB flash drive. It seems to work, so I decided to post it.

Actually, the flushing will most likely be implemented automatically, and much more efficiently, on Puppy 2.20. This is because 2.20 will use the updated version of unionfs, with the flushing capability built-in. So, this script which I am posting could only be useful for those people who will stay for some time, for some reason, on 2.17.

I have to explain what I mean by "flushing". Suppose you are running Puppy from the USB flash drive. There is a file on the flash drive, called pup_save.2fs, where all your data is stored. (The file stores an ext2 filesystem, which is mounted when you boot Puppy from the USB flash.) When you write some new file, or make a change to the existing file, all the new data is actually written on RAM, rather than directly on pup_save.2fs. This is done in order to avoid frequent writes on the flash memory. It turns out that USB flash drives can only support a limited number of writes, about 1 million. So, if we wrote everything on pup_save.2fs directly, this would lead to the flash drive "wearing out" in a matter of days. Therefore, all the changes are written on RAM. Periodically the files written on RAM are saved to pup_save.2fs, so they persist after the reboot. This usually happens every 30 minutes, or every time you press the Save button on the desktop.

But due to some technical limitations, when the files are saved from RAM to pup_save, they are not removed from RAM. In other words, files are being COPIED from RAM to pup_save instead of being MOVED. This leads to accumulation of the files in RAM. Accumulation of files in RAM is not good for at least two reasons. First, if you download or create many files, RAM gets full. Especially on older machines with small RAM. But even if you have lots of RAM, there is another problem. Remember that saving files from RAM to pup_save.2fs happens periodically every 30 min. If files get accumulated in RAM, then obviously saving takes longer and longer every time. This is not good.

The flush script solves this problem. If you feel that there are lots of files accumulated in your RAM, just execute the flush script from the terminal window. Go to the folder where the flush script is located, and say:
./flush
The script is very verbose, trying to explain what it is doing. It will free most of the memory, by MOVING all or almost all the files from RAM to the pup_save file on the USB. You should probably exit all the running programs before executing flush, although it is not strictly necessary. The only reason is, if some program is writing on some file at the same time when flush is executed, then this change will likely be lost. So, at least "stop doing everything" when executing flush.

Notice that some preparation is required for this to work. Please read the README file inside the tar.

Once again, this is a temporary solution, Puppy 2.20 will have a much better realization of flushing.
flush.tar
Description  scripts to flush RAM to USB on Puppy 2.17
tar

 Download 
Filename  flush.tar 
Filesize  30 KB 
Downloaded  1171 Time(s) 

Last edited by andrei on Fri 04 Jan 2008, 23:11; edited 1 time in total
Back to top
View user's profile Send private message 
ipw2200user


Joined: 05 Jun 2007
Posts: 3
Location: New Zealand

PostPosted: Thu 13 Sep 2007, 04:05    Post subject: Installed and Testing......  

I've installed these scripts because I have a problem with puppy 2.17.1 "locking up" when RAM gets too low on a 256MB RAM Laptop. The scripts seem to work OK so far - I make changes to the filesystem and the verbose feedback I get from the prompt indicates it's doing the job. Thanks!
Back to top
View user's profile Send private message 
andrei

Joined: 31 May 2006
Posts: 80

PostPosted: Tue 09 Oct 2007, 04:14    Post subject:  

This thread only applies if you are running Puppy from the USB flash drive (aka pendrive).

I could not make myself comfortable with unionfs. I am also not satisfied with how whiteout files are handled in 3.00. On the other hand, I am now very busy at work, and so cannot spend too much time with Puppy. So, I decided to revert to aufs, just for now. The flushing snapmergepuppy which I previously submitted would not work in 3.00, apparently because some changes in the version of bash. So, I had to correct it, and here is the corrected version for use in 3.00 (I have not tested it on 2.17, but I guess it should work on 2.17 too...)

I suspect that this might be more reliable than what we now have in 3.00, although I must say that I had some problems when uninstalling packages. In any case, if somebody wants to try this, then first of all, two things have to be done. First, reverting to aufs. Go to the folder /mnt/home/ (this is where the USB flash drive is mounted) and edit the file syslinux.cfg . In order to switch to aufs, you would have to add layerfs=aufs at the end of the line. For example, my syslinux.cfg consists of one line:
default vmlinuz initrd=initrd.gz pmedia=usbflash layerfs=aufs
This is the standard syslinux.cfg, except for layerfs=aufs at the end.

The second thing, petget should be modified. I just reverted it basically to what it was in 2.17, except for pointing it to the repository for Puppy 3 , rather than Puppy 2. I am attaching the modified petget as a tar file. It should be copied to /usr/sbin/

At this point I would recommend a reboot, just for aufs to take over. Then, install the attached smpflush-3.00.pet. If you want to use flushing, the flush button is now available through Menu->Setup->USB Flash Wizard. But enabling it requires some preparations, just as it was in 2.17. When you first time press the Flush button in the wizard, you should get the instructions on what to do. Alternatively, you can press Help button in the USB Flash Wizard, and read the instructions at the end of the help page. (Flushing could be also invoked from the command line. The command is: snapmergepuppy -f )

I am sorry about this, but this is about the only way I could help now (or rather try to help). Eventually all these things will be sorted out.
smpflush-3.00.pet
Description  you should first replace /usr/sbin/petget with the attached new petget, and only then install this smpflush pet
pet

 Download 
Filename  smpflush-3.00.pet 
Filesize  12.94 KB 
Downloaded  651 Time(s) 
petget.tar
Description  modified petget; copy it to /usr/sbin/
tar

 Download 
Filename  petget.tar 
Filesize  80 KB 
Downloaded  665 Time(s) 
Back to top
View user's profile Send private message 
andrei

Joined: 31 May 2006
Posts: 80

PostPosted: Fri 04 Jan 2008, 23:08    Post subject: new version for Puppy 3.01
Subject description: fixed 2 bugs
 

Here is a new version, with two bugs fixed:

1. There was a problem with spaces in filenames. Fixed.
2. The script used to go into an endless loop when flushing a new subfolder in / . Fixed.

I also added a terminal command [b]flush[/b]

The old instructions apply, with one new thing. I now recommend to exit running programs (like Firefox) when executing flush. I had problems installing new Firefox extensions and then flushing while Firefox still running. This new version is tested in Puppy 3.01, and should also work in 3.00.
I am re-attaching the same modified petget for completeness.

Happy flushing in 2008!
petget.tar
Description  this is the same, nothing changed
tar

 Download 
Filename  petget.tar 
Filesize  80 KB 
Downloaded  844 Time(s) 
smpflush-3.01.pet
Description 
pet

 Download 
Filename  smpflush-3.01.pet 
Filesize  13.26 KB 
Downloaded  674 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0607s ][ Queries: 12 (0.0077s) ][ GZIP on ]