Keenetic routers support automatic mounting and the use of a special partition on an external drive for a memory swap. This type of partitions 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 well.
As opposed to the method of virtual increase of RAM size (zRAM function), with the help of a swap partition, it is possible to increase the RAM size of the system physically. 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, that allows using the RAM available in the system more rationally (using data compression algorithms), the swap allows to extend it. The operating system of the router will place in the swap area the least frequently required data.
The zRAM function can be used at the same time as a swap partition or swap file, in which case swap usage will start later than without compressing the memory pages, and the efficiency of the system may increase.
Since a swap partition is a feature of Linux systems, a Windows computer user may not be able to create such a partition on the drive using the computer's operating system. Let's see how we can format a USB drive in Windows by creating a data partition and a Linux Swap partition on it.
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 (also this setting can be done in Linux using the GParted disk partition editor).
In our case, screenshots are taken in the 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 'I've read...' option and continue:
The installation is completed, and the application will be launched by 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 MiniTool Partition Wizard Free program, after connecting a USB drive, a new object will be displayed. 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 size of the swap partition 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 a message 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.