LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-26-2003, 01:24 AM   #1
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Rep: Reputation: 15
Assigning swap to a partition.


How do you do it after everything is set up except the swap partition?
Here is fstab:
# /etc/fstab: filesystem table.
#
# filesystem mountpoint type options dump pass
/dev/hda5 / ext3 defaults,errors=remount-ro 0 1
proc /proc proc defaults 0 0
/dev/fd0 /floppy vfat defaults,user,auto,showexec,umask=022 0 0
/dev/cdrom /cdrom iso9660 defaults,ro,user,noexec,nooauto 0 0
#partitions found by knoppix
/dev/sda5 /mnt/sda5 ext3 noauto,users,exec 0 0
/dev/sda6 /mnt/sda6 ext3 noauto,users,exec 0 0
/dev/hda1 /mnt/hda1 vfat noauto,users,exec,umask=000,uid=knoppix,gid=knoppix 0
/dev/hda5 /mnt/hda5 vfat noauto,users,exec,umask=000,uid=knoppix,gid=knoppix 0
/dev/hda6 ext3 noauto,users,exec 0 0
/dev/hda7 ext3 noauto,users,exec 0 0
/dev/hda8 ext3 noauto,users,exec 0 0

I hope to put the swap partition on sda6.
How should I rewrite it so I can access and write to everything?

Last edited by bmike1; 07-26-2003 at 01:44 AM.
 
Old 07-26-2003, 03:08 AM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
ok, so right now sda6 is an ext3 partition, and you want to convert it to swap and set it up so swap is all good and working, right?

umount /dev/sda6
mkswap /dev/sda6
swapon
/dev/sda6 swap swap defaults 0 0

More or less, that's it. As root of course

Some documentation on it should you desire more :
http://www.gentoo.org/doc/en/gentoo-....xml#doc_chap6

Also, I'd suggest fdisking the partition ID to Linux Swap, I am not sure if that is required or not, but that's what I do to keep things all happy and shiny.

Cool
 
Old 07-26-2003, 08:27 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
How big is sda6? A swap partitions max size is 2gb. How much RAM do you have? 512mb swap is a resonable size if you have 256 or greater and not running memory intensive apps.

You could also go with a swap file instead.

Last edited by michaelk; 07-26-2003 at 08:28 AM.
 
Old 07-26-2003, 01:56 PM   #4
peace
Member
 
Registered: Jul 2003
Location: Canada
Posts: 214

Rep: Reputation: 31
I have a related question.

How do you know if your swap partition is doing what it is supposed to? What I mean is I fdisked a swap partition, set it up, etc. etc. How do I know Linux is recognizing this as my swap and using it?
 
Old 07-26-2003, 02:04 PM   #5
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
Thanks for the help MasterC. here is how it responded:
#umount /dev/sda6
/dev/sda6 is not mounted
#mkswap /dev/sda6
setting up swapspace version 1, size = 105885 kB
#swapon
usage: swapon [-hV]
swapon -a [-e] [-v]
swapon [-v] [-p priority] special ...
swapon [-s]

Also, after you get it working I add it to /etc/fstab; right?
 
Old 07-26-2003, 02:07 PM   #6
sannik
LQ Newbie
 
Registered: Jul 2003
Posts: 5

Rep: Reputation: 0
peace: free
 
Old 07-26-2003, 02:17 PM   #7
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
MichaeK,
I can't rightly remember how much memory is in it. I had mandrake 9.0 set the partitions up (including the swap) and then put knoppix (which is debian) onto the harddrive. I let the mandrake installer determine the size of the swap partition. It is a strange thing; I set the swap partition up and then sda5 to immediately follow that. Apparently knoppix didn't like my swap partition and assigned sda6 to it.
 
Old 07-26-2003, 02:43 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
You need to specify the partition with swapon

swapon /dev/sda6
If you look at the output of free it should now show your swap space.

As MasterC posted add that line to you /etc/fstab to have your swap activated on boot up.
 
Old 07-26-2003, 03:30 PM   #9
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
Well, I didn't get an error after hitting enter so I suppose that means that it worked.
I then added 'swapon /dev/etc/sda6' to /etc/fstab.
 
Old 07-26-2003, 03:55 PM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
This is what you need to add to the /etc/fstab file

/dev/sda6 swap swap defaults 0 0

Look at the output of free you should see the total swap memory equal to the size of the partition.
 
Old 07-26-2003, 04:52 PM   #11
peace
Member
 
Registered: Jul 2003
Location: Canada
Posts: 214

Rep: Reputation: 31
Thanks michaelk and sannik, that shows me my swap space!

Help always appreciated.
 
Old 07-26-2003, 05:52 PM   #12
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
here is my new fstab (the last two lines are new)
~~~
# /etc/fstab: filesystem table.
#
# filesystem mountpoint type options dump pass
/dev/hda5 / ext3 defaults,errors=remount-ro 0 1
proc /proc proc defaults 0 0
/dev/fd0 /floppy vfat defaults,user,auto,showexec,umask=022 0 0
/dev/cdrom /cdrom iso9660 defaults,ro,user,noexec,nooauto 0 0
#partitions found by knoppix
/dev/sda5 /mnt/sda5 ext3 noauto,users,exec 0 0
/dev/sda6 /mnt/sda6 ext3 noauto,users,exec 0 0
/dev/hda1 /mnt/hda1 vfat noauto,users,exec,umask=000,uid=knoppix,gid=knoppix 0
/dev/hda5 /mnt/hda5 vfat noauto,users,exec,umask=000,uid=knoppix,gid=knoppix 0
/dev/hda6 ext3 noauto,users,exec 0 0
/dev/hda7 ext3 noauto,users,exec 0 0
/dev/hda8 ext3 noauto,users,exec 0 0
swapon
/dev/sda6 swap swap defaults 0 0
~~~
Do I need the 'swapon' line?
What do you mean when you say to check free?

Last edited by bmike1; 07-26-2003 at 05:54 PM.
 
Old 07-26-2003, 06:08 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
The swapon line is not necessary.

free is a console command that shows how much free and used memory in the system. It also shows how much swap you have.

You should delete this line since its now your swap and not valid anymore:
/dev/sda6 /mnt/sda6 ext3 noauto,users,exec 0 0


Last edited by michaelk; 07-26-2003 at 06:15 PM.
 
Old 07-26-2003, 06:39 PM   #14
bmike1
Member
 
Registered: Jul 2003
Posts: 133

Original Poster
Rep: Reputation: 15
It tells me I have no swap space.
 
Old 07-26-2003, 06:46 PM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
So its showing zero for total space?

Try the swapon /dev/sda6 command again see what happens
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
assigning a swap partition after installation Cinematography MEPIS 3 07-28-2005 11:09 AM
Do I need a swap partition? patrik1982 Linux - General 8 06-26-2005 07:09 PM
Swap partition not used ? Wynand1 Linux - Newbie 5 06-21-2004 06:22 AM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 08:45 AM
Swap partition Thomas_Delrue Linux - Newbie 3 07-12-2001 08:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:38 AM.

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