Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Jan 21 '13 at 9:13

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

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
You also need to call mkswap on the file. – lindelof Jul 5 '14 at 8:02
If a swap already exists will this change the existing swap to be increased to 1G? – unc0nnected Nov 12 '14 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. – Fred Foo Nov 13 '14 at 9:59
@larsmans - ah, I see, that is really cool that it can do that. thanks – unc0nnected Nov 14 '14 at 21:37

Your Answer


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.