Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


LinkBack Search this Thread
Old 06-07-2005, 04:13 PM   #1
Registered: Jan 2005
Posts: 77

Rep: Reputation: 15
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!
Old 06-07-2005, 04:20 PM   #2
Senior Member
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 58
is there any unpartitioned/free space on any hard disks?
Old 06-07-2005, 04:23 PM   #3
Registered: Jan 2005
Posts: 77

Original Poster
Rep: Reputation: 15
There is no unpartitioned space, but there is free space on a partition.
Old 06-07-2005, 05:40 PM   #4
Registered: Aug 2002
Posts: 11,538

Rep: Reputation: 675Reputation: 675Reputation: 675Reputation: 675Reputation: 675Reputation: 675
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.
Old 06-22-2005, 08:03 AM   #5
Registered: May 2005
Location: Moldova
Distribution: Kubuntu
Posts: 199

Rep: Reputation: 30
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?! )
Old 06-22-2005, 08:29 AM   #6
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,801

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forgot to create swap partiton J_stuart Linux - General 5 09-01-2005 04:43 PM
create and remove swap space cbarbot Linux - Newbie 1 04-14-2004 11:42 AM
Swap Partition Space fiending Linux - Distributions 2 11-04-2003 10:07 PM
How to increase SWAP partition space ? sureshsaragadam Linux - Newbie 23 10-01-2003 09:24 AM
Create swap partition? mikeshn Linux - General 6 11-28-2002 02:42 AM

All times are GMT -5. The time now is 12:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration