Verify that swap is being used by Pup? Ok, sortof solved.

Booting, installing, newbie
Message
Author
Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

Verify that swap is being used by Pup? Ok, sortof solved.

#1 Post by Takilla »

How do I verify that the swap is being mounted and used?

I am setting up a number of old computors with puppy all w/ 1G HD, roughly, (plan to add 1G slaves for /home) and partitioned as either:

hda1 puppy, primary
hda5 swap,(in hda2,extended)(MUT does see it, but not auto mounted)

or:

hda1 swap, primary (MUT does not see)
hda2 puppy, primary

Does swap work as a primary partition?
No DOS is used-just don't know enough about it-

I am sure that there is already some instructions on this basic subjuect but I have not found it.

Thanks for your help
Last edited by Takilla on Thu 29 Dec 2005, 04:58, edited 2 times in total.

Sage
Posts: 5536
Joined: Tue 04 Oct 2005, 08:34
Location: GB

#2 Post by Sage »

My method is crude and exposes my glaring inability in Linux, but it works.
Build your HD installations on modern kit. Make and format your swap partition (which can be as small as 30Mb if you are really struggling for space). Even if swap is auto mounted, issuing 'swapon -a ' in console will do no damage.
Then swap the memory for a 32Mb stick. You can hear the swapfile being accessed when you open a large application, eg like Mozilla. [If you have your board in a posh box and fully wired, you can even see the HD light flashing). For double confirmation, swap back to a stick of 256Mb DRAM and notice the difference(s).
Bruce will be along soon to give us the proper method and tell us the latest cricket results!

raffy
Posts: 4798
Joined: Wed 25 May 2005, 12:20
Location: Manila

Partitions

#3 Post by raffy »

Primary partitions are numbered 1-4. Any extended partition begins numbering from 5, so even if it's supposed to be hda2 (as you described above), it will be hda5 if it's extended.

Yes, swap can be built using primary partition.

While in cfdisk (in console), make your partition type swap (82). Then format it by "mkswap /dev/hda1".

Live CD uses swap automatically, but hard disk install must use "swapon /dev/hda1", which can be put in etc/rc.d/rc.local to be loaded at startup.
Puppy user since Oct 2004. Want FreeOffice? [url=http://puppylinux.info/topic/freeoffice-2012-sfs]Get the sfs (English only)[/url].

Sage
Posts: 5536
Joined: Tue 04 Oct 2005, 08:34
Location: GB

#4 Post by Sage »

I don't think that was the question. Tecquila wanted to know how he could be certain that his swap file was being used. My blunt implement approach works!

Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

swap

#5 Post by Takilla »

Thanks, sage and raffy, both comments help.

I did make a mistake on the partitions, I made a hda5 extended and put the swap there as hda6, that is how other distros do it, I think. But I have not done a "mkswap" or "swapon", did not know about that. Thought that was automatic.

Sage, not sure what you mean by "swap the memory for a 32MB stick". I know what a stick is, just not "swap the memory". Sorry, could use some help on that.

Thanks for your help.

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#6 Post by Ian »

If you boot Puppy from a live CD on any machine open MUT in Start/File managers/Mut media utility tool, the drives will be displayed and if you have a Linux swap partition it will be shown with the words 'Swap Off' beside it.

This means that your swap partition is mounted, you can click on the 'Swap Off' to unmount it but this is not recommended.

If the partition you designated as swap is not displayed as swap ensure that it is formatted as a Swap partition.

You can do this by running this command, at the command line,

mkswap /dev/hd(whatever the partition is)

Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

#7 Post by Takilla »

Thanks Ian, this is starting to make sense, I'll give it a go.

raffy
Posts: 4798
Joined: Wed 25 May 2005, 12:20
Location: Manila

MUT

#8 Post by raffy »

I thought you're already using MUT to view Swap, as you said in your original post
MUT does see it
:)

Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

MUT

#9 Post by Takilla »

