Creating Swapfile

Status
Not open for further replies.

Son of Sam

Posts: 50   +0
so, whats a swapfile and how do i make one. i think i kinda know, but not too sure. i believe it requires a dos partition, which i dont have and cant create due to lack of floppy drives. the problem that im running into is lack of ram. im trying to run it on an IBM 770 Think-pad, and it doesnt have enuff ram. it has 64 and knoppix requires 84 atleast to run KDE or any office suites. i know absolutely nothing about running linux from command line, except for the install command for rpm. or whatever. sooooooooooooooooooooooooooooooooo....i forgot what i was tlaking about and im too lazy to re-read so im ending it here.
 
The best solution in linux is the standard one: a linux swap partition

You do not need something formatted with dosfs, all you need is unpartitioned space on your disc. If you do not have unpartition spaced, I suggest using partition magic or parted to re-size your partitions, and give yourself 384 - 1GB of free space. Afterwards, create the partition and set it to swap, make it swap and then add it to fstab. You do that as follows:

fdisk /dev/hdx (where x is the hard drive you are creating the partition on)

You press (c) to create a new partition and give it a number. Then you press (t) to change the type of that partition to 82

(w) write the partition table, then (q) quit fdisk

Then you use the mkswap on that partition to turn it into swap:

mkswap /dev/hdx

If you want linux to start using it immediately, issue this command:

swapon /dev/hdx

The kernel will now start to swap out things as needed

To permanently use this swap partition, add the following entry to /etc/fstab:

/dev/hdx none swap sw 0 0

save, reboot, done!

Use the TOP command to see if the kernel recognizes swap.
 
now will this work with a distro like knoppix or phlak where it boots straight from the cd. well, not boots. i cant remember the term but the whole thing is just uncompressed from the cd into...something. i lost it. i gotta quit smoking. well, if you happen to get what i mean, gimme a hand please.
 
You can create the swapfile on any partition Knoppix can write to.

To create a file filled with zeroes use the dd command. "dd if=/dev/zero of=/swapfile bs=1m count=1024" would create a 1GB file called swapfile in / filled with zeroes.

To format the file as Linux swap do "mkswap /swapfile"

To use the file as swapfile run "swapon /swapfile"
 
Thank you nodsu! im gonna try it when i decide to get off my ***** :slurp:

edit: holy crap, i just saw soul harvesters post. thankyou both :grinthumb
 
Status
Not open for further replies.
Back