I have, by default, 250MB of swap space in Ubuntu, and I want to expand it to a larger size. I need 800MB, which I think will be enough to open several applications without having to hit the current limit of swap. I hope someone can help me.
You can always create swap file
to add more swap space. This is not same (in every aspect) as swap partition but it will be easy and dynamic.
Use any of terminal applications to run commands. All command should be run with root privileges, to do this you can either add
1. Create empty file:
If you want to make 3Gb file then change count value to
2. Bake swap file:
3. Bring up on boot:
If everything goes well
you should see that more swap space is available for use. You can use following commands to check your new swap and confirm that it is active:
GUI method of increasing the size of swap partition
Another method of increasing the swap size was done through Gparted partition Editor.
It was better to boot gparted-live-disk or ubuntu live disk(So that the all
You must be able to increase the size of swap partition only if there is an unallocated space present below or above the swap partition.If there was no unallocated space(The space which we are trying to add with swap partition) below or above the swap partition,then we have to resize the partitions and get that unallocated space.
Case 1(If the unallocated space present below or above the swap partition)
In the above screenshot,i had a unallocated space of 11.4 GB above the linux-swap and 12.8 GB below the linux swap.
Case 2(If the unallocated space was between the partitions)
In the above screenshot,the unallocated space which we wants to add to the swap partition was between
Case 3(If the unallocated space was present outside the Extended partition)
I had an unallocated space of 18 GB just below to the extended partition.To add this space to the linux-swap partition(which was present inside the extended partition),we have to follow the below steps,
NOTE: Don't forget to take backup of all your important datas before proceeding the above operations.
You can also use
If you already have a
how to add a swap file
note!: bs=1M count=1000 ==> 1GB
(bs * count = size in megabytes )
other example :
sudo dd if=/dev/zero of=/swap.img bs=10M count=100
add this line to your fstab (/etc/fstab)