linuxnewbie.org.gif
Tuesday, 12-Dec-2000 10:38:36 EST
Newbized Help Files articles discussion board bookshelf sensei's log advertising info

Building a Swap Partition

A lot of the documentation available about Linux, especially the older writings, stress the importance of a SWAP file or partition in computers with limited memory. The examples often cited are computers with 8 or 16 megabytes of RAM, a reasonable enough amount a couple of years ago. These documents seem to indicate that if you have much more RAM than that, you won't need a swap file/partition. For instance, I recently installed Linux on a machine with 96 megs of RAM, and didn't worry about swapping at all, until I stopped to monitor my memory usage for a couple of days. I realized that I'd allowed myself to be mislead, in spite of years of experience with multi-tasking operating systems, and that I desparately needed some swap space. This is how I created it.

Linux will allow you to use a file for your swap space, but this is by far an inferior solution to setting aside a partition on one of your hard disk drives. Files are more fragile, and are subject to fragmentation (a frequent cause of slow swapping in Windows operating systems). Setting aside a partition is preferable; there will be nothing on that partition save for the swapped information, eliminating the possibility of fragments.

First I needed an empty partition to use, since swap partitions don't use a standard file system. That meant finding the hard drive with the most unused space on it, and shrinking the partition to free a chunk for my swap space. There are a number of tools around that can be used for this. DiskDruid comes with the Red Hat and Mandrake distros, while fips, a DOS program, is freely available at a number of FTP sites. I'm lucky though, in that I have a copy of Partition Magic, from PowerQuest, which recognizes all flavors of FAT (File Allocation Table, the DOS/Windows file systems) partitions, as well as NTFS (NT file system, for Windows NT), HPFS (High Performance file system, for OS/2 users) and, of course, the Linux native ext2fs.

With Partition Magic (as I would have been with fips or DiskDruid), I was able to resize one of my extant NTFS partitions, and set aside about 150 megs for use as my swap partition. I wanted at least as much swap space as I had physical memory, and I tend to be conservative and overestimate what I actually will need. 100 megs would probably have been enough for my system, as that's about equal to the physical memory. I prefer to overcommit swap space though, preferring 1 1/2 to 2 times as much swap space as physical RAM. I left it unformatted, as there's a file system type that's designed for such use (all file systems have a hexadecimal number assigned to them - ext2fs is 83, and the Linux swap file system number is 82) and I knew that I'd be setting that from within the Linux version of the fdisk utility.

My next step was to boot into Linux from my bootdisk. If you don't have one of these, then MAKE ONE NOW!!!! It's easily done - type
"mke2fs -c /dev/fd0 at the command line then type cp /vmlinuz
without quotation marksof course. ohand do be sure to have a floppy disk in drive first.

Once Linux was running on my system, I ran fdisk. That was the easy part. I knew which disk drive it was on - in my case, /dev/hdc, which DOS/Windows would report as drive 2 (starting from 0). So, I typed "fdisk /dev/hdc". Fdisk opened, and I was able to look at the partitions on the disk, and chose the correct one, hdc6. (Partition naming is a separate topic altogether.)

[-NHF Control Panel-]
The Linux Channel at internet.com
Linux Planet
Linux Today
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
BSD Today
Apache Today
Enterprise Linux Today
BSD Central
All Linux Devices
SITE DESCRIPTIONS
[-What's New-]
Order a Linuxnewbie T-Shirt
Easy Webcam NHF
Directory Navigation NHF
Installing Snort 1.6.3 on SuSE 6.x-7.x
Customizing vim
The SysVinit NHF
Installing ALSA for the VT82C686 integrated sound
USB Creative Video Blaster II for Linux
Configuring the Intellimouse Explorer in XFree86 V4+
The beginnings of a distro NHF
Getting Past Carnivore?
Getting and Installing PGP
Getting your ATI Rage 128 Working
How to create a multiple partition system
Using Fdisk
Introduction to Programming in C/C++ with Vim
Adding a Hard drive in Linux -- In five steps
Installing ALSA for the Yamaha DS-XG Sound Card
Getting your Diamond Rio Mp3 Player to work with Linux
Bash Programming Cheat Sheet
Installing NVIDIA Drivers for Mandrake
Setting up Portsentry
Hard Drive Speed Tweak for Linux
Sensei's Log
Chat room
Join: Linuxnewbie.org SETI Black Belts!
Send in your news
Click the image to add Linuxnewbie.org to your MyNetscape Page
[-LNO Newsletter-]

[-Archive-]
The beginnings of a distro NHF
Connecting to the Internet using KPPP
Getting your SBLive to work
Unreal Tournament NHF
LWE Day 2 Pictures
LWE Day 1 Pictures
The LNO FAQ!
WoW (Words of Wisdom)
Other sites news
What is Linux?
What is Linux? part deux (ups & downs)
Search newsgroups
The List
ALS Report
Feedback Form
jobs.linuxtoday.com.gif
Match: Format: Sort by:
Search:
Copyright © 1999 All Rights Reserved
[-Quick Links-]

Copyright 2000 internet.com Corp. All Rights Reserved. Legal Notices Privacy Policy

internet.com.gif