adding swap partition

Rick Stevens rstevens at vitalstream.com
Thu Jun 10 18:52:36 UTC 2004


invincible invincible invincible wrote:
>   
> hello all
> 
> i have installed red hat linux 9.0 but at the time 0f partitioning it was  giving me error at the time of creating swap partition.
> so i installed linux without it and the systems is kind of behaving quite slow.
> is there a way to add swap partition after we have installed linux.
> waiting for ur reply.

You can create an empty file of the size you want, use "mkswap" on the
file to convert it to swap format, then enable it using the swapon
command.

For example, to create a 512MB swap file, find a filesystem that has
512MB free (use the "df -h" command).  Let's assume that's on your /var
filesystem.  As root:

	# dd if=/dev/null of=/var/swapfile bs=1M bc=512
	# mkswap /var/swapfile
	# swapon /var/swapfile

You can then edit your /etc/fstab file and add a line like:

	/var/swapfile    swap          swap    defaults        0 0

which will cause the file to be used automatically at your next boot.
Also note that the maximum size of a single swap partition or file is
2GB, but you can have up to 8 of those (16GB total swap).

If you have unassigned space on your hard drive, you can create a swap
_partition_ and use it.  I don't know what kind of error you got, but
the most common one in disk druid is trying to specify a mountpoint
for a partition with the "swap" filesystem type.  I'd sure like to know
what you did and what error you got.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-    If your broker is so damned smart...why is he still working?    -
----------------------------------------------------------------------





More information about the Redhat-install-list mailing list