Keenetic routers can automatically mount and use a special partition on an external drive for a memory swap. This type of partition is called 'Linux Swap'.
This method of RAM expansion is more reliable than using a swap file, as data is placed on an allocated disk partition, not in a file in the partition used by other applications.
As opposed to the method of virtual increase of RAM size (zRAM function), with the help of a swap partition, it is possible to physically increase the RAM size of the system. When using a high-speed drive, devices with a USB v3 port can effectively expand the amount of memory without overloading the processor.
Compared to the zRAM method, which allows using the RAM available more rationally (using data compression algorithms), the swap allows extending it. The router's operating system will place in the swap area the least frequently required data.
NOTE: Important! Do not use zRAM simultaneously with a swap partition or swap file. When using a swap partition or file, deactivate zRAM beforehand in the 'Management' menu of the 'General system settings' page in the 'Performance options' section.
Since a swap partition is a feature of Linux systems, a Windows computer user may not be able to create such a partition with the built-in tools of the operating system. Let's see how to format a USB drive in Windows and create data and Linux Swap partitions.
NOTE: Important! The maximum size of a drive with an automatically mounted swap partition should not exceed 2 GB.
1. As an example, we use the MiniTOOL Partition Wizard Free Edition application for Windows. This setting can be also done with similar programs such as Paragon Partition Manager Free or AOMEI Partition Assistant Standard Edition, or in Linux using the GParted disk partition editor.
In our case, screenshots are taken in version 10.2.3. Starting from version 11, the interface in the application has changed, and if for some reason you are unable to perform the configuration specified in this article, you can use version 10. You can get a copy of the installation program version 10.3 by clicking on the link. After installing version 10.3, you should refuse an offer to upgrade to the latest version.
In the next step, you can cancel the installation of additional software by unchecking the 'I've read...' option and continue:
The installation is completed, and the application will be launched after clicking the 'Finish' button. The MiniTool Software menu will open, and you should select 'MiniTool Partition Wizard Free' in it.
In the opened window of the MiniTool Partition Wizard Free program, a new object will be displayed after connecting a USB drive. In our case, it is an entirely unallocated Disk 3 with the MBR partition table, 14.6 GB in volume.
In the unallocated area of the drive, we are creating two partitions.
The first one will be used for data storage; it is formatted in the NTFS file system. This partition should be the first one because Windows can detect the first partition only (system limitation for flash drives) when connecting to the computer.
The second partition will be for the swap when connected to the router.
1. NTFS partition creation. After focusing on the unallocated area of the drive, select 'Create' from the 'Partition' menu.
In the 'Create New Partition' dialogue, you should leave the unallocated area after the new partition. This area will contain the Linux swap partition. The swap partition size is about 500 MB, which is enough for most tasks.
TIP: Note: The system kernel has a swap area size limitation. Usually, it is not necessary to exceed the size of the RAM area by more than three times. If the partition size is larger than the system limit, a warning will be displayed in the log (e.g., Truncating oversized swap area, only using 2097152k out of 8388604k), and a part of the selected partition will be used as a swap.
2. Let's repeat a new partition creation in the remaining unallocated area. The new partition file system is 'Linux Swap'.
3. To apply changes in the program interface, click the 'Apply' button.
Choose 'Yes' in the 'Apply Changes?' dialogue box. The note in this dialogue indicates that it is recommended to close all other running programs on your computer before executing. This warning refers primarily to software that is using the attached drive. Since we are working with the initially unallocated drive, we mean other partition management programs, regular programs may not be stopped.
The program performs formatting.
And informs you of the operation completion.
4. Now, you can ensure that the drive is detected in a Windows computer when connected to it directly.
Plug the drive into the USB port of the router. The router's system will show that a swap partition has been detected and added to the system memory.
On the 'Applications' page, in the 'USB Devices' section, a disk drive is displayed with the 'SWAP' partition enabled.