Understanding swap partitions - SOLVED!
-
- Posts: 131
- Joined: Thu 24 May 2012, 02:52
Understanding swap partitions - SOLVED!
Greetings everyone,
Ok, after going back and reading the help notes, I want to see if I'm on the right track with swap partitions. Please correct me if I'm wrong.
A swap partition is basically "emergency RAM" that can help out out systems when running programs. A general rule of thumb is 2 x RAM, so in my case 384 MB x 2 = 768 MB partition for swap partition (so in essence it will give me 1 GB memory - 768 MB swap + 384 onboard RAM).
The swap partition should be formatted ext2.
Am I way off here?
Thanks!
VV5
Ok, after going back and reading the help notes, I want to see if I'm on the right track with swap partitions. Please correct me if I'm wrong.
A swap partition is basically "emergency RAM" that can help out out systems when running programs. A general rule of thumb is 2 x RAM, so in my case 384 MB x 2 = 768 MB partition for swap partition (so in essence it will give me 1 GB memory - 768 MB swap + 384 onboard RAM).
The swap partition should be formatted ext2.
Am I way off here?
Thanks!
VV5
Last edited by VictorVictor5 on Thu 17 Jan 2013, 02:58, edited 1 time in total.
-
- Posts: 1885
- Joined: Tue 05 Jun 2012, 12:17
- Location: Wisconsin USA
As I understand a swap partition, it has no specified or defined filesystem, so it is not formatted in the usual sense of the word. It is just.....swap. Virtual memory. Puppy uses it if it runs out of RAM, which is unlikely with 384 MB of RAM unless you watch video or do things with very large files such as image files. In any case, if you can add more RAM to the computer, I highly recommend that you do it.
Might help...
http://ubuntuforums.org/showthread.php?t=1369433
A hint...... one of the options in GParted is "linux-swap".
http://ubuntuforums.org/showthread.php?t=1369433
A hint...... one of the options in GParted is "linux-swap".
The partition type should be '82'. Linux partitions meant for filesystems are type '83'. As Flash sort of points out, they need not be formatted with any filesystem at all. Instead of being formatted as a filesystem, they are formatted as swap space using the 'mkswap' command -which basically just divides the partition into 4K 'pages'.
-
- Posts: 131
- Joined: Thu 24 May 2012, 02:52
In a 32bit puppy i could never break 1gb ram. I do lot of audio work, lots of programs running at the same time with jack, also some video.jpeps wrote:wrong....maybe 2gigs and over, but you'll be using it all the time to initialize programs, etc, with 384 MB.Flash wrote: Puppy uses it if it runs out of RAM, which is unlikely with 384 MB of RAM unless you watch video or do things with very large files such as image files.
On a 64bit yes, i'm at >1gb easily
For over 5 years I've run various Puppys exclusively from multisession DVDs. Currently my computer has 4 GB of RAM, but for the first few years after I started using Puppy my computer had first 256 MB then 512 MB of RAM, and no hard disk drive, thus no swap memory. Puppy never ran out of RAM in that computer except once, when I tried to install OpenOffice. That's what I based my statement on.
Flash drive controllers spread the writes around so that the "wear" is not concentrated in one area. Writing to a flash memory is what "wears" it out, but it takes 100,000 to 1,000,000 writes before errors begin to creep in. That would be many years for most applications. Even then, error correction codes are used so that no data is lost as long as only a few errors occur.
Actually using flash memory for swap is reported to work well. Even Windows uses it.bark_bark_bark wrote:there is a special type of format for swaps partitions. But don't use a swap on:
-a Flash Memory Card (SD, MicroSD, CompactFlash, etc.)
-USB thumb drive
-Solid State Drives
Flash drive controllers spread the writes around so that the "wear" is not concentrated in one area. Writing to a flash memory is what "wears" it out, but it takes 100,000 to 1,000,000 writes before errors begin to creep in. That would be many years for most applications. Even then, error correction codes are used so that no data is lost as long as only a few errors occur.
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
I find that Firefox regularly leaks all over my RAM, eating all of my 1GB RAM (I should note that my machine with 2GB doesn't seem to do that).jpeps wrote:wrong....maybe 2gigs and over, but you'll be using it all the time to initialize programs, etc, with 384 MB.Flash wrote: Puppy uses it if it runs out of RAM, which is unlikely with 384 MB of RAM unless you watch video or do things with very large files such as image files.
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
Noticed this link; might be worth a tryRetroTechGuy wrote:
I find that Firefox regularly leaks all over my RAM, eating all of my 1GB RAM (I should note that my machine with 2GB doesn't seem to do that).
http://support.mozilla.org/en-US/questions/939920
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
Thanks, I look into that.jpeps wrote:Noticed this link; might be worth a tryRetroTechGuy wrote:
I find that Firefox regularly leaks all over my RAM, eating all of my 1GB RAM (I should note that my machine with 2GB doesn't seem to do that).
http://support.mozilla.org/en-US/questions/939920
I've been using a script to clean the RAM cache (I think that Bruce wrote the functional piece -- I like to monitor it's action). Whenever FF starts acting goofy, I run it a couple times...
Code: Select all
clear
echo " Initial free space"
free
echo ""
echo " clearing cache"
sync && echo 3 > /proc/sys/vm/drop_caches
echo ""
echo " Final free space"
free
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
That probably won't do it. Run a search on caches in /root and everything is still there. Try RamBack and Memory Restart...you can monitor and clear it easily.RetroTechGuy wrote:
I've been using a script to clean the RAM cache (I think that Bruce wrote the functional piece -- I like to monitor it's action). Whenever FF starts acting goofy, I run it a couple times...
Code: Select all
clear echo " Initial free space" free echo "" echo " clearing cache" sync && echo 3 > /proc/sys/vm/drop_caches echo "" echo " Final free space" free
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
Actually, that does drive the crud out of the RAM (which is the problem). FF (or something related to FF) loads up the RAM to just under 1GB, that operation will usually push the used RAM down to 3-400 MB.jpeps wrote:That probably won't do it. Run a search on caches in /root and everything is still there. Try RamBack and Memory Restart...you can monitor and clear it easily.RetroTechGuy wrote:
I've been using a script to clean the RAM cache (I think that Bruce wrote the functional piece -- I like to monitor it's action). Whenever FF starts acting goofy, I run it a couple times...
Code: Select all
clear echo " Initial free space" free echo "" echo " clearing cache" sync && echo 3 > /proc/sys/vm/drop_caches echo "" echo " Final free space" free
I added in some of the tools you recommended, and it seems to behave a little better. Still effectively overflowed once (the one widget shows RAM usage -- and that time it was at 600MB), but I was pushing it pretty hard (lots of open tabs).
Once place where it regularly clogs up is Facebook (and it will generally load up there, with only 1 or 2 tabs open -- I'll see how the add-ons help).
For reference, I just opened FF, and went straight into Murga. I have 2 tabs open, and the FF monitoring plug-in is showing between 140 and 150 MB used for FF.
That behavior really cramps a low RAM machine.
Edit: Now that's interesting. The FF monitoring too is showing 140MB, but top shows VSZ as 448M (47% of RAM).
I'll have to do some reading to see what the monitoring tool is tracking...
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
After testing it to the max...the memory restart restored the CPU functioning. Not having to reboot the OS is all I care about. To get a freeze wasn't easy...25 tabs, several videos..over an hour of u tubes. That's about all I can ask for on an old dell with 1gig RAM. (the main issue has always been CPU...and is more related to flash than FF).
edit: right now I'm running 70 java jars and FF with 10 tabs, and had no problem running a utube video despite a long load time. Another tab opened right up for writing this response....nothing bogging down. All because of swap..176M being used. Remember the myth about java using too much ram?
Next, I turned off my swap file, ran about 20 jars and tried to load FF. FF wouldn't load, and the computer froze, requiring a reboot. That should quell the swap dispute. It's all about ram management, which the kernel handles very well if you give it the right tools.
edit: right now I'm running 70 java jars and FF with 10 tabs, and had no problem running a utube video despite a long load time. Another tab opened right up for writing this response....nothing bogging down. All because of swap..176M being used. Remember the myth about java using too much ram?
Next, I turned off my swap file, ran about 20 jars and tried to load FF. FF wouldn't load, and the computer froze, requiring a reboot. That should quell the swap dispute. It's all about ram management, which the kernel handles very well if you give it the right tools.
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
I've noticed that when FF (or some accessory for FF) eats the majority of the RAM, that Youtube videos will no longer play. It will display the Youtube page, but just a black box where the video goes.jpeps wrote:After testing it to the max...the memory restart restored the CPU functioning. Not having to reboot the OS is all I care about. To get a freeze wasn't easy...25 tabs, several videos..over an hour of u tubes. That's about all I can ask for on an old dell with 1gig RAM. (the main issue has always been CPU...and is more related to flash than FF).
edit: right now I'm running 70 java jars and FF with 10 tabs, and had no problem running a utube video despite a long load time. Another tab opened right up for writing this response....nothing bogging down. All because of swap..176M being used. Remember the myth about java using too much ram?
Next, I turned off my swap file, ran about 20 jars and tried to load FF. FF wouldn't load, and the computer froze, requiring a reboot. That should quell the swap dispute. It's all about ram management, which the kernel handles very well if you give it the right tools.
A RAM purge (using the script references earlier), a refresh of the screen will restore playing.
No, I haven't had FF crash the OS yet. I have had it bog things down to the point where I thought I might have to crash it to get out... Once in a great while, I've had trouble opening a terminal in order to run my script.
Typically I can get just purge the RAM, and close FF gracefully.
Oh, regarding swap... I have a 1.2 GB swap on this machine. It doesn't very often dig into the swap -- it seems that FF only likes RAM...I don't see it overflowing into the swap partition.
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
RetroTechGuy wrote:
A RAM purge (using the script references earlier), a refresh of the screen will restore playing.
No, I haven't had FF crash the OS yet. I have had it bog things down to the point where I thought I might have to crash it to get out... Once in a great while, I've had trouble opening a terminal in order to run my script.
Typically I can get just purge the RAM, and close FF gracefully.
The script purges the cache
Code: Select all
Mem: 676196K used, 358316K free, 0K shrd, 74116K buff, 288476K cached
Mem: 341576K used, 692936K free, 0K shrd, 3800K buff, 65044K cached
Code: Select all
18833 6729 root R 619m 61% 0 100% /mnt/sda2/firefox/firefox
Code: Select all
18833 6729 root S 444m 44% 0 5% /mnt/sda2/firefox/firefox
Oh, regarding swap... I have a 1.2 GB swap on this machine. It doesn't very often dig into the swap -- it seems that FF only likes RAM...I don't see it overflowing into the swap partition.
I've notice that also. FF does it's own thing (i.e, wants all your active RAM). As noted above, however, swap will provide the RAM you need by getting it somewhere else.
I suspect there could also be some downsides to clearing the general cache vs just handling FF.
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
Weird, jpeps...
On my system, I just ran it:
At the moment, I do have FF and Thunderbird open. But it does a similar response with just FF running.
On my system, I just ran it:
Code: Select all
Initial free space
total used free shared buffers
Mem: 969868 821240 148628 0 30472
Swap: 1228964 2388 1226576
Total: 2198832 823628 1375204
clearing cache
Final free space
total used free shared buffers
Mem: 969868 461860 508008 0 1080
Swap: 1228964 2388 1226576
Total: 2198832 464248 1734584
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]
Yes, similar to what I posted. Looks like you're using some swap as well. Check out info for the browser though, which includes CPU usage. I think the kernel will take what it needs from the cache anyway, so probably it's unnecessary to clean it ? It certainly doesn't restore resources the way restarting the browser does.