LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I installed linux and forgot to create a swap space partition (https://www.linuxquestions.org/questions/linux-newbie-8/i-installed-linux-and-forgot-to-create-a-swap-space-partition-331319/)

Starch 06-07-2005 04:13 PM

I installed linux and forgot to create a swap space partition
 
I don't want to repartition anything anymore. Is it possible to use swap space in a filesystem?

Thanks in advance!

nadroj 06-07-2005 04:20 PM

is there any unpartitioned/free space on any hard disks?

Starch 06-07-2005 04:23 PM

There is no unpartitioned space, but there is free space on a partition.

michaelk 06-07-2005 05:40 PM

Yes, it is possible to use a file as swap space just like windows but it will not be as fast as a swap partition. If you have free space you can resize an existing partiton and then create a swap partition.

Here is an example for a swap file:
dd if=/dev/zero of=/usr/local/newswap bs=1000000 count=20 (20mb swap file)
chmod 600 /usr/local/newswap
mkswap /usr/loca/newswap
swapon /usr/local/newswap

Then add this line to your /etc/fstab
/usr/local/newswap swap swap defaults 0 0

BTW you can change the location of the swap file.

If you create a swap partition the steps will be
mkswap /dev/hdxy
swapon /dev/hdxy
And the fstab
/dev/hdxy swap swap defaults 0 0

Where hdxy is the ID of the swap partition.

exit3219 06-22-2005 08:03 AM

Thanks, michaelk, that's all I needed to know. I had a similar 'issue'. I just didn't know how to tell /etc/fstab to use swap.

(Isn't it a great thing that LQ has a Search function?! :D )

syg00 06-22-2005 08:29 AM

Quote:

Originally posted by michaelk
Yes, it is possible to use a file as swap space just like windows but it will not be as fast as a swap partition.
The (2.6) kernel developers seem to believe this is no longer true.


All times are GMT -5. The time now is 12:47 PM.