Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to increase swap space on my existing Ubuntu machine. At present it is merely 10 % of RAM available.

I would like to make it as 50 % more than RAM.

How can I do it on a machine which is already configured ?

share|improve this question

migrated from stackoverflow.com Jan 21 '13 at 9:13

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Use the gparted Live cd (or any other live cd with gparted) and carve out the extra space and resize the swap partition to whatever size you want.

share|improve this answer
    
Just wanted to say exactly the same thing. BTW this is IMHO rather a question for superuser or one of the other sites. –  Axel Jan 21 '13 at 9:02
    
@Axel ubuntu would be my pick but I think it is going to be migrated to superuser. –  Karthik T Jan 21 '13 at 9:04

Make an empty file of the desired size,

dd if=/dev/zero of=swapfile count=1M bs=1k   # 1GB

(make sure this is owned by root and has permissions 0600), then

mkswap swapfile
swapon swapfile

You need superuser rights for swapon. To make the swapfile persist across reboots, put it in /etc/fstab.

share|improve this answer
1  
You also need to call mkswap on the file. –  lindelof Jul 5 at 8:02
    
If a swap already exists will this change the existing swap to be increased to 1G? –  unc0nnected Nov 12 at 21:07
    
@RyanWiancko It gets increased by 1GB. You can have multiple swapfiles; I'm not sure what the Linux strategy for choosing between them is. –  larsmans Nov 13 at 9:59
    
@larsmans - ah, I see, that is really cool that it can do that. thanks –  unc0nnected Nov 14 at 21:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.