NSLU2-Linux
view · edit · print · history

HowTo.AddAdditionalSwapSpace History

Hide minor edits - Show changes to markup

June 30, 2006, at 09:49 PM by RobHam -- Ungslung Script Added
Changed lines 2-3 from:
to:

To create a swap file in folder /mnt

Changed lines 6-8 from:

dd if=/dev/zero of=/yourpath/swapfile1 bs=1024 count=262144
mkswap /yourpath/swapfile1

to:

dd if=/dev/zero of=/mnt/swapfile1 bs=1024 count=256k
mkswap -c /mnt/swapfile1

Changed lines 13-14 from:

swapon /yourpath/swapfile1

to:

swapon /mnt/swapfile1

Changed lines 24-25 from:

swapon /yourpath/swapfile1

to:

swapon /mnt/swapfile1

Changed lines 31-33 from:

More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use:

to:

For Unslung firmware users the prefered method is to create an Unslung Script using a Unix style text editor such as vi and save this script to the /unslung folder with name rc.local, a similar method to that mentioned above.

Changed lines 35-39 from:

mkswap /dev/sdb5

to:

#!/bin/sh
swapon /mnt/swapfile1
return 1

Then make the script executable.

Changed lines 42-46 from:

where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in /etc/fstab to have it there with each reboot, an entry like:

to:

chmod +x /unslung/rc.local


More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use:

Changed line 49 from:

/dev/sdb5 none swap defaults 0 0

to:

mkswap /dev/sdb5

Changed lines 52-54 from:

will work with openslug. With Unslung this may not work as fstab is overwritten by reboot - need to test and use diversion script to keep the additional swap used permamently.


to:

where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in /etc/fstab to have it there with each reboot, an entry like:

Deleted line 53:

Note: Some people have had problems with mkswap and the error "swapon: swapon: Invalid argument" when trying to use swapon to add it. This can be fixed by using:

Added line 55:

/dev/sdb5 none swap defaults 0 0

Deleted lines 56-57:

mkswap -c <swap_partition>


Changed lines 58-64 from:

To run mkswap and swapon first you need to install util-linux in OpenSlug and probably any other *Slug

to:

will work with openslug. With Unslung this may not work as fstab is overwritten by reboot - need to test and use diversion script to keep the additional swap used permamently.



The dd, mkswap and swapon commands are included with Unslung firmware. To run mkswap and swapon in OpenSlug and probably any other *Slug you will need to install util-linux.

May 20, 2006, at 12:16 AM by Krigan -- package install
Changed lines 51-54 from:

mkswap -c <swap_partition>

to:

mkswap -c <swap_partition>



To run mkswap and swapon first you need to install util-linux in OpenSlug and probably any other *Slug

April 07, 2006, at 08:34 AM by hifi-andrew --
Changed line 51 from:

mkswap -c <swapdevice>

to:

mkswap -c <swap_partition>

April 07, 2006, at 08:33 AM by hifi-andrew -- Expanded swap partition. Added note re: mkswap -c
Changed lines 32-51 from:

More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use mkswap /dev/sdb5 where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in /etc/fstab to have it there with each reboot. Ah, well, is fstab overwritten by reboot - need to test and use diversion script to keep the additional swap used permamently.

to:

More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use:

mkswap /dev/sdb5

where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in /etc/fstab to have it there with each reboot, an entry like:

/dev/sdb5 none swap defaults 0 0

will work with openslug. With Unslung this may not work as fstab is overwritten by reboot - need to test and use diversion script to keep the additional swap used permamently.



Note: Some people have had problems with mkswap and the error "swapon: swapon: Invalid argument" when trying to use swapon to add it. This can be fixed by using:

mkswap -c <swapdevice>

March 10, 2006, at 07:05 PM by fishywishywoo -- Added changing script to be executable
Changed lines 25-26 from:
to:

You then need to make the script executable.

chmod +x /opt/etc/init.d/S100addswap

March 02, 2006, at 04:41 PM by Init -- Spelling error
Changed line 29 from:

More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use mkswap /dev/sdb5 where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in /etc/fstab to have it there with each reboot. Ah, well, is fstab overwritten by reboot - need to test and use division script to keep the additional swap used permamently.

to:

