increasing the swap space after installing linux
Hi,
I have installed Mandrake Linux. I find that the swap space is used above 90% always. Hence, I want to increase the swap memory space. Please let me know how to do it. Regards, Shyam |
Hi LinToWinWin,
It is easy to do. As you have already partitioned your disk, the most recommendable is to create a partition file. You must first create a file of desired length with "dd", then use mkswap to prepare it and after just enable swap. It is important the file be created with "dd" because it has to be a contiguous, not an sparse file. So, the commands to do it are Code:
dd if=/dev/zero of="/path/to/your/swap-file" bs=1k count="your-need-in-MB"x1kx1k Code:
"/path/to/your/swap-file" swap swap defaults 0 0 "your-need-in MB" means the number of mega bytes you want. Observe we are multiplying bye 1kB two times. So, if you want 256MB, the command will be 256x1kx1k. If you want 1GB, you can put 1kx1kx1k. Have fun! PS. you can get more information on manual page for mkswap. Linux can work with more than one swap area. |
This probably will involve fdisk as long as you have extra, unused, unformated space laying around on a hd. Read up about making a new swap partition using fdisk. Then change /etc/fstab to include a swap partition. Use man fstab to see the man pages about fstab.
|
Hi osvaldomarques
Ummm............I think your calculations are wrong in the "count=" option for the 'dd' command.............Since you're using a block size of 1k (bs=1k) the count will be in 1k blocks, so the count= option should be count="your-need-in-MB"x1k and not count="your-need-in-MB"x1kx1k (drop the extra x1k) And to simplify it even more for the n00b, since you specifying a file size in MB, why not use a block size of 1MB (bs=1M) and then specify the count= option as a number of megabytes. For example, to create an empty file of 200 MB, use this command: dd if=/dev/zero of=/path/to/your/swap-file bs=1M count=200 :) |
HI thegeekster,
Man, you are right! Double right! I was consulting an old "man" where the multipliers went just until "1k". A translated manual. The reason I don't like translations. And you are also right of the excess of 1k's. Thanks for the correction. Osvaldo |
All times are GMT -5. The time now is 06:27 AM. |