LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-28-2006, 01:37 AM   #1
Balakrishna
LQ Newbie
 
Registered: Dec 2005
Location: Hyderabad
Posts: 17

Rep: Reputation: 0
Arrow why swap partition usage is always empty?


i have a Fedora 4 with physical memory of 512MB ram so i created a swap partition of 512 MB. But what ever the load that i am putting on my system, the usage of swap partition is nill. why it is? how can i use it.


Thanks..

Balakrishna
 
Old 11-28-2006, 02:12 AM   #2
bobdevis
Member
 
Registered: Nov 2006
Distribution: Ubuntu 64bit
Posts: 49

Rep: Reputation: 15
Did you actually mount it?
Show us the contents of your /etc/fstab file.
 
Old 11-28-2006, 02:12 AM   #3
eerok
Member
 
Registered: Nov 2005
Location: Canada
Distribution: Mint, Debian
Posts: 168

Rep: Reputation: 32
Lol, be happy. Using swap slows you down, so not using it is a good thing.
 
Old 11-28-2006, 09:11 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Swap is only used when the physical memory gets used up. Try opening some large image files in Gimp, and watch how memory fills up.
 
Old 12-16-2006, 11:48 PM   #5
Balakrishna
LQ Newbie
 
Registered: Dec 2005
Location: Hyderabad
Posts: 17

Original Poster
Rep: Reputation: 0
my swap partition mounted

hi,

i have found an entry for my swap partition in /etc/fstab file. still itś usage is nil.

First i want to know why it is not used.
Secondly if itś use may arise only rarely, then is there any way to reformat it and connect it under /opt or /tmp to my file system.

Thank you
 
Old 12-17-2006, 03:29 AM   #6
jonwatson
Member
 
Registered: Jun 2004
Location: Nova Scotia, Canada!
Distribution: Ubuntu
Posts: 170

Rep: Reputation: 30
Have you recently come from a Windows environment, by chance? I ask because when I first came to Linux from Windows I had the same question. The short answer is that Linux manages its memory better than Windows and only swaps when it actually has to. By contrast, Windows seems to start swapping as soon as it boots whether it needs to or not.

As eerok states, just be happy that you're not swapping. With Linux you won't see a lot of swapping going on unless you're legitimately using more memory than you physically have. When I see a lot of Linux swap being used on a continual basis on a box I know that its time to upgrade the RAM on that box.

If your system is running fine and you're not swapping then you have a well configured and provisioned box. Only worry when you see a lot of swap being used all of the time.

This is a good thing

http://static.flickr.com/142/324671589_2979799a2b_d.jpg
 
Old 12-17-2006, 07:16 AM   #7
Balakrishna
LQ Newbie
 
Registered: Dec 2005
Location: Hyderabad
Posts: 17

Original Poster
Rep: Reputation: 0
Hai heatsink,

Half of the problem is solved with this. But i have one more to go.

Now is there any way to disconnect that swap partition from my file system and again adding it under /opt or /tmp.

Bye..
 
Old 12-17-2006, 12:09 PM   #8
jonwatson
Member
 
Registered: Jun 2004
Location: Nova Scotia, Canada!
Distribution: Ubuntu
Posts: 170

Rep: Reputation: 30
I'm not really sure. Swap is its own partition so I suppose that you could technically mount it anywhere.

Create a directory wherever you want it under /opt or /tmp such as /opt/swap. Then (as root)
Code:
mount /dev/[swap paritition] /opt/swap
See what happens.

It might blow up on you. I'm really not sure if Linux assumes the swap partition will be at /swap or if it consults the mtab file. It'd be interesting to see.
 
Old 12-17-2006, 12:43 PM   #9
snowtigger
Member
 
Registered: Mar 2005
Location: england
Distribution: slackware, win2k
Posts: 364

Rep: Reputation: 35
You can reassign the partion to something else. But one thing to consider is if you do ever exceed your RAM it will make your system crash.

So to reassign it,

1) In fstab comment out the line for the swap partion by putting a # at the begining.

2) then either reboot or run swapoff.

3) Now lets put /tmp there. You should change to runlevel 1, this will stop most services on your system and leave you with a minimal system. It will also stop X, so you will be doing everything else from the command line.

4) On an ideal system /tmp should get cleared out on shutdown. But if for some reason you have something that you want to keep now is the time to put it else where. If there is anything left you should delete it otherwise you will just be wasting space.

5) Now in fstab we need to create the line to mount the partion. which will be,
Code:
/dev/hdaX /tmp FS defaults 1 2
replace X with your partion number and FS with the filesysem type.

6) Next it needs a filesysem. You can use which ever you prefer but for this example we will do it in ext2. So run mkfs.ext2 /dev/hdaX (replace X with the partion number, and in fstab the FS will be ext2). And this will create the filesystem.

7) Now all that is left is to mount it with mount /tmp

 
Old 12-17-2006, 12:48 PM   #10
jonwatson
Member
 
Registered: Jun 2004
Location: Nova Scotia, Canada!
Distribution: Ubuntu
Posts: 170

Rep: Reputation: 30
That was a way better explanation than mine
 
Old 12-18-2006, 01:31 AM   #11
Balakrishna
LQ Newbie
 
Registered: Dec 2005
Location: Hyderabad
Posts: 17

Original Poster
Rep: Reputation: 0
Smile

Hi snowtigger,

I am unable find on which partion (i mean the number of hda) swap is created. For this i am sending you my fstab file.


==========================================================
# THis file is edited by fstab-sync - see 'man fstab-sync' for details

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
/dev/devpts /dev/pts devpts gid=5,mode=620 0 0
/dev/shm /dev/shm tmpfs defaults 0 0
LABEL=/home /home ext3 defaults 1 2
/dev/proc /proc proc defaults 0 0
/dev/sys /sys sysfs defaults 0 0
LABEL=SWAP-sda5 swap swap defaults 0 0

/dev/fd0 /media/floppy auto pamconsole,exec,noauto,managed 0

/dev/hda /media/cdrecorder auto pamconsole,exec,noauto,,managed 0

=======================================================

And is there any way to upload files rather than typing like this in this forum.

Thank you...
 
Old 12-18-2006, 04:07 AM   #12
snowtigger
Member
 
Registered: Mar 2005
Location: england
Distribution: slackware, win2k
Posts: 364

Rep: Reputation: 35
Looking at your fstab your harddrive is a scsi or sata drive. So it will be sda

This is the line that you want
Code:
LABEL=SWAP-sda5 swap swap defaults 0 0
Comment out that line

Then add one of these
Code:
LABEL=SWAP-sda5 /tmp ext2 defaults 1 2
Or if you want to change the label first with something like cfdisk. You could do this
Code:
LABEL=/tmp /tmp ext2 defaults 1 2
Or if you don't want to use labels you could address it directly with this
Code:
/dev/sda5 /tmp ext2 defaults 1 2
 
Old 12-25-2006, 11:09 PM   #13
Balakrishna
LQ Newbie
 
Registered: Dec 2005
Location: Hyderabad
Posts: 17

Original Poster
Rep: Reputation: 0
thank you very much for every one who helped me in solving this.
 
  


Reply

Tags
partition, swap


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I convert an empty ext3 partition to a jfs partition? lothario Linux - Software 3 02-28-2006 10:40 AM
swap usage pingvina Linux - Software 4 02-24-2006 12:52 PM
very strange swap partition label and empty text console whencat Fedora 4 08-07-2005 09:16 AM
Swap Usage ComputerErik Slackware 3 05-06-2005 02:33 PM
strange partition table - boot partition empty etanter Linux - General 0 12-23-2003 09:46 AM


All times are GMT -5. The time now is 02:22 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration