WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Resize ramzswap  (Read 7205 times)

Offline TaoTePuh

  • Full Member
  • ***
  • Posts: 172
Resize ramzswap
« on: April 14, 2011, 07:30:17 PM »
Maybe this is helpful for someone, somewhere, sometimes  ...

TC uses 25% of the RAM for ramzswap. Sometimes this is too little or too much.

The initialization of ramzswap is done in the script /etc/init.d/tc-config. Unfortunately, the boot codes for the kernel module ramzswap are (currently) not considered by the script and so there is no way to take control with boot codes.

Another possibility would be to change the script tc-config but then you have to remaster TC. Besides, this is not good if you want to upgrade later times.

A third possibility exists with the script /opt/bootlocal.sh - this I will present here:

Code: [Select]
##
## ramzswap
##
## remove all existing swap
swapoff -a
# remove the ramzswap kernel module
rmmod ramzswap.ko
## load the ramzswap kernel module again
modprobe ramzswap.ko num_devices=1
## initialize the device
rzscontrol /dev/ramzswap0 --disksize_kb 51200 --init
## swap on
swapon /dev/ramzswap0
swapon -a

This snippet replaces the existing ramzswap with 50 MB fresh one. Let's take a look at the result:

Code: [Select]
tc@box:~$ cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/ramzswap0                          partition       51192   0       -1
/dev/sda2                               partition       2096472 0       -2

Note: If you want to try this on the console, do not forget the sudo.

Note: More Information about the options can be found here:
http://compcache.googlecode.com/hg/sub-projects/rzscontrol/man/rzscontrol.html?r=a1446e34a056e23e3ff9dc0a9f0c1e0c9605d43c

Warning: If you're short on RAM so that your system needs swap at boot time - don't use this script - your system might crash.
« Last Edit: April 15, 2011, 07:44:23 AM by TaoTePuh »

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Resize ramzswap
« Reply #1 on: April 15, 2011, 03:47:09 AM »
"nozswap" and then you can set up it without any teardown required.
The only barriers that can stop you are the ones you create yourself.

Offline TaoTePuh

  • Full Member
  • ***
  • Posts: 172
Re: Resize ramzswap
« Reply #2 on: April 15, 2011, 07:31:29 AM »
1.) Without "swapoff -a" you may run in trouble with swap priorities.
2.) With boot code nozswap, you lose the ramzswap entry in /etc/fstab which is done by the script tc-config. Then the shutdown (/etc/init.d/rc.shutdown) runs not clean (swapoff -a).

Offline larrys4227

  • Newbie
  • *
  • Posts: 5
Re: Resize ramzswap
« Reply #3 on: August 25, 2011, 04:51:43 PM »
Hello, I re-installed TC because the first time, I didnt make a partition for Linux swap and since its an older machine (PII-300 w/256M RAM) I decided to start over again.

This thread is the best one I found for dealing with the problem now, but I'm stumped .... it seems that ramzswap is prioritized over my hda2 swap partition, and its not mounted.  I've added the proper line in /etc/fstab but it keeps rewriting it as 'none swap' and mounting only ramzswap.

I see entries here stating to add a nozswap, but I have no idea where to place it.

Should I be concerned?, or am I wasting 1GB of HD space for a swap that will never be used?

Thanks a bunch!

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Resize ramzswap
« Reply #4 on: August 25, 2011, 05:01:04 PM »
If the partition is type 82 and you run mkswap on it, it will be found and swapped on.

Offline larrys4227

  • Newbie
  • *
  • Posts: 5
Re: Resize ramzswap
« Reply #5 on: August 25, 2011, 05:30:51 PM »
Yes, the swap is type 82 and I ran mkswap on ..... I thought I would see the swap as a mounted drive ...

free shows:
Mem 254992
Swap 1278986

cat /proc/swaps shows:
ramzswap 63736
/dev/hda2 1215260

So, it appears that both ramzswap and hda2 are available to the system and ready to use.  Not sure if I have to run mkswap on every time I boot ... will find out when I finish this.

Apologies for the newbiness.  Its been awhile since I've had to do all this and am abit rusty.  I couldnt even get the output of the terminal in here, but those figures are correct.  Its been fun to get back into tayloring my own system, but the commands and syntax are stressing the brain cells.

If you see anything above out of whack, let me know. I believe it looks good and what I want.

Thanks guys!  Mucho appreciated