LinuxQuestions.org
Help answer threads with 0 replies.
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 08-19-2010, 06:33 AM   #1
siva balan
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Rep: Reputation: 0
create swap partition


total used free shared buffers cached
Mem: 3895 3203 691 0 4 2163
-/+ buffers/cache: 1035 2859
Swap: 0 0 0


this is the output of "free -m" command in my fedora 13 linux system..

as per the output, there is no swap partition in my system..
i am lack of analysing the output above. please describe me about buffers,cached fields and "-/+buffers/cache" row.

and do i need to create swap partition or not?if yes, how?

nandri(for thanks in my mother tongue(tamil))

Last edited by siva balan; 08-19-2010 at 06:39 AM.
 
Old 08-19-2010, 07:03 AM   #2
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
please describe me about buffers,cached fields and "-/+buffers/cache" row.
The buffers/cache line shows you how much memory is used by programs , and is free for programs to use.

Quote:
and do i need to create swap partition or not?if yes, how?
for better performance you need to create swap.

adding swap partition or swap file

HTH
 
Old 08-19-2010, 07:07 AM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
please describe me about buffers,cached fields and "-/+buffers/cache" row.
Buffers and cache represent information that is stored on disk that was needed in ram at some point and isn't needed in ram right now. As long as there is no other need for that ram, the redundant (with disk contents) data is kept in ram in case it might be needed again.

The -/+buffers/cache row shows what used and free memory would be if buffers and cache were counted as free rather than used. Usually that is the more meaningful way of counting used and free memory, because the memory used by buffers and cache will be treated as free if any application needs memory.

Quote:
do i need to create swap partition or not?
If this level of memory use is typical for your system then you don't need to create a swap partition.

I think it is better to have a swap partition anyway.

Your system might have some stale anonymous memory use and could be a tiny bit faster if that memory were swapped and a little more memory were available for caching. But you already have a lot of caching so such improvement if any would be tiny.

A swap partition is also a useful safety valve if you run some tasks that are much bigger than your typical use, or if some task has a memory leak. In case of a memory leak, swap space may make the system degrade smoothly rather than fail abruptly. That may give you time to diagnose and correct the problem without crashing the whole system.

We may be able to give you a better idea about creating swap space if we knew more about your current disk usage. Post your partitioning and free space, output from the following commands done as root
Code:
/sbin/fdisk -l
df
You should use CODE tags when posting the output of commands (including the output of free that you posted at the top of this thread). That makes it easier for us to read such output.

Last edited by johnsfine; 08-19-2010 at 07:13 AM.
 
Old 08-19-2010, 10:35 PM   #4
siva balan
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Original Poster
Rep: Reputation: 0
Code:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c4424

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          39      307200   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              39       27453   220200960   83  Linux
/dev/sda3           27453       47034   157286400   83  Linux
/dev/sda4           47035       60801   110583427+   5  Extended
/dev/sda5           47035       53562    52428800   83  Linux
/dev/sda6           53823       60801    56056831+  83  Linux
/dev/sda7           53563       53822     2088418+  83  Linux

Partition table entries are not in disk order

this is the output of the command "fidisk -l".actually.i had wrongly created swap partition in the installation by giving "/swap with ext3 partition".i have deleted that 2gb partition.and that 2gb is in my system as unallocated space..how to make it as swap partition.i had used "gparted"..but get error..

Last edited by siva balan; 08-19-2010 at 11:09 PM.
 
Old 08-20-2010, 06:32 AM   #5
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by siva balan View Post
i had wrongly created swap partition in the installation by giving "/swap with ext3 partition".i have deleted that 2gb partition.and that 2gb is in my system as unallocated space.
Do you mean you did that after the fdisk -l that you posted?

I assume the 2GB you mean is sda7. In the fdisk -l output you posted, sda7 has not been deleted and there is no unallocated space on that drive.

One of the the reasons I asked for output from df is to find out which partitions are mounted where in your directory tree. Output from mount would also tell that (since now I understand you don't need to resize any partition, so we don't need to know about free space inside partitions).

So you want to make sure sda7 isn't mounted nor in etc/fstab to be remounted. Then you want to know how to delete it, recreate and format it as a swap partition and enable use of that swap partition.

Last edited by johnsfine; 08-20-2010 at 07:39 AM.
 
Old 08-20-2010, 07:36 AM   #6
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
If you rarely ever need swap, you may as well leave your partitions as they are and create a swap file instead. They used to be slower than swap partitions but that has not been the case for several years now (if the kernel developers are to believed - and I don't see why not).
 
Old 08-20-2010, 07:50 AM   #7
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by jay73 View Post
you may as well leave your partitions as they are and create a swap file instead.
That might make more sense if resizing the partitions that are in use would be required to create a swap partition. But apparently sda7 was meant to be the swap partition and was just set up wrong.

On my own systems, I don't use suspend to disk, so it is usually convenient that multiple different liveCDs and installed copies of Linux all use the same swap partition. That would be a lot messier with a swap file.

When switching versions or distributions of Linux, I usually want to shrink the existing installed Linux and create a new partition for the new one, then install, test and copy things to the new one all before trashing the old one. Keeping the swap space outside of the file system means it is one less thing taking time, extra space and complexity during such a transition. Contrast that to Windows where you often need to turn off paging and delete the pagefile before changing the partition size, then turn paging back on afterwards.
 
  


Reply


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 create a swap partition? banso_boy Linux - Laptop and Netbook 4 02-17-2008 08:59 AM
Create swap partition after install BobNutfield Fedora 6 02-22-2006 02:24 AM
Need to create a swap partition dotancohen Linux - General 4 07-30-2005 12:39 PM
Can't create swap partition tiger99 Linux - Newbie 23 03-15-2004 09:34 PM
Create swap partition? mikeshn Linux - General 6 11-28-2002 02:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:43 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
Open Source Consulting | Domain Registration