SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was wondering about the swap file. I did not create one when installing slack 10. I have 512 MB of ram, do I need a swap file? And if so, can one be created now, after I have already done my installation?
You don't really need one with the ammount of RAM you have, but if you scan & edit a huge image, or play an intensive game (like ut2k4), you're computer would slow down to a halt.
I have a gig of ram, and linux hardly ever uses it all, but just incase, i left a very small swap there for safety.
Well, I guess I dont need one, then. This comp is just for running my various servers and learning how to use linux and it's applications. I have a windows box set up specifically for all my gaming needs.
Yea, i wouldn't worry too much about it if i were you. Just for the fun of it, you could always see how much Total ram is being used in the System Monitor. This will give you reassurance.. =)
For proper performance i'm pretty sure linux requires a swap file. The kernel expects it to be there and as such the mem management is built to take advantage of it. If it is not there, you may see performance losses, even if it doesn't look like swap is being used. Also, since your using your box as a server, you don't want some memory leak taking it down, you need a certain amount of redundancy that swapspace provides. It's not like it takes a whole lot of space, you only need like 250-500mb.
It's easy to make swap space after the install, the hard part is partitioning it. But once you have the partition and have made the entry into fstab for it just do:
Well, that depends on alot of things, like what filesystem your using and how many partitions you have and where they are mounted.
For all intents and purposes you will likely have to delete a partition and split off a chunk for swap space, then recreate the partition. I have no clue about resizing partitions in linux, but it is highly dependant on what filesystem you use, and I think it is not very reliable/easy in any case. This question is enough for a whole seperate thread, it's a suprisingly difficult issue if you do not want to delete any of your partitions which you already have or lose data on them.
You can check out this project for info about resizing partitions.
But it would be much easier to simply set up a swap file. The performance is slightly less than with a dedicated partition, but since you have 512Megs of RAM and are seeing little swap use anyway, the only need for swap is for insurance in case your system should exhaust the actual memory.
You can set up a swap file with the following steps:
This will create a 512Mb swap file in your root directory. To check that it has worked, run the command 'free' and it should show your physical, as well as swap memory. To have this swap setup on each reboot, add the following line to /etc/fstab:
There is really no need for swap if you have enough physical RAM.
The kernel is now advanced enough that it can operate with or without a swap, and any programs that require swap to operate are fundamentally broken in the first place.
If you are just using this machine for testing purposes, I wouldn't bother even putting a swap file in, let alone a swap partition.
OK, thanks for your help guys. I am going to be using this box as a continuously running server soon, so I went ahead and added the swap file in just to be on the safe side.
sh1ft is absolutely right. Even if you have huge amounts of RAM, every nowand then the kernel will deem it prudent to swap out a few KB, or even less. If there is NO swap available, more time is lost looking for it than would be lost in doing it. You can always create a small SWAPFILE(not partition) in your /root dirlike this
dd if=/dev/zero of=/root/swapfile bs=512k count=1
mkswap /root/swapfile
swapon /root/swapfile
Then put:
/root/swapfile swap swap defaults 0 0
in your /etc/fstab and be done with it.
ZipSlack comes with a 512KB swapfile like this, and the install.zip installer has a 10MB swapfile.
It's worth noting that the minimum size of swap allowed is only 4K! Some machines will seize up without any swap at all.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.