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

Building a Swap Partition

[-Previous Page-]

Fdisk tells you that pressing 'm' will bring up help for the application, but it really gives you a menu of choices. I chose 'l', to list the different file system types, so that I'd be precisely sure of my choice, then 't' to change the type on the partition i was working with. Fdisk told me what to do to make the desired change. Once I was satisfied that I'd made the change I wanted to the correct partition, I typed a 'w', which wrote the changes to disk, and exited fdisk.

Then it was time to start reading man pages. I read about a dozen, and found the actual steps to be simple. First I did "mkswap -c -v1 /dev/hdc6" (remember that the actual device name will almost certainly be different on your system). The -c option told the computer to check for any bad spots on the disk, and to tell me how many it found, if any. Had any been found, I'd have had to have rethought my plan, as I'd not wish to use a partition that had physical flaws on it. Happily, there were none. The -v1 switch told it to use the updated version of the swap filesystem. I read several pages of documentation to come to the conclusion that NOT using that switch would have been extremely dumb of me. The computer happily formatted the partition to the correct type for me. Next, it was time to turn on the new partition, with the /sbin/swapon command. I used it with the '-a' switch, which makes all devices listed as 'swap' in the file /etc/fstab available. As I'd not edited that file, the switch wasn't needed; I could have simply typed "swapon /dev/hdc6".

But it didn't work. The device was "busy", because it takes a reboot to complete the changes to the partition table that I'd made. So I added a line to the file /etc/rc.d/rc.local (THIS FILE IS DISTRO SPECIFIC. In Mandrake and Red Hat distros, the correct file is /etc/rc.d/rc.sysinit. that read "swapon -a /dev/hdc6".) The file name that I edited is in the Slackware distro; you may have to look through the files in your /etc/rc.d directory to choose the one you need.

One thing I did NOT do was to add a line to my /etc/fstab file reading "dev/hdc6 swap swap default 1 0". This would have been automated had I installed a swap partition at the same time that I installed Linux.Then the line in my /etc/rc.d/rc.local file could have read simply "swapon -a".

In any event, after a reboot, this time from the hard drive rather than the floppy, my new swap partition corrrectly loaded. The benefits are that Linux uses much less of the physical RAM in the machine, so that there's more available for caching information. It's most noticeable when I'm switching applications in X windows, or switching between the different virtual desktops I've set up.

  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/fd0at the command linethen type cp /vmlinuzwithout quotation marksof course. ohand do be sure to have a floppy disk in drive first.

author: grrlfox
she'd love to hear your comments......

[-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