Yes, where I made a swap in the extended partition(hda5)MUT sees it as hda6 ext2 unmounted-then I click on "mount" and a lost+ found folder appears(empty).
Now I should, per your instruction, make "swapon/dev/hda6" or "mkswap /dev/hda6" in etc/rc.d/rc.local right? and do two these commands have the same effect to mount the swap on boot?

MUT takes 16 seconds to come up on my machine with 128MB and as much as 45 seconds to come up on the machine with 64MB(20 sec.for AbiWord)-long time-that is why I suspected that the swap was not being used.

MUT does not see the swap on the hard drives with swap on hda1 primary.

thanks

_raffy_

Commands

#10 Post by _raffy_ »

This will format the swap partition:

mkswap /dev/hda5

This will use it:

swapon /dev/hda5

This last one you put in /etc/rc.d/rc/local if you have a hard disk install (not needed if using live CD).

Check your partition numbering in console by the command:

cfdisk

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#11 Post by Ian »

If you have a Linux swap partition, by that I mean a partition formatted as swap in Linux, Puppy will recognize it and activate it at bootup.

The instructions I gave were intended to be a specific guide to what MUT would display if you had a Swap partition, as I said if it is not formatted as Swap the instructions on how to do so were included.

You do not have to include the swapon command unlesss MUT shows that the swap partition is not active as illustrated by the 'Swap Off' flag not being displayed.

Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

swap-MUT

#12 Post by Takilla »

However, even tho' Puppy recognized that the swap existed on hda6, having been formated by cfdisk, it did not mount it-there was only the 'mount' option given by MUT. MUT did not even indicate 'swapon' or 'swapoff' until I input the specific command into etc/rc.d/rc.local. Now it does seem to automount. Maybe this is happening with all the other newbees using 1.0.6-their swap may not be automounted.

On my other HD I made, with cfdisk, hda1 the swap, according to forum instructions, and MUT did not see the swap at all. I will not use this method.

Do both 'mkswap' and 'swapon' need to be used even tho' cfdisk has written the swap to hard drive?

At any rate swap now seems to be auto mounted after entering the swapon command in etc/rc......
So I am getting there.

Thanks for all your help guys!

Thanks for your help guys

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#13 Post by Ian »

Cfdisk or fdisk will rewrite the partition table to include the partition you create.
You have to format the partition as a Swap partition using the mkswap command.

Its similar to DOS fdisk and format, you create the partitions with fdisk and format with the 'format' command.

As for swapon I must apologize, I am using Chubby 1.0.4 and have not run 1.0.6 on this machine, which has a swap partition. On looking at rc.sisinit in 1.0.6 I see where Barry has made some changes since 1.0.4 and this could explain why swapon is not working.

Here are the two different sections:
1.0.4

#0.9.8R2 need to turn on swap partition, if /sbin/init found one...
if [ -e /root0/.etc/swappartition1 ];then
SWAPPART="`cat /root0/.etc/swappartition1`"
swapon $SWAPPART;check_status $?
fi
fi
fi
--------------------------------
1.0.6

#0.9.8R2 need to turn on swap partition, if /sbin/init found one...
if [ -e /root0/.etc/swappartition1 ];then
SWAPPART="`cat /root0/.etc/swappartition1`"
if [ "`echo -n "$SWAPPART" | grep "/mnt/swap"`" = "" ];then
swapon $SWAPPART;check_status $?
else #v1.0.6 only for multisession (see /sbin/init)...
SPARTTYPE="`echo -n "$SWAPPART" | cut -f 2 -d ','`"
SWAPFILE="`echo -n "$SWAPPART" | cut -f 1 -d ','`"
mount -t $SPARTTYPE /dev/hda1 /mnt/swap
if [ $? -eq 0 ];then
swapon $SWAPFILE;check_status $?
fi
fi
fi
fi
fi

Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

swap

#14 Post by Takilla »

Digesting-I can hardly follow my own shoping list, so please go easy with this nubeee.

