Site Tools


usb_formatting_with_swap_partition

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
usb_formatting_with_swap_partition [2023/07/14 18:28] – [USB formatting with swap partition] -fix broken USP Support link hogwildusb_formatting_with_swap_partition [2024/03/27 15:32] (current) – [Deactivating the Swap Partition (Pre-unmount command)] -condense hogwild
Line 3: Line 3:
 A swap partition can prevent several types of insufficient RAM symptoms, such as system instability, failing processes, and in severe cases, even reboots. All this depends largely on the network load and on FreshTomato's configuration. Some functions require much more RAM than others, and higher network traffic puts more load on the router and requires more RAM. USB storage is an excellent way to provide swap space. A swap partition can prevent several types of insufficient RAM symptoms, such as system instability, failing processes, and in severe cases, even reboots. All this depends largely on the network load and on FreshTomato's configuration. Some functions require much more RAM than others, and higher network traffic puts more load on the router and requires more RAM. USB storage is an excellent way to provide swap space.
  
-This example assumes you are using an ARM or MIPS build with USB support. It also assumes you already have USB support enabled. If you're not sure how to enable USB support, check the [[nas-usb|USB Support]] page.+This example assumes you are using an ARM or MIPS build with USB support, and USB support is already enabled. If you're not sure how to enable USB support, check the [[nas-usb|USB Support]] page.
  
 For this example, we use a 16GB USB flash drive seen in the system as device **sda**. For this example, we use a 16GB USB flash drive seen in the system as device **sda**.
- 
  
 ===== Automatic method ===== ===== Automatic method =====
Line 36: Line 35:
  
  \\  \\
- 
  
 ===== Manual method ===== ===== Manual method =====
  
-From the Web interface, disable the Automount checkbox in the [[usb_support|USB Support]] menu.+From the Web interface, disable the Automount checkbox in the [[nas-usb|USB Support]] menu.
  
  \\  \\
  
 [[https://wiki.freshtomato.org/lib/exe/detail.php?id=usb_formatting_with_swap_partition&media=a8e2b7301ceba934bba6b9ca1b53e79d.png|{{:a8e2b7301ceba934bba6b9ca1b53e79d.png}}]] [[https://wiki.freshtomato.org/lib/exe/detail.php?id=usb_formatting_with_swap_partition&media=a8e2b7301ceba934bba6b9ca1b53e79d.png|{{:a8e2b7301ceba934bba6b9ca1b53e79d.png}}]]
-  + 
- \\ \\ Then, logon via SSH or Telnet and delete any existing partitions: \\ + \\ \\ Then, logon via SSH or Telnet and delete any existing partitions: \\   \\ 
- \\+
 <code -> <code ->
 fdisk /dev/sda fdisk /dev/sda
Line 96: Line 94:
 </code> </code>
  
- \\   \\  Now, mount the partitions: \\ \\+ \\  Next, mount the partitions: \\ \\
  
 <code -> <code ->
Line 105: Line 103:
  \\  \\  \\  \\
  
-You can now re-enable USB Automount on the [[usb_support|USB Support]] menu.+You can now re-enable USB Automount on the [[nas-usb|USB Support]] menu.
  
  \\  \\
 +
 +
 +===== Configuring Post-mount and Pre-unmount Commands =====
 +
 +For best practice, the swap partition should be activated as swap once the USB drive/flash is mounted. Additionally, it's best to deactivate swap partitions before unmounting them. It is quite simple to configure both the post-mount and pre-unmount commands. The methods for both are as follows:
 +
  
  \\  \\
 +
 +==== Activating Swap Partition (Post Mount Command) ====
 +
 +To activate the swap partition you created on the drive, enter the following into the "**Run after mounting**" form field:
 +
 + \\
 +
 +<code ->
 +swapon /dev/sda2
 +</code>
 +
 + \\
 +
 +The field should look like this:
 +
 +{{:pasted:20240327-054257.png?nolink&nocache}}((
 +You may have additional commands within the field.
 +))
 +
 + \\
 +
 +
 +==== Deactivating the Swap Partition (Pre-unmount command) ====
 +
 +To configure the router to automatically deactivate the swap partition (in this case, **///dev/sda2//**) , the "**Run before unmounting**" field needs to be populated with the following:
 +
 + \\
 +
 +<code ->
 +swapoff /dev/sda2 
 +</code>
 +
 + \\
 +
 +The field should appear like this:
 +
 +{{:pasted:20240327-060929.png?nolink}}((
 +Again, your form field may have additional data within it.
 +))
 +
 +In both cases, click the Save button at the bottom before continuing.
  
  
Line 122: Line 167:
 \\ [[https://wiki.freshtomato.org/lib/exe/detail.php?id=usb_formatting_with_swap_partition&media=2741fc91e0778274bec4230fe9e3e686.png|{{:2741fc91e0778274bec4230fe9e3e686.png?813}}]] \\ [[https://wiki.freshtomato.org/lib/exe/detail.php?id=usb_formatting_with_swap_partition&media=2741fc91e0778274bec4230fe9e3e686.png|{{:2741fc91e0778274bec4230fe9e3e686.png?813}}]]
  
- \\   \\ To verify the swap partition works properly, check the [[:overview|Overview]] menu. You should see details related to swap space:+ \\   \\ To verify the swap partition works properly, check the [[status-overview|Overview]] menu. You should see details related to swap space:
  
  \\ [[https://wiki.freshtomato.org/lib/exe/detail.php?id=usb_formatting_with_swap_partition&media=dbae47af7a43e0a02c8637092a2edd2b.png|{{:dbae47af7a43e0a02c8637092a2edd2b.png}}]]  \\ [[https://wiki.freshtomato.org/lib/exe/detail.php?id=usb_formatting_with_swap_partition&media=dbae47af7a43e0a02c8637092a2edd2b.png|{{:dbae47af7a43e0a02c8637092a2edd2b.png}}]]
usb_formatting_with_swap_partition.1689355680.txt.gz · Last modified: 2023/07/14 18:28 by hogwild