Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Don't Know How To Install Swap File, Need help installing swap file
samsin1
post Jul 10 2004, 05:41 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 7
Joined: 10-July 04
From: Las Vegas
Member No.: 3,320



I am installing my first version of Debian Linux on a new 80GB slave hard drive and I can't figure out how to make a swap file in the partitioning section. I finally went on without making one. Can I repartition my hard drive with cfdisk and how do I do it? It just wasn't one of the options avaiable when I was partitioning. By the way, this is my first install of Linux, so I am a very green newbie. Thanks in advance.
Go to the top of the page
 
+Quote Post
hughesjr
post Jul 11 2004, 06:37 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



What version of Debian (stable, testing, unstable) ... what version was the installer (3.0r2, etc.)?

Is this for a workstation or server?

If you left any free space on the drive, you can create a swap partition now. Since it is an 80gb drive, I would use 1gb for swap.

Personally, I would use fdisk if it is available on your install.

do:

fdisk /dev/hda

(use a different device than /dev/hda if required ... that is for primary master)

You should be at the fdisk prompt ... now do m to see the options available ...

press p tp print the current partition table...

to create a new partition, press n ...

If you don't have any space to create partitions, you can try and resize the main partition, but I don't recommend it.

If you are able to create a new partition, pick the start and for end use +1G

after that, you need to print the partition table again using the p command, making sure your new partition is there.

Now we need to change the type to swap ... use the command:

t

to change a partition's system id. Enter the partition number of the new partiton you created (maybe either 2 or 3 ... it is on the printout of the partition table) then, Enter 82 for the new type.

When completed, do p again to print the partition table ... if eveything looks good (a new partition, 1 gb, type Linux Swap) we can write this new table to disk

{so far nothing has been changed, so if it is wrong, use q to quit ... and reenter fdisk and try again.}

If everything looks good, use the command w to write the partition table.

fdisk should exit ... then use the command:

fdisk -l

to verify the swap partition is written...

if it is there, you can do the command:

mkswap /dev/hda3

(make sure you use the partition that is labeled as swap ... in my example I use hda3 ... yours may be different)

now you need to edit the /etc/fstab and add a swap entry .... it will look like this (again .. I'll assume /dev/hda3 ... you use the correct partition number):

CODE
/dev/hda3       none            swap    sw              0       0


Now you should be able to issue the command:

swapon and be using the swap ...

use the command:

top

and you should see the swap info ... here is an example from my debian test system:
CODE
top - 06:33:01 up 27 min,  2 users,  load average: 2.04, 1.79, 1.04
Tasks:  74 total,   4 running,  70 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3% us, 99.7% sy,  0.0% ni,  0.0% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:    777296k total,   772492k used,     4804k free,    88880k buffers
Swap:  2104464k total,        0k used,  2104464k free,   551388k cached


If everything looks good ... it should also be there when you reboot.


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
Jim
post Jul 12 2004, 06:16 PM
Post #3


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



So just to jump in here and ask a question, why would you need a gig of swap space? I think I have like 512 and I have never seen my swap meter move from zero. The fact that I have a gig of ram might have something to do with that, but still a gig of swap seems like over kill. Just wondering.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
hughesjr
post Jul 12 2004, 07:03 PM
Post #4


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



On a workstation, without alot of running processes, little (or no) swap is fine. Especially if you have 1-4 gb of RAM...but if you are going to start alot of processes, having lots of SWAP is good. The recommended amount of swap is normally 2x the amount of physical RAM in your machine .... but I would not install more than 1 GB on a normal install.

The real benefit of swap ... especially on a server ... is the ability to put little (or never) used memory ... after a period of time, into swap.

That allows memory to be used more efficiently for things that are necessary.

I have a machine that has 2 processors (2.4Ghz P4 Xeons) and 3gb of RAM as my workstation. It contains a TV Card and I use it to record movies to 240gb of hard drive space. When recording an Hour long show ... it uses almost all the RAM for disc cache ... and swaps other things out. It would be much less efficient without swap.

My 2 processor (1.8ghz P4 Xeon) 1GB Firewall / Mail Server / Web Server almost always has swap in use (right now it's 80 mb).

On my (2) 4 processor (3.06ghz p4 Xeon) Oracle servers with 8gb RAM, I have 2GB swap ... it is normally about 128mb full.

512mb is probably fine, but on an 80gb hard drive ... might as well setup 1gb swap. If I am not hurting for hard drive space ... I normally setup 1gb as swap. There is not a real right answer for this either ... here is a very interesting discussion at KernelTrap.org ... and the real experts are also equally split on this issue (if you need swap and how much swap).


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th October 2017 - 04:35 PM