Page 1 of 1

Swapfile for memory extention

Posted: 14 Feb 2014, 15:43
by RamonTavarez
Hi!

I want to "extend" the RAM's amount for my system through a swapfile, and I have some questions about the right configuration.

I'm working with Porteus 2.1 32bit installed at an external HDD. The primary partition is ext4, with 150 GB of space. At a extended partition I have a 32GB ext4 space for swapfile; another ext4 partition for documents and a fat32 partition for MS Windows.

My questions:
  • 1.- Will the swapfile work on the extended partition?
    2.- I want that Porteus use as much as possible of the 32 GB reserved on the partition for swap. Do I have to "activate" the swapfile through a cheatcode or a script file?
Thnaks in advance for your help.

Re: Swapfile for memory extention

Posted: 14 Feb 2014, 16:20
by fanthom
yes - it will work with extended partition. to create swapfile run following command:

Code: Select all

mkfileswap /mnt/sda6/test.swap 1000
and activate it through rc.local:

Code: Select all

swapon /mnt/sda6/test.swap
run 'free -m' to confirm swap space increased.

since swapfile has fixed size than maybe would be better to convert whole partition into swap?

Code: Select all

mkswap /dev/sda6
Porteus will find and use it automatically.

Re: Swapfile for memory extention

Posted: 14 Feb 2014, 16:36
by RamonTavarez
Thx Phantom!

About the swap partition: I have a swap partition inside the extended partition , but do I have to "activate" it through rc.local?

Thx again for your help.

Re: Swapfile for memory extention

Posted: 14 Feb 2014, 18:44
by brokenman
If you are using a swap partition then linuxrc will find it and take care of adding it to fstab during boot.
I want to "extend" the RAM's amount for my system through a swapfile
I imagine you have already done the research but if not, you should ask yourself why you really need the swap partition. In many cases (on systems with plenty of resources) it will not be of much benefit. read/writes from physical memory are measured in nanoseconds while the same from disk are some tens of thousands longer.

Re: Swapfile for memory extention

Posted: 14 Feb 2014, 20:13
by RamonTavarez
@Brokenman:

Thx for your response.

Yes, I've made my homework about swap partition and swapfile. The fact is that I've worked on PC with very limited RAM :wall: and I'm trying to prepare my system to handle this kind of situations for the future.

I prefer sacrifice some processing speed and obtain the enough memory to complete complex jobs.

Is it valid include the following lines on rc.local file?

Code: Select all

mkswap /dev/sdbx
swapon /mnt/sdbx
sdbx is an already existing swap partition.

Regards.

Re: Swapfile for memory extention

Posted: 14 Feb 2014, 21:59
by brokenman
You can just include the swapon line.