More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use mkswap /dev/sdb5 where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in /etc/fstab to have it there with each reboot. Ah, well, is fstab overwritten by reboot - need to test and use diversion script to keep the additional swap used permamently.

March 01, 2006, at 04:03 PM by kaste --
Changed line 29 from:

More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use mkswap /dev/sdb5 where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in fstab to have it there with each reboot. Ah, well, is fstab overwritten by reboot - need to test and use division script to keep the additional swap used permamently.

to:

More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use mkswap /dev/sdb5 where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in /etc/fstab to have it there with each reboot. Ah, well, is fstab overwritten by reboot - need to test and use division script to keep the additional swap used permamently.

March 01, 2006, at 04:03 PM by kaste -- added hint about partition based swap
Changed lines 23-29 from:

swapon /yourpath/swapfile1

to:

swapon /yourpath/swapfile1


More permanent swap should probably be in its own partition. Use coreutil's fdisk to set a partitions ID to Linux swap. Then use mkswap /dev/sdb5 where sdb5 is your target partition. you can dynamically add it with swapon like above, or put it in fstab to have it there with each reboot. Ah, well, is fstab overwritten by reboot - need to test and use division script to keep the additional swap used permamently.

January 07, 2006, at 03:49 AM by Gregor Zurowski --
Changed line 14 from:

After the second step your swap space should be increased by 256. You can check this by typing

to:

After the second step your swap space should be increased by 256MB. You can check this by typing

January 07, 2006, at 03:45 AM by Gregor Zurowski --
Changed line 23 from:

swapon /yourpath/swapon1

to:

swapon /yourpath/swapfile1

January 07, 2006, at 03:38 AM by Gregor Zurowski --
Changed line 19 from:

Since you probably do not want to execute the swapon command every time the slug starts up you can create your own startup script. Create a new startup file in /opt/etc/init.d with the following content:

to:

Since you probably do not want to execute the swapon command every time the slug starts up you can create your own startup script. Create a new startup file (e.g. S100addswap) in /opt/etc/init.d with the following content:

Added line 21:

\\

January 07, 2006, at 03:37 AM by Gregor Zurowski --
Added line 16:

\\

January 07, 2006, at 03:36 AM by Gregor Zurowski --
Deleted line 5:

\\

January 07, 2006, at 03:36 AM by Gregor Zurowski --
Added line 6:

\\

January 07, 2006, at 03:35 AM by Gregor Zurowski --
Changed lines 8-9 from:

These commands would create a 256MB swap file-

to:

The previous commands would create a 256MB big swap file.

January 07, 2006, at 03:34 AM by Gregor Zurowski --
Changed lines 1-2 from:

In order to run programs that consume large amounts of memory (in my case rsync and >300000 files) I needed to add additional swap space on my Unslug system. I didn't like to idea to play around with the partitions on my hard drive so I just added space space in form of a swap file.

to:

In order to run programs that consume large amounts of memory (in my case rsync and >300000 files) I needed to add additional swap space on my Unslug system. I didn't like to idea to play around with the partitions on my hard drive so I just added swap space in form of a swap file.

January 07, 2006, at 03:33 AM by Gregor Zurowski -- Create a swap file in order to increase swap space
Added lines 1-21:

In order to run programs that consume large amounts of memory (in my case rsync and >300000 files) I needed to add additional swap space on my Unslug system. I didn't like to idea to play around with the partitions on my hard drive so I just added space space in form of a swap file.

  1. Create a swap file:


dd if=/dev/zero of=/yourpath/swapfile1 bs=1024 count=262144
mkswap /yourpath/swapfile1

These commands would create a 256MB swap file-

  1. Attach the swapfile to the existing swap space:


swapon /yourpath/swapfile1

After the second step your swap space should be increased by 256. You can check this by typing
free

Since you probably do not want to execute the swapon command every time the slug starts up you can create your own startup script. Create a new startup file in /opt/etc/init.d with the following content:
#!/bin/sh
swapon /yourpath/swapon1

view · edit · print · history · Last edited by RobHam.
Based on work by Krigan, hifi-andrew, fishywishywoo, Init, kaste, and Gregor Zurowski.
Originally by Gregor Zurowski.
Page last modified on June 30, 2006, at 09:49 PM