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