Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I was recently put in charge of a email server on linux2.4.26 running Slackware 10. The person who installed the server put in a 18.2gb scsi drive. He partioned only 200 megs for the swap. Right now the pc is a bit bogged down and according to mrtg its using most of its swap. Since I am only using 18% of the rest of the HD (not counting the 200 megs for swap) I was wanting to snip 500 megs or so off the / partion and increase the swap. Is this possible due to on the command line since I dont have any xwindows on the server?
I dont like the idea of doing it on a live server either. Changing swap size seemed a cheaper alternative to more ram though not as easy. The server load is fine for now but I can just see this becoming a bigger problem in the future.
Well, you don't need to resize or add another partition in order to provide more swap space -- you can do with a swap file. Performance will definitely take a hit, because you will not be using raw disk blocks but rather filesystem area (which deals with a lot more metadata), but the end result will be the same -- more room for your server to breathe.
1. Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.
2. At a shell prompt as root, type the following command with count being equal to the desired block size:
dd if=/dev/zero of=/swapfile bs=1024 count=65536
3. Setup the swap file with the command:
4. To enable the swap file immediately but not automatically at boot time:
5. To enable it at boot time, edit /etc/fstab to include:
/swapfile swap swap defaults 0 0
The next time the system boots, it will enable the new swap file.
6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.