swapfile manager

Core libraries and systems
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#21 Post by jpeps »

RetroTechGuy wrote:
The one thing I didn't like about the tool was that it, by default, did not name the file pupswap.swp (IIRC that's the default pup swap filename).
You can name it a anything you want to
edit: .swp is used by vim, so probably not a good idea. Also, you don't want to leave it in "/", so it's not really "default".
Also, I think the default size was a little strange (did I miss read it, or was it 10 MB?) -- and it would probably be better if it used MB as the size measurement (I doubt anyone wants to fine-tune the swap size to kilobytes, or bytes...).

I'm guessing that if someone is adding a swap file, they probably want 256MB or 512 MB, so I would be inclined to make one of those sizes the "default" choice (the user can still change the size manually).
It's set at 100M, which was the recommended desired size noted in posts on several of the Puppy threads. KB appears to be the standard way of setting size, although it reads the rounded MB size after setting it (see posted pic).

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#22 Post by RetroTechGuy »

jpeps wrote:
RetroTechGuy wrote:
The one thing I didn't like about the tool was that it, by default, did not name the file pupswap.swp (IIRC that's the default pup swap filename).
You can name it a anything you want to
edit: .swp is used by vim, so probably not a good idea. Also, you don't want to leave it in "/", so it's not really "default".
Well, it is "default", just not a good one. ;)
(no, not negative criticism, this is a useful tool -- I'd just like to make it more newbie friendly).

A better default location choice would be /mnt/home/ (which would dump it onto the boot media, which is the user's most probably desired location)
Also, I think the default size was a little strange (did I miss read it, or was it 10 MB?) -- and it would probably be better if it used MB as the size measurement (I doubt anyone wants to fine-tune the swap size to kilobytes, or bytes...).

I'm guessing that if someone is adding a swap file, they probably want 256MB or 512 MB, so I would be inclined to make one of those sizes the "default" choice (the user can still change the size manually).
It's set at 100M, which was the recommended desired size noted in posts on several of the Puppy threads. KB appears to be the standard way of setting size, although it reads the rounded MB size after setting it (see posted pic).
KB is certainly the standard (OLD) way of setting sizes. This may be why all of the tools now include "-h" for "human readable", since few intuitively think in KB any more. And Puppy and memory now operate on the MB scale, so that might be more "newbie friendly" choice (let us further note that the experts probably don't need this sort of tool).

For a pupswap, I generally suggest the user get approximately 512MB of space. If they have 256MB RAM, then they need another 256MB swap. Some people have odd-ball sizes. Perhaps the tool could look at physical RAM available, and recommend a swap size based on that value... Hmmm... Now that would be a rather cool, newbie friendly tool.

OK guys, what are your recommendations? When you set up a machine with insufficient RAM, what memory level do you shoot for? Or, similarly, how much RAM to swap? (I have historically used the 2x rule for swap -- the swap should be twice the RAM)

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#23 Post by jpeps »

RetroTechGuy wrote: Well, it is "default", just not a good one. ;)
(no, not negative criticism, this is a useful tool -- I'd just like to make it more newbie friendly).

A better default location choice would be /mnt/home/ (which would dump it onto the boot media, which is the user's most probably desired location)
Doesn't work for me, because I don't have sufficient space in /mnt/home
However, I uploaded one to your specs if it works better for others. I didn't add .swp, because anyone who uses vim probably batch removes them on a regular basis. :D
I'm guessing that if someone is adding a swap file, they probably want 256MB or 512 MB, so I would be inclined to make one of those sizes the "default" choice (the user can still change the size manually).
Ver 2.0 defaults at 512, with input for M, if that makes it more friendly. The optimal size is probably debatable, but easily altered. Hope this works. I also included a rounding function, something bash isn't very good at (the 99M thingy was getting to me)

Frank Cox
Posts: 378
Joined: Sun 01 Nov 2009, 06:05

Deleting existing swap file

#24 Post by Frank Cox »

The method posted on the first page of this thread to get swapoff to function failed when I tried it. After typing swapoff -a /mnt/sda4 the lock was still there. {just happed to have swapfile on save partition}

Swapoff {and swapon} are in sbin so I open a terminal ,cd to sbin and typed swapoff -a . In Gparted it still showed the lock and still gave the error message but then it disappeared and I was able to delete it.
Weird. but at least its gone.

Thanks for the program!

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#25 Post by darkcity »

Thanks for the program. Is it possible for two different installations of Puppy to share a Swap file (at different times of course)?

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#26 Post by jpeps »

darkcity wrote:Thanks for the program. Is it possible for two different installations of Puppy to share a Swap file (at different times of course)?
Just add file /root/.swapfile which shows where swapfile is:
eg, "/mnt/sda2/swapfile"

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#27 Post by darkcity »

Thanks for the reply, I've added the wizard to the Wiki
http://puppylinux.org/wikka/SwapFileManager

Puppy 5.2.5 seems to automatically a swap file is you have low memory, do you know what version this started at?

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#28 Post by jpeps »

Added swappiness; version 3.0

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#29 Post by jpeps »

Version 3.5: Added option to save settings (for reboot). Rewrote code to refresh labels to immediately reflect changes. More friendly windows setup (close child windows, etc.)

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#30 Post by jpeps »

Update: Uses gtimer process widget if installed. (gtimer requires =>gtkdialog 0.7.21

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#31 Post by jpeps »

Version 4.1 Better integration of gtimer; streamlined some code.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#32 Post by jpeps »

Version 4.2 Automatically defaults to gtkdialog4 but reverts to gtkdialog3 if not available. Added version name to work with pet uninstaller.

PenguinPupLin
Posts: 130
Joined: Fri 23 Dec 2011, 09:21
Location: The Little Red Dot

swapfile error

#33 Post by PenguinPupLin »

In urxvt,I get swapfile error:Malformed setting :"vm.swappiness=".
What I did was:
1) In WinXP, fsutil file createnew c"\Wary-511\pup,swp 528244000;then reboot
2) in Wary511,urxvt,
a) mkswap /mnt/home/Wary-511/pup.swp,
b) swapon /mnt/home/Wary-511/pup.swp;
3) use Geany,open roo/.etc/rc.d/rc.local and appended "swapon /mnt/home/Wary511/pup.swp" (without quotes) and saved it to make swapon automatic.
Then I came across the swapfile manager.4.2.pet and installed it,run the program and just set the swappiness at 10 without creating another swapfile as I already have one. Now I get this error message every time I open rxvt.
What should I do ? Any help greatly appreciated.
Another question, I intend to use swapfilemanager in Classic Pup214X-TOP9 to add a swapfile in the same partition where Wary-511 subfolder is located but this time in root where the 214X pupsave resides. Any problem if I do this? Kindly advise(still a noob in Linux).
Edited: Latest development - I deleted the created puppy.swp and use swapfilemanager to created a new swapfile. The swappiness problem is resolved but now I get "..,swapon failed: Device or resource busy" . Need help on this, thank you.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#34 Post by jpeps »

