LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-30-2008, 05:07 AM   #1
gautamnarayan
LQ Newbie
 
Registered: Sep 2008
Posts: 25

Rep: Reputation: 15
how to increase the size of existing swap partition ?


Dear Sir,

I have a computer of Linux

fdisk -l

/dev/hda1 /
/dev/hda2 /boot
/dev/hda3 swap

and i have to increase the size of the existing swap partition

i have redhat and suse linux both.

please teach me how to increase the existing swap partition for both redhat and suse computers in my office .

hanks a lot.
 
Old 10-30-2008, 05:14 AM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
Quote:
Originally Posted by gautamnarayan View Post
Dear Sir,

I have a computer of Linux

fdisk -l

/dev/hda1 /
/dev/hda2 /boot
/dev/hda3 swap

and i have to increase the size of the existing swap partition

i have redhat and suse linux both.

please teach me how to increase the existing swap partition for both redhat and suse computers in my office .

hanks a lot.
That are two ways that you can do that (off the top of my head). The first way is to simply resize the partition, which could be easily done with a live CD (eg: Ubuntu) and gparted. The other way could be done by using a file as a swap file. Take a look here:

http://www.linux.com/feature/113956

Regards!
 
Old 10-30-2008, 05:32 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
You can also create another swap partition in available free space on the disk. Unless the reason you need to increase the swap partition is so that the resume partition (a swap partition) be at least as large as the ram, so that suspending the computer works.
 
Old 10-30-2008, 05:50 AM   #4
allez
Member
 
Registered: Jul 2008
Location: Russia/Siberia/Krasnoyarsk
Distribution: SuSE, CentOS, FreeBSD
Posts: 77

Rep: Reputation: 21
One also may create a swap file:
Code:
dd if=/dev/zero of=/.swapfile bs=1M count=1024
mkswap -v1 /.swapfile
swapon /.swapfile
This example creates in root directory file named ".swapfile" with size equal to 1 GB and then appends it to existing swap space.

Last edited by allez; 10-30-2008 at 05:51 AM.
 
1 members found this post helpful.
Old 12-10-2010, 11:05 AM   #5
beadrifle
LQ Newbie
 
Registered: Aug 2010
Posts: 2

Rep: Reputation: 0
Works like a charm; thank you.
 
Old 12-10-2010, 11:24 AM   #6
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,092
Blog Entries: 3

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
Quote:
That are two ways that you can do that (off the top of my head). The first way is to simply resize the partition, which could be easily done with a live CD (eg: Ubuntu) and gparted. The other way could be done by using a file as a swap file. Take a look here:
with live cds you have to be careful because when using a livcd on a linux system it will try to use the available swap partition then mount it.
you will be unable to unmounted a swap partition. You must use the option to run in ram only mode. like puppy linux boot command puppy pfix=ram
or any of the F1,2,3 options on the live cd.
 
  


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
increase swap size ssilayaraja Linux - Newbie 5 08-18-2008 09:23 PM
HOw increase the swap disk size? hinetvenkat Linux - Server 1 07-25-2007 08:55 PM
Is there an easy way to increase SWAP size? Mow Slackware 5 07-25-2007 06:32 PM
changing the size of an existing swap partition toolmania1 Linux - Newbie 5 06-16-2005 07:20 PM
ubuntu - increase swap size dna9 Linux - Distributions 11 01-24-2005 11:45 AM


All times are GMT -5. The time now is 02:11 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