How to increase swap partition?

NBPTL

Member
Jun 20, 2008
28
0
0
New to linux but gained some knowlege from installing to running virtualbox.
But now I am wondering that I will be putting 2 more gigs of ram in my box for total of 4gig, should/how to inscrease swap partition to 8gig?
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
It really depends on how you have it setup, whether you used LVM, software RAID, etc. But it's the same way you resize any other partition, simplest is probably to just boot from a gparted LiveCD and go from there.
 

Cogman

Lifer
Sep 19, 2000
10,283
134
106
Doesn't linux use the swap for hibernation storage? I have 2 gb but almost never touch the swap. If you don't really touch it either then I don't really see much benefit (though, I could be really wrong with this one, but I have had swap sizes that don't match my ram size with pretty much no problems)
 

Christobevii3

Senior member
Aug 29, 2004
995
0
76
With 1.5GB of ram on ubuntu 64, i never touched the swap with windows xp and vista running in vmware server at the same time.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
If I'm not compiling huge software (like I did with gentoo) I almost never hit the swap. In fact unless I'm using a notebook I use a swap file and not a swap partition (as far as I know you can not hybernate to swap if it's a file). If your not hitting max memory and swap usage, there is no reason to increase it.

However, you can have more then 1 swap partition or file. You can even have a swap partition and a swap file. The easiest way would be to make a swap file and add it as additional swap.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
You can hibernate to an arbitrary file or swap file if you want with the TuxOnIce patches, but the in-kernel version and uswsusp can only do swap partitions right now AFIAK.
 
Apr 16, 2008
135
0
0
I wouldn't make the swap file any larger than 1.5gb if you really want to have a large swap file. All of my boxes have 800mb or less for swap and it's rarely used except when installing a lot of updates.
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
If you do decide to increase the size of the swap, you'll have to make some room on your disk with a disk repartitioning tool. fdisk will do the job -- but it'll corrupt data on whatever partition you shrink. I hope you have a partition you can trash...
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
fdisk will do the job -- but it'll corrupt data on whatever partition you shrink. I hope you have a partition you can trash...

That's why you first shrink the filesystem yourself or use something like gparted to do that for you...
 

crontab

Member
Dec 20, 2000
160
0
0
i would monitor swap usage before adding swap. if you don't have any apps requiring more swap or aren't swapping in/out like mad or at all. There's no need. I'd just use top, free, or vmstat to monitor this.

If you must add and don't feel like messing with your partitions, just create a swap file with mkswap. Instructions are in the man page on how to dd a zero file and making a swap file out of it. use swapon to add it on the fly, swapoff to remove it. enter /etc/fstab entries to make it perm.
 

cker

Member
Dec 19, 2005
175
0
0
You can use just a swap file instead of a dedicated partition. I've done that on a couple of systems and it works fine in my testing. Basically you create a swap file, and use it as a loopback swap filesystem. A good process for this is at:

http://www.cyberciti.biz/faq/l...add-a-swap-file-howto/

This will keep you from having to hassle with partition changes. If you like what you experience, then maybe you could move on to the repartition later.
 

citsacras

Junior Member
Mar 21, 2003
22
0
0
how to inscrease swap partition to 8gig?

Do you have unpartitioned space on a hard disk?

you can do all this without a reboot:

fdisk /dev/sda
- or whatever the device path is for your hard disk
- create a new partition of 8 GB, or however much you want to use
mkswap -L "newswap" /dev/sda1
- or whichever partition you use for swap
swapon LABEL=newswap
vi /etc/fstab
- update fstab to mount the new swap partition by label, so that it will be there on next reboot

If you are using LVM or don't have any unpartitioned space things will be a little different. You can use LVM tools to resize partitons, or as others noted, something like gparted. Hope this helps.




 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |