LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   swap file (https://www.linuxquestions.org/questions/linux-general-1/swap-file-237530/)

linuxhippy 10-01-2004 09:49 AM

swap file
 
I'm about to install Slackware 10 on my laptop pc. I've already installed it beside 2 other Linux distros on my desktop and like Slack. My question is can I install everything on 1 drive and 1 partition (no swap partition) and then make a swap file. I don't have much memory on my laptop pc (96 megs), so a 200 meg swap partition seems like wasted space that I may need on this small 4 GB drive.

rjlee 10-01-2004 10:51 AM

Yes, you can make a swap file. Use dd to create an empty file (copy from /dev/zero to the appropriate destination) and mkswap to make a swap area on it. List the file in /etc/fstab as if it were a swap partition, and activate it with:
Code:

swapon -a
See the various man-pages for more.

linuxhippy 10-01-2004 05:03 PM

are swap partitions quicker and more reliable?
 
are swap partitions quicker and more reliable?

J.W. 10-01-2004 06:54 PM

Quicker and more relliable than what?

Due to the fact that swap usage involves physical I/O to your hard drive, which is several orders of magnitude slower than access within RAM, you want to keep swap usage as low as possible, and the more time it's at zero usage, the better your system will perform. If you've got 96Mg of RAM then I'd suggest just creating a 128Mg swap partition. Even on a 4G drive, that gives approx 95% of the usable space to Linux and data storage. -- J.W.

rjlee 10-11-2004 04:07 PM

Swap files are no more reliable than swap partitions. They are, however, slower than partitions, particularly if the swap file becomes fragmented on the disk (as the disk head has to seek in the middle of reads and writes to what would otherwise be contiguous space).


All times are GMT -5. The time now is 12:28 AM.