-   Linux - Networking (
-   -   Swap on Linux-based PXE image (

cccc 07-29-2011 03:08 PM

Swap on Linux-based PXE image

I try to prepare Linux-based image for remote network boot via PXE.
Do I need to create Swap for this PXE image?

BTW the boot image will have about 300MB or less and we have P4/2GHz workstations with 1GB RAM.

frieza 07-29-2011 03:16 PM

technically no, however if you did the swap would have to be on a local disk not over the network otherwise when it starts swapping the computer's performance would drop like a rock towards a black hole, you would probably have to go out of your way though to make a swap file and use a loopback device anyways to do that).

depending on what you do with the remote boot workstation you should be able to get by without swap, even a hard disk really.

jefro 07-29-2011 03:31 PM

Never tried that, never heard of anyone doing it. I guess you could create a swap file on the local system. You'd have to have most of the net booted OS up then run some script to make a swap and mount it and be sure to delete it when powers off or delete on next start.

Many distro's can be booted over the network without any modifications but some need quite a lot of work.

Many work also from an iSCSI like freenas or open(darn I forgot that name). Then you could use gpxe or ipxe.

cccc 07-29-2011 07:55 PM

Sorry, I've read this before:

and was unsure.

>>Adding a swap file

In case you do need or want to set up a swapfile, here's what I did to get one working:

sudo apt-get install dphys-swapfile

this package sets up a swap file at /var/swap that is 2x your current ram. however, it still doesn't setup the swapfile on its own, though it does try. to get the swap file working the rest of the way, do:

sudo losetup /dev/loop0 /var/swap
sudo swapon /dev/loop0

then, run top and you will see you have a swap file. however, put in as much ram as you need for what you are going to run, and just look at your swap file as "in case of emergency", because it is not efficient as a ram or a regular swap file, but should keep something from crashing. I'm running mythtv on top of a full feisty desktop, and tried it with 256mb ram, and myth-frontend would crash when i would try to bring it up. with the swap file, it would launch, but would take a while. i added an additional 256mb to bring the total to 512mb and it runs flawless, and i add the swap file just in case. i just make a script for it to set up the swap file at boot.<<

All times are GMT -5. The time now is 06:22 PM.