"swapon -s" will show you what swapfile it is pointing to. I think "swapon -p" will let you prioritize. It looks like you set up conflicting swapfiles.

PenguinPupLin
Posts: 130
Joined: Fri 23 Dec 2011, 09:21
Location: The Little Red Dot

#35 Post by PenguinPupLin »

swapon -s showed only one i.e initrd/mnt/dev_save/swapfile and priority -1
Will swapon -p auto prioritize it as there is only one swapfile?

Having created it in Wary511, how do I add the same swapfile ,without creating another one, in Lighthouse Puppy 5.0.3 after installing the swapfilemanager.pet? Saw yr instruction above,but my apology,being a noob,still not clear how to do it. Appreciate yr help.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#36 Post by jpeps »

The location is listed in /root/.swapfile. It's easiest to just create a new one in the same location. The other will still be there.

Your swapon -s printout looks good.

example:

Code: Select all

STATE=ON
/mnt/sda2/swapfile
SWAPPINESS=30

PenguinPupLin
Posts: 130
Joined: Fri 23 Dec 2011, 09:21
Location: The Little Red Dot

#37 Post by PenguinPupLin »

Thanks, I'll create another one for Lighthouse then but can I use a different name as it will be in the same drive and partition sda1(hd0,0) as for Wary511?
The one for Wary still showing the same error message:"swapon failed.Device or resource busy" despite there being only one swapfile.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#38 Post by jpeps »

PenguinPupLin wrote:Thanks, I'll create another one for Lighthouse then but can I use a different name as it will be in the same drive and partition sda1(hd0,0) as for Wary511?
The one for Wary still showing the same error message:"swapon failed.Device or resource busy" despite there being only one swapfile.
You can't delete or alter a swapfile until you turn it off with swapoff. Yours is still on.

If you use a different name, it will be a different swapfile on the same partition.

PenguinPupLin
Posts: 130
Joined: Fri 23 Dec 2011, 09:21
Location: The Little Red Dot

#39 Post by PenguinPupLin »

But once I boot out of Wary,wouldn't it be turned off ? Then I 'll boot into Lighthouse to create another one by a different name, leaving the other one alone as swapfile(which was the default name). Will this do? Sorry,I'm still a noob.

Anyway,I've gone ahead to create a swapfile of the same name for Lighthouse Puppy as for Wary511 since they can both share the same swapfile running at different times as I don't wish to have more than one swapfile to confuse it and hv to set priority(don't know how).

Lastly, although the message "swapon failed.Devce or resource is busy" appeared in both Lighthouse and Wary, typing "free" in terminal showed some swap memory were used. Not sure if this means the swapfile is working alright and the message has something to do with the swappiness setting.

Also noticed that with swapfile auto-on,booting time is longer.

PenguinPupLin
Posts: 130
Joined: Fri 23 Dec 2011, 09:21
Location: The Little Red Dot

#40 Post by PenguinPupLin »

Could you confirm that creating a swapfile of the same name and in the same harddisk partition in Lighthouse and Wary511 is alright? When I reboot or shutdown the system,is the cache in the swapfile cleared, so that when I boot into another Puppy, there is no conflict or anything? I ask because now my Lighthouse boots up and gives me a message (as far as I can remember) like "multi-user hald message: bash /etc/rc.sysctl/ no such file or directory" and stays like this for sometime before finally booting into xserver. Pardon me for nagging you as I'm trying out various puppy linux distros to see which one or two works best for my notebook and leave it at that for longterm use and also before I do the same for my friends similar notebook specs. Thanks in advance.

Post Reply