However, I have observed that when I go to etc/rd.d/rc.local, then Xterm here, and input swapon /dev/hda6, enter, I get just a '#' on the next line with no indication that it took. I then reboot and go to MUT and the swap flag is 'use swap' but not the 'swap off' that I need.
This seems to be the issue that you are getting at with your 1.0.4 and 1.0.6 examples,but Is there a solution? This is important because I have promised to install 50 computors with a mini-linux for people with little computor knowledge and have the swap auto mount is a necessity due to the small hard drives(1G) and the small amount of RAM and PII chips, some even PI and 438s. (there are another 150 in storage in another town). See what I am facing?:( Wish I where up to speed in my experience with linux, but Puppy still seems to be the best choice.

Thanks

Guest

#15 Post by Guest »

if you type
swapon /dev/hda6
in an rxvt window, it will immediately start using the swap partition ... if it doesn't work, you will get an error message, like
swapon: /dev/hda6: No such device or address
if it works ok, you will just get a #

what you want to do is edit the rc.local file
you could type
leafpad /etc/rc.d/rc.local
put the line swapon /dev/hda6 in rc.local and save the file, then reboot ... this should automatically mount the swap partition every time Puppy boots

Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

swap

#16 Post by Takilla »

Thanks Guest, I just did the edit, reboot and confirmed that it successfull saved in the re.local. I then looked in MUT and the swap is flaged 'Use Swap'. I did two reboots.

It should read 'Swap Off", correct? then it appears that there may be a bug preventing auto swap activation???

Any feedback?

Thanks

raffy
Posts: 4798
Joined: Wed 25 May 2005, 12:20
Location: Manila

swapon

#17 Post by raffy »

This should be what you see inside rc.local (in /etc/rc.d):

swapon /dev/hda6

(no more, no less :) )

Check, too, that the file is rc.local in the directory /etc/rc.d

You can just go to the directory and right-click on the file then "Open as text". Edit then save. Then reboot.

PS - Your project is laudable - I will start a topic about it at puppylinux.org/home.

Sage
Posts: 5536
Joined: Tue 04 Oct 2005, 08:34
Location: GB

#18 Post by Sage »

Some straightforward misunderstandings going on here.
The messages Use Swap & Swap Off are just toggles in MUT. Click it and it changes! Try it. However, the terminology is highly misleading. As I understand it, if Use Swap is showing, then swap is ON - you have it, everything is working properly. If you replay the boot start-up statements in console (dmesg???) you will be able to read that swap was switched on automatically, as outlined by ??; if you're at all unsure, issue swapon -a, as I suggested earlier - then you can check MUT to see if anything changed.
If I am incorrect, Ian, raffy, MU, Bruce and the lads will soon correct me!

Takilla
Posts: 53
Joined: Fri 28 Oct 2005, 22:19
Location: Lakeside and Phoenix, Arizona

#19 Post by Takilla »

Yes, in etc/rc.d/rc.local the entries are
(first 3 were already present)

#this file called from rc.local0
#you can edit this file
#when fire wall is installed, will append line to this file
#swapon /dev/hda6 (my edit)

After boot MUT indicates swap w/ (in light blue) 'Use Swap'

My presumption has been that 'Use Swap' is a toggle to turn the swap on and 'Swap Off' is a toggle to turn swap off. But what you suggest is the opposite and that once I had done the 'mkswap', 'swap -a' and 'swapon' commands then swap was being mounted at boot.

So when MUT indicates 'Use Swap' just after boot then swap has been automounted? Right?

There was a suggestion from another poster that the problem, if indeed there is one, may lie in the new 1.0.6 rc.sisinit file. But one thing at a time.

Thanks for your help folks.

Guest

#20 Post by Guest »

if there is a # at the beginning of the line, it won't do anything, anything after a # is a comment

swapon /dev/hda6
will mount your swap partition

#swapon /dev/hda6
will do nothing

Post Reply