swap gone?coulForum: Other Help Topics Topic: swap gone?coul started by: antonino Posted by antonino on Nov. 10 2006,10:14
During my installation of dsl a couple of months ago, I made two primary partitions on a completely cleaned hdu:- /dev/hda1 - linux swap - /dev/hda3 - linux ext2 Never a problem, until this morning: during boot I was notified it might be a good idea to create a swap-file on an empty dos-partition... As the box doesn't have a dos-partition this 'offer' couldn't complete. I am flabbergastered as to what happened. Does anyone have any idea what might have happened here? And how to solve this? Thank, Ton Posted by Ramik on Nov. 10 2006,10:43
I can tell you that to "prep" the swap partition you need:"mkswap /dev/hda1" And to activate the swap you need: "swapon /dev/hda1" So to find the 2nd command just grep your root for it, it will take a while but should work... If you can't find were it supposed to be, just do the easy solution and throw the 2nd command to wherever script you feel comfortable with playing around that is part of the init\rc process, as long as you have about 16-32ram and the script runs before X, you should be fine... Posted by antonino on Nov. 10 2006,14:27
Thanks.In the meantime I tried this: I placed
in /opt/bootlocal.sh What's the difference with what you advised? Posted by ^thehatsrule^ on Nov. 10 2006,15:26
using .swp is a swapfile for dos formats... win9x style.His advice requires that your partition be linux swap (type 82). I don't think it really matters.
Posted by skaos on Nov. 10 2006,15:38
Isn't a swap partition faster than a swap file on a file system (one less level to go through)? If you make a swap partition you can add this to /etc/fstab which should enable swap on boot:/dev/hda1 swap swap defaults 0 0 Posted by antonino on Nov. 10 2006,16:34
Well, /dev/hda1 was and still is a linux swap partition (at least according to cfdisk), so I am still amazed by this unknown 'behaviour'.I put /dev/hda1 swap swap defaults 0 0 in /etc/fstab but that didn't work: Swap Ussed: 0/0 -- 0% Posted by ^thehatsrule^ on Nov. 10 2006,18:51
I think you need to use mkswap to format it first... did you already do that though?
Posted by Ramik on Nov. 10 2006,19:42
A swat partition is faster and requires formating first with mkswap,It is loaded with the same binary "swapon" bu instead of pointing to the file, you point to the partition. Swap Partitions cant be mounted, it is considerably faster then a swap file because the kernel access the data directly rather then first checking file location in the partition table plus fragmentations are rarer since the swap partition table is quite more flexible... If you have a choice, go with swap partition, an their is an added benefit is if the swap partition in on another HD. Posted by antonino on Nov. 11 2006,15:01
Thanks to all contributors!I put: /dev/hda1 swap swap defaults 0 0 in /etc/fstab and mkswap/dev/hda1 in /etc/init.d/checkroot.sh. between the lines containing echo "Activating swap..." and swapon -a 2> /dev/null Posted by Ramik on Nov. 11 2006,20:12
Sounds right, Good luck !
Posted by skaos on Nov. 13 2006,13:02
It shouldn't be necessary to run mkswap more than once, and I think the swap entry in fstab will mount swap (i.e. run swapon).
Posted by antonino on Nov. 13 2006,14:17
I tried that, but to no avail - see my Posted: Nov. 10 2006,17:34, or do you mean more than once per boot?
Posted by skaos on Nov. 14 2006,13:58
By once I mean just once and not once every boot. Maybe there's some leftover setups form your experimentation or maybe the partition type is incorrect (swap=type 82). You could run "dmesg|grep swap" or "dmesg|more" (without quotes) to get some idea of what's going on.
Posted by antonino on Nov. 14 2006,14:17
Was already afraid of that... /dev/hda1 is a linux swap partition from the very beginning. Nothing about the partition in dmesg... |