swapfile doesn't work
Hi all,
I've created a swapfile, the following shows how i did it: # cd /mnt # dd if=/dev/zero of=swapfile bs=1024 count=1048576 # mkswap swapfile # swapon swapfile Here is the fstab entry: /mnt/swapfile none swap defaults 0 0 But when i check ram usage with free -m, it gives the following: total used free shared buffers cached Mem:1008 917 90 0 142 276 -/+ buffers/cache: 498 509 Swap: 1023 0 1023 Here is my problem - i think - , although the machine is up at least 24 hours swapfile is never used. Is this a normal situation? I check ram usage, although free ram decreases to 16BM, swapfile is never used. Thanks for your help. |
/mnt/swapfile none swap defaults 0 0
should be: /mnt/swapfile swap swap defaults 0 0 Btw, if you've created a swap partition this isn't needed. EDIT: I've just checked man, and it should be none as you put, but well I've always used swap and worked :scratch: It should work with the steps you took. This is weird, are you sure the file is there? :) Btw, if you modify your swap stuff, just run swapon -a (that will mount the swaps in fstab and skip already mounted ones) About the swap not being used, well, it's normal if you've enough RAM, my server rarely uses swap and when it does it uses just a few mb. Same happens with my main machine that has plenty of RAM and I use vmware often to test some Windows apps. |
your /etc/fstab entry should show where the partition is actually located:
this is mine............ Code:
/dev/hda7 swap swap defaults 0 0 ever used ........unless I do something graphics intensive like--opening 20 jpg/png windows at the same time...........then it might use 5-8 megs of swap.......... |
Quote:
be none. In the begining i had added /mnt/swapfile swap swap defaults 0 0 to fstab but, then changed it to /mnt/swapfile none swap defaults 0 0 I dont understand when this swap will be used, i can see free ram is 16MB, but still no use of swapfile. There are lots of apache process running, and lots of emails scanned with qmailscanner all the time. I think that these processes should be consuming lots of memory. So to me, it is still weird why swapfile hasnt been used. Quote:
Thanks for your suggestions. |
Do swapon -s to see if it is really activated. If you have lots of RAM and are not doing heavy use, Linux will not natably use swap space, but it should be there, even if only the minimum 4K.
Whatever the man pages say, I always use in fstab: /root/swapfile swap swap defaults 0 0 which is the way it is for zipslack and install.zip. this also works: /root/swapfile swap swapfile defaults 0 0 Your problem may be with permissions also. /root is a better place to put your swapfile. Better use of space anyway, as it occupies some of the space allocated to 'root' by default(5%of / partition). |
The free command indicates there is swapspace. But I think you have plenty of RAM (1024 MB ??) and there is no need to use the slow swapmemory. The second line of output in free indicates that without buffers and cache you will have about 509 MB RAM available
|
Thanks for answers, i think i was a little bit hurry to panic, now system began to use swapfile, but it still uses little amount of it. Now it seems to be ok. If problem occurs i will try your advices.
Thanks again. |
Why didn't you use fdisk? It is easier.
|
All times are GMT -5. The time now is 03:18 PM. |