Linux SWAP

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
vdevices
DD-WRT Novice


Joined: 01 Nov 2017
Posts: 4
Location: Wisconsin, USA

PostPosted: Wed Feb 07, 2018 18:14    Post subject: Linux SWAP Reply with quote
I would like to add a swap partition. The Linux SWAP article https://www.dd-wrt.com/wiki/index.php/Linux_SWAP on the DD-WRT Wiki states:

Quote:
It is strongly advised that you do not enable swapping on flash-based drives (internal flash, SD/MMC, USB sticks)


I see that this article has not been updated in a while. Does this recommendation still hold true?

My Netgear R7500v2 has 128 MB Flash memory, 256 MB RAM and two USB 3.0 ports. I'm currently using it as a firewall, NAT, AP and DDNS. I'd like to add a small PBX connected to one of the LAN ports (w/possible QoS) and an IKEv2 VPN.

Is the 256 MB RAM enough? If not, can I go ahead and add a swap partition on a USB 3.0 flash drive? How much swap would you recommend for my intended use case?

_________________
Netgear R7500v2 (1.4GHz dual core, 128MB Flash, 256MB RAM, two USB 3.0 ports, one eSATA port)
v3.0-r34320M kongat (Firewall, NAT, AP, DDNS)
Sponsor
vdevices
DD-WRT Novice


Joined: 01 Nov 2017
Posts: 4
Location: Wisconsin, USA

PostPosted: Thu Feb 08, 2018 20:59    Post subject: Re: Linux SWAP Reply with quote
Quote:
Flash memory has a limited number of write cycles before it wears out. It is still going to be recommended that you do not create a swap partition in flash memory for these routers.


Got it. Thanks for the reply.

Quote:
Have you actually tried running everything you would like to run and see if it will run in the memory that you have in your router without swap space?


I have not. Not yet, at least. I only recently purchased a 32 GB USB 3.0 drive, so I am still in the planning phase. I'm new to the Linux and DD-WRT worlds, so I appreciate the help. I downloaded GParted and read the USB Storage article on the DD-WRT Wiki, which has a section that reads:

Quote:
For large HD drives that you "permanently" attach to your router you may want to consider creating three or four partitions:

one: for optware packages - make it 32MB - 2GB - use ext2/3 as the format
two: for swap file - make it 16-256 MB - format it as linux swap file
three: for data space - make it fit the rest of the disk - use ext2/3 or FAT32 as the format
four: for jffs space - make it 32MB - 2GB - use ext2/3 as the format


Then, I came across the following in a Using the integrated webserver tutorial on Kong's blog:

Quote:
1. Preparing USB Storage Device

While it is possible to use the routers flash to host any websites, we are going to use a USB drive in order to store a larger amount of data. Get your usb device ready and partition it with the tool of your choice.

I recommend sat least 2 partitions. First partition should be a swap with ~512MB. For the second partition I recommend a drive with a few gigabytes and filesystem Ext3. When creating the second partition you can label it with the name „Jffs“, thus the integrated automounter will mount it directly to /jffs.


My confusion was further fueled because this blog post seems to suggest that it is okay to use a USB for a swap partition. Given that the USB drive that I bought has 32 GBs, I assumed that I will never fill up all of that storage, so I figured "why not" add a swap partition, if I can.

_________________
Netgear R7500v2 (1.4GHz dual core, 128MB Flash, 256MB RAM, two USB 3.0 ports, one eSATA port)
v3.0-r34320M kongat (Firewall, NAT, AP, DDNS)
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Fri Feb 09, 2018 16:04    Post subject: Reply with quote
Well you can use a swap partition but as @Doug said it wears out quickly and is also slow.

Attached my notes for setup



DDWRT USB storage support Public.doc
 Description:

Download
 Filename:  DDWRT USB storage support Public.doc
 Filesize:  406 KB
 Downloaded:  222 Time(s)


_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum