Creating a swap file or swap partition on the SSD/HDD [closed]
I have Linux Mint 13 LTS which is based on Ubuntu 12.04 LTS.
I installed it on my SSD and will use the HDD for data storage only. When installing the OS I skipped making a swap file/partition. The machine has 8GB RAM and I wasn't sure whether I need a swap file at all. But after some reading I understood that the swap file is used in some cases even if there is free RAM still. So, it seems that I will need it.
- Should I create it like a file or like a partition?
- Should it be on the SSD or on the HDD?
- If I create it on the HDD, could it be a bottleneck for the system because of the lower read/write speeds compared to the SSD where the OS is installed?
- What is the optimal size for a laptop with 8GB RAM?
Solution 1:
Yes, its recommended to create a swap partition.
You could make it on the HDD as it will be used very rarely.
Size- 4GB is recommended.
The Swap partition can be useful also when you are booting from a live DVD, which will automatically detect your Swap partition.
To create the swap partition-
Launch Gparted partition editor. From devices, choose your hard disk.
shrink an existing partition by 4gb.
In the space thats created right click, new,(options) size- 4096 mb, type- linux swap, label- Swap
Then click on accept.
After this Swap partion is created you can right click on it and select SwapOn. This will activate the swap partition.
To automatically activate (mount) the swap partition at startup, you will have to follow the following steps-
In a terminal, type
sudo blkid
This would list all your partitions and their UUIDs. From here you need to copy the UUID of your newly created swap partition.
Then in the terminal type-
sudo gedit /etc/fstab
Inside this file there will be a list of partitions. Now you need to make entry for your swap partition.
Like this-
UUID=a73fa26b-e12b-41d5-925f-58851419359a swap swap sw 0 0
In the same way create the entry as I have created, but remeber to replace my Swap partition UUID with the one that you got using the sudo blkid command.
Here is a link about Swap partiton from the Ubuntu Web Wiki
SwapFAQ
If you are having any problems please let me know.