0

Where to create my swap partition on the HDD or on the SSD?

Hello my people, I hope you are very well, I really like this linux distribution, I tell you my case, I have 2 storage units, I have a HDD and a SSD, my question is how I can use the 2 in the best way?, I currently have the partition / root, Boot on the SSD and the swap partition and home on the HDD, the system starts fast, but when I have several tabs open, freezes and gives errror in the file system, I think it is for having the swap on the hard disk, which is not in its best condition and I was also asking in a facebook community and there was a command that I would like to understand, I attach a picture of the command and what it throws, as I understood the higher the number it gives, the more swap is used in a range of 0 to 100, and to me it gives me as a result 60, which I understand that it uses quite a lot the swap.

enter image description here

1 Answer 1

0

It's generally a good idea to have your swap partition on your slower storage device, which in your case, is the HDD. This is because the swap partition is used as virtual memory and only accessed when your system runs low on physical memory (RAM). Since the HDD is slower than the SSD, using the swap partition on the HDD will not significantly impact system performance but will help extend your SSD's life.

Remember that the swap partition is not a replacement for physical RAM, and it's generally best to have enough RAM to handle the workload you place on your system. If you consistently see a high percentage of swap usage, it may be worth considering upgrading your physical RAM to help improve performance.

The /proc/sys/vm/swappiness file is a system parameter in the Linux kernel that controls the relative balance between swapping out runtime memory to disk and reclaiming memory from inactive pages. It is a value between 0 and 100 that determines the likelihood that the kernel will swap out pages of memory to disk. A higher value means that the kernel is more likely to swap pages, while a lower value means that the kernel is less likely to swap pages. The default value is usually 60 in Linux.

This file is not a regular file, but rather a virtual file that is provided by the kernel and exists only in the virtual file system (/proc). It can be read and modified like any other file, but the changes only take effect in the current running kernel and are not persisted across reboots.

You can use the sysctl command to view or modify the value of the vm.swappiness parameter, for example:

# View the current value
cat /proc/sys/vm/swappiness

# Set the value to 10
sysctl vm.swappiness=10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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