These are my partitions. I have dual boot with windows 10 and Ubuntu 16.04 LTS. I installed Ubuntu without creating a swap partition. I have only root (/) and /home partitions. I want a swap partition for Ubuntu to run smooth. How do I do it?.
-
I would shrink sda5. / with only 25GB is enough for most users (50- 60 if you install lots of games). – Oct 05 '16 at 09:29
2 Answers
- Boot from Ubuntu LiveCD
- Open GParted
- Resize /(root) partition
- Use freespace after root partition to create swap partition.
detailed: How do I restore a swap partition I accidentally deleted?
As suggested by CelticWarrior, your image shows /dev/sda5 as a good choice for making space to create your swap partition. You didn't mention how much ram you have. But you might consider (if you can spare the disk space) making your swap partition at least as big as your ram size.
You can add the partition using the link provided by Katu Txakurra (How do I add a swap partition after system installation?).
Add it to your /etc/fstab
(details in the link). After you have made the fstab
entry you can activate or check it without booting it with this command:
$ sudo swapon -a
If you get errors you might have to check your /etc/fstab
entry. You can also check to see if it's available with the free
command. If you see zero
available (the first column) for swap then you'll have to recheck your etc/fstab
entry.
$ free
total used free shared buff/cache available
Mem: 7616296 800840 5892464 112036 922992 6401352
Swap: 8191996 776752 7415244
Why use swap
You'll most likely notice a performance increase after you add a swap partition to your system.
It wasn't totally clear in your message about the ubuntu ...running smooth
. While Ubuntu will run smooth without a swap, you're get better performance with a swap. Both Windows and and Ubuntu will buffer into ram lots of data such as pages from a word processor, Internet browser, file browser, etc. This will minimize access time for the OS eliminating time needed to search for and reread.
Having more ram increases performance. On one of my computers I have 32 Gigs of ram. I often see over 20 gigs used as buff/cache
. Most likely daily scans such as updatedb
(the location of all the files on my system) is stored in memory. Finding and loading files are usually almost instantaneous. When the system needs ram it'll use the swap as ram and unload some of the ram cache which it determines as low priority to the swap space, which remains indexed as ram and still have fast access.

- 25,036
-
-
You will definitely see a performance increase if you create at least 6 Gigs of ram. 1 Chrome browser can take up nearly a gig. – L. D. James Oct 06 '16 at 22:22
-