Keenetic routers support automatic mounting and 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 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 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 with the built-in tools of the operating system. Let's see how we can format a USB drive in Windows by creating a data partition and a Linux Swap partition.
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 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 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 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.