* Michael Lake ([EMAIL PROTECTED]) wrote:
> Hi all
>
> When installing Debian a few months ago I made a mistake in creating the swap.
> I intended to create a 2GB swap but I seem to have zilch.
>
> ....
>
> I need to increase sda3 at the expense of sda4. I can backup to another
> machine
Hi Mike --
you can create a swapfile on any disk. With one disk go to / preferably.
Then make the swapfile with dd. Here's an example for 1G with the swapfile
given a name, swapfile1.
dd if=/dev/zero of=swapfile1 bs=1024 count=1M
/sbin/mkswap -c swapfile1
chown root.root swapfile1
chmod 0600 swapfile1
(That dates back to when swap couldn't be greater than 128M). I made several
swapfiles - swapfile2 etc. I'm pretty sure you can just go ahead and make it
any size you like with the >2.4 kernels.
THEN, simply (first time around) go 'sudo swapon /swapfile* '. Bingo, more
swap, no rebooting. During subsequent boots the system will mount anything
that looks like swap if it has an entry in /etc/fstab.
Nick.
============================
PS I've found the file I got this from, it's copied here:
Linux swapfile Notes
Ian Mathieson, 27 November 2001.
----------------------------------------------------------------------
General
* Linux uses swap space to extend physical memory. Virtual = Physical +
Swap.
* Older kernels (2.2) could cope with minimal swap space, but Linus
recommends Swap = 2 * RAM for 2.4 kernels, since they more agressively
reclaim memory from idle processes.
* Swap space can be provided via multiple disk partitions (faster) or
files (easier to reconfigure).
* The 2.2 kernel could only support 16 * 128Mb swap partitions or swap
files (ie. 2 Gb).
* The 2.4 kernel supports larger partitions/files (up to 2Gb each).
* /sbin/swapon -s shows swap space components.
* free and cat /proc/meminfo both show memory and swap space usage.
Adding swap space on Linux 2.4
* Minimum swap space required is 256 Mb.
* Create a 1Gb swap file with dd if=/dev/zero of=swapfile bs=1024
count=1M.
* Creating a new swap partition requires use of fdisk, but this should
be used with care on disks already in use.
* Use /sbin/mkswap -c swapfile to "format" the new swap file. Similarly
for a new swap partition.
* Set swap file ownership and permissions chown root.root swapfile;
chmod 0600 swapfile.
* Add each new swap space entry to /etc/fstab. Eg. swapfile swap swap
defaults 0 0.
* Enable the new swapspace(s) with /sbin/swapon -a.
Adding swap space on Linux prior to 2.4
* Individual swap files and partitions cannot exceed 128 Mb each.
* mkswap has additional parameters.
References
* Linux Partition HOWTO: How large should my swap space be?
* Kernel traffic archive: Greater 2.4 Swap Requirements.
* Comments from Linus (31 Oct 2001): Re: new OOM heuristic failure (was:
Re: VM: qsbench)
----------------------------------------------------------------------
$Id: swapfile-notes.html,v 1.2 2001/11/27 07:01:14 idm Exp $
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html