|
HowTo.MountNFSSwapPartition History
Hide minor edits - Show changes to markup
June 07, 2006, at 11:17 AM
by AnttiPJHämäläinen -- Added the missing mkswap
Changed line 46 from:
- Mount the swap partition on the local loop device:\\
to:
- Setup the device for swap usage:\\
Added lines 48-51:
mkswap /dev/loop0
- Mount the swap partition on the local loop device:
\\
Changed line 120 from:
to:
November 29, 2005, at 07:25 AM
by JimmyFergus --
Changed lines 106-107 from:
Getting the loopback module in OpenDebianSlug (ipkg install kernel-loop-module) is a problem. There may be easier ways, but one option is to do the following (different package for versions other than 2.7beta). Ideally you would do this in the initial install.
to:
Getting the loopback module in OpenDebianSlug is a challenge (finding the equivalent of ipkg install kernel-loop-module). There may be easier ways, but one option is to do the following (different package for versions other than 2.7beta). Ideally you would do this in the initial install.
November 28, 2005, at 01:26 PM
by JimmyFergus -- notes for OpenDebianSlug
Changed lines 109-110 from:
wget http://ipkg.nslu2-linux.org/feeds/openslug/cross/2.7-beta/kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
ipkg install kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
to:
wget http://ipkg.nslu2-linux.org/feeds/openslug/cross/2.7-beta/kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
ipkg install kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
rm install kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
Changed lines 113-115 from:
cd /mnt
cp -Ra /lib/modules/* lib/modules
rm /mnt/.recovery
to:
cd /mnt
cp -Ra /lib/modules/* lib/modules
rm /mnt/.recovery
November 28, 2005, at 11:56 AM
by JimmyFergus --
Added lines 3-4:
Changed lines 104-107 from:
N.B. Thanks to hanjo for noting the parameters on losetup we backwards.
to:
Getting the loopback module in OpenDebianSlug (ipkg install kernel-loop-module) is a problem. There may be easier ways, but one option is to do the following (different package for versions other than 2.7beta). Ideally you would do this in the initial install.
- reboot to flash (
touch /.recovery and reboot)
wget http://ipkg.nslu2-linux.org/feeds/openslug/cross/2.7-beta/kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
ipkg install kernel-module-loop_2.6.12.2-r17.1_nslu2.ipk
- mount your nfs filesystem on /mnt (
mount host:/dir /mnt)
cd /mnt
cp -Ra /lib/modules/* lib/modules
rm /mnt/.recovery
- reboot
July 15, 2005, at 12:36 PM
by daka --
Added line 76:
July 14, 2005, at 05:04 PM
by daka --
Changed lines 93-94 from:
chmod +x /etc/init.d/swap
to:
chmod +x /etc/init.d/swap
Changed lines 97-98 from:
update-rc.d swap defaults
to:
update-rc.d swap defaults
July 14, 2005, at 05:02 PM
by daka --
Changed lines 89-90 from:
^D (thay is pressing Ctrl+D)@@
to:
^D (that is pressing Ctrl+D)@@
Added lines 102-103:
July 14, 2005, at 05:02 PM
by daka --
Changed line 60 from:
to:
@@cat > /etc/init.d/swap\\
Changed lines 89-90 from:
^D (thay is pressing Ctrl+D)
to:
^D (thay is pressing Ctrl+D)@@
July 14, 2005, at 05:01 PM
by daka --
Added lines 54-101:
Making it permanent
This is all good, but it can get a bit annoying doing that on every boot.
First, create the file /etc/init.d/swap (you may have to modify this a bit):
cat > /etc/init.d/swap #!/bin/sh
set -e
case "$1" in start) echo -n "Starting swap: " modprobe loop losetup /dev/loop0 /swapfile swapon /dev/loop0 echo "done" ;; stop) echo -n "Stopping swap: " swapoff /dev/loop0 echo "done" ;; restart) swapoff /dev/loop0 swapon /dev/loop0 ;; *) echo "Usage: swap { start | stop | restart }" >&2 exit 1 ;; esac
exit 0 ^D (thay is pressing Ctrl+D)
Then make it executable:
chmod +x /etc/init.d/swap
Then make it start:
update-rc.d swap defaults
Done. On the next reboot it should mount everything.
June 24, 2005, at 10:01 PM
by g2 -- Update losetup
Changed line 32 from:
scp loop.ko root@192.168.1.5:/home/root\\
to:
ipkg install kernel-module-loop\\
Changed lines 38-39 from:
to:
Changed lines 42-43 from:
losetup /mnt/swap/swapfile /dev/loop0
to:
losetup /dev/loop0 /mnt/swap/swapfile
Added lines 53-54:
N.B. Thanks to hanjo for noting the parameters on losetup we backwards.
May 06, 2005, at 07:11 PM
by tman -- Typos
Changed lines 3-4 from:
First off, here's a shout-out to my friends (dyoung and robbat2)helping me out late at night (my timezone) and getting this job done. robbat2 is from the gentoo-embedded crew and explained this recipie to me. So no more delay... Here's the secret sause.
to:
First off, here's a shout-out to my friends (dyoung and robbat2) helping me out late at night (my timezone) and getting this job done. robbat2 is from the gentoo-embedded crew and explained this recipe to me. So no more delay... Here's the secret sauce.
Changed lines 7-8 from:
I haven't run this on Unslung. It works on OpenSlug (I'll be testing somemore on today's build 05/06/2005). While the slug is a great little workhorse, it's short on memory. Sometimes having a swap device comes in handy -- often while natively compiling. Sometimes one doesn't have a harddisk attached or any device attached, but a little extra memory would be great for performance or just to allow stuff to work.
to:
I haven't run this on Unslung. It works on OpenSlug (I'll be testing some more on today's build 05/06/2005). While the slug is a great little workhorse, it's short on memory. Sometimes having a swap device comes in handy -- often while natively compiling. Sometimes one doesn't have a harddisk attached or any device attached, but a little extra memory would be great for performance or just to allow stuff to work.
Changed lines 13-32 from:
- Export a directory you want to have the swapfile in from the NFS server.
- Change directory on the NFS server to that directory and create a swapfile. The following command creates a zeroed 128MB file called swapfile. As always be careful when using dd, and *double* check the command before you hit enter
- dd if=/dev/zero of=swapfile bs=1M count=128
- Start the NFS server and portmap on the server machine if it's not already started.
- On the TARGET (slug) NFS mount the partition. In my case it looked something like the following(192.168.1.5 is the NFS server IP address):
- mkdir /mnt/swap
- mount -t nfs 192.168.1.5:/exported_NFS_directory /mnt/swap
- On the TARGET, initialize the swapfile partition. N.B. I spent about 1 hour chasing down the fact that my Host and Target systems are opposite endian. So the Host created swapfile had a tiny little error when mounting the swap device. This is avoided by initializing the swapfile partition from the TARGET. The command to do this is
- mkswap /mnt/swap/swapfile
- scp the loopback kernel module to the slug if you don't already have it. I'll be adding this as a default module pretty soon, but in the meantime you can just (from you build box find the loop.ko kernel module in build/tmp) and
- scp loop.ko root@192.168.1.5:/home/root
to:
- Export a directory you want to have the swapfile in from the NFS server.
- Change directory on the NFS server to that directory and create a swapfile. The following command creates a zeroed 128MB file called swapfile. As always be careful when using dd, and *double* check the command before you hit enter
dd if=/dev/zero of=swapfile bs=1M count=128
- Start the NFS server and portmap on the server machine if it's not already started.
- On the TARGET (slug) NFS mount the partition. In my case it looked something like the following (192.168.1.5 is the NFS server IP address):
mkdir /mnt/swap mount -t nfs 192.168.1.5:/exported_NFS_directory /mnt/swap
- On the TARGET, initialize the swapfile partition. N.B. I spent about 1 hour chasing down the fact that my Host and Target systems are opposite endian. So the Host created swapfile had a tiny little error when mounting the swap device. This is avoided by initializing the swapfile partition from the TARGET. The command to do this is
mkswap /mnt/swap/swapfile
- scp the loopback kernel module to the slug if you don't already have it. I'll be adding this as a default module pretty soon, but in the meantime you can just (from you build box find the loop.ko kernel module in build/tmp) and
scp loop.ko root@192.168.1.5:/home/root \\
Changed lines 36-54 from:
- from the slug target install the kernel module if one needs to.
- insmod loop.ko
- loopmount the swap file as a loop device
- losetup /mnt/swap/swapfile /dev/loop0
- Mount the swap partition on the local loop device
- swapon /dev/loop0
- Enjoy!
- cat /proc/meminfo to see the swap space is avialable to the system
- cat /proc/meminfo
to:
- From the slug target install the kernel module if one needs to:
insmod loop.ko
- loopmount the swap file as a loop device:
losetup /mnt/swap/swapfile /dev/loop0
- Mount the swap partition on the local loop device:
swapon /dev/loop0
- Enjoy!
- cat /proc/meminfo to see the swap space is avialable to the system
cat /proc/meminfo
May 06, 2005, at 01:22 PM
by g2 -- Create HowTo CreateNFSSwapPartition
Added lines 1-53:
How To Create a NFS Swap partition (OpenSlug version)
First off, here's a shout-out to my friends (dyoung and robbat2)helping me out late at night (my timezone) and getting this job done. robbat2 is from the gentoo-embedded crew and explained this recipie to me. So no more delay... Here's the secret sause.
Why do you want an NFS swap partition
I haven't run this on Unslung. It works on OpenSlug (I'll be testing somemore on today's build 05/06/2005). While the slug is a great little workhorse, it's short on memory. Sometimes having a swap device comes in handy -- often while natively compiling. Sometimes one doesn't have a harddisk attached or any device attached, but a little extra memory would be great for performance or just to allow stuff to work.
How To do it
I'm assuming you are a little familiar with NFS and have an NFS server running.
- Export a directory you want to have the swapfile in from the NFS server.
- Change directory on the NFS server to that directory and create a swapfile. The following command creates a zeroed 128MB file called swapfile. As always be careful when using dd, and *double* check the command before you hit enter
- dd if=/dev/zero of=swapfile bs=1M count=128
- Start the NFS server and portmap on the server machine if it's not already started.
- On the TARGET (slug) NFS mount the partition. In my case it looked something like the following(192.168.1.5 is the NFS server IP address):
- mkdir /mnt/swap
- mount -t nfs 192.168.1.5:/exported_NFS_directory /mnt/swap
- On the TARGET, initialize the swapfile partition. N.B. I spent about 1 hour chasing down the fact that my Host and Target systems are opposite endian. So the Host created swapfile had a tiny little error when mounting the swap device. This is avoided by initializing the swapfile partition from the TARGET. The command to do this is
- mkswap /mnt/swap/swapfile
- scp the loopback kernel module to the slug if you don't already have it. I'll be adding this as a default module pretty soon, but in the meantime you can just (from you build box find the loop.ko kernel module in build/tmp) and
- scp loop.ko root@192.168.1.5:/home/root
Note: My build machine and my NFS server are the same device. Yours may be different.
- from the slug target install the kernel module if one needs to.
- insmod loop.ko
- loopmount the swap file as a loop device
- losetup /mnt/swap/swapfile /dev/loop0
- Mount the swap partition on the local loop device
- swapon /dev/loop0
- Enjoy!
- cat /proc/meminfo to see the swap space is avialable to the system
- cat /proc/meminfo
|