What's new

Low-Power SSD for amtm, Diversion, Entware and Tailscale on the USB 2.0 Port (USB 3.0 configured as USB 2.0)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Status
Not open for further replies.
Don't confuse a swap file with a swap partition.

My misunderstanding I think is due to having to pick a size, shouldn't the question just be pick a drive?

Edit: Flash media

I don't know if HDD are used for this this or not, some routers having 1 USB port, others 2.

I'm making the assumption that for script use, it's flash media, not some dual use drive.
 
Some people advise for 5GB or even 10GB swap file and I have no idea why. It's a waste of space. Perhaps @ColinTaylor knows better how it works on Asus routers, but 5x-10x the size of physical RAM swap on a normal Linux system may not work well. It depends on how the system is set to use the swap. Swapping to a dead slow storage before it is actually needed will have negative impact on whatever is running there. Better stick to the recommended 2GB size. I remember Skynet complaining with smaller swap size, but it will never actually use 2GB. Diversion doesn't complain, but also doesn't use much. Some of it may be used only on blocklists update.
 
Last edited:
Maybe. It's an external area the the router can use to supplant overflow. (in my case Diversion & Skynet)
I guess I'll be the one to ask. With respect to swap files, what do you think a swap file is supplanting the overflow of? A better way to ask this is; what do you think a swap file is used for? It helps to understand what a swap file is used for so one can better decide on it's size and if they really need more than 2GB's that is often recommended.

For those who don't know what swap is and why it's used on Linux the following gives a very basic low level explanation (that is targeted at Linux OS installs on PC's but the concept on routers for this discussion is similar).
 
Maybe. It's an external area the the router can use to supplant overflow. (in my case Diversion & Skynet)
My misunderstanding I think is due to having to pick a size, shouldn't the question just be pick a drive?
Virtual memory is the sum of RAM + swap space. Both have to be of a fixed size, otherwise it would appear to the operating system as if memory was suddenly appearing or disappearing. Swap space is therefore pre-allocated. You do this by allocating either an entire raw disk drive, an entire disk partition, or a fixed-size swap file for use as swap.
 
It's a waste of space.

This adds to the confusion as you just said the flash media uses the whole 64GB area for wear leveling. It can pick more, new, healthy, cells from before it fails.

At one time, on this forum, it was recommended to use a drive no smaller than X size. (4GB, 8GB, 16GB, etc..)
What was the purpose of this if the most one needs for these scripts is 2GB, tops. (If it gets used at all, router ram on the increase)
Some here advocate for larger and larger drives, 128GB, 256GB. (Is this just a case of wear leveling?) Even good drives go bad or become defective. Samsung has had bad batches.
I've only had one Flash drive write fail (SanDisk) and they replaced it. I own a lot of flash drives.

Virtual memory is the sum of RAM + swap space. Both have to be of a fixed size, otherwise it would appear to the operating system as if memory was suddenly appearing or disappearing. Swap space is therefore pre-allocated. You do this by allocating either an entire raw disk drive, an entire disk partition, or a fixed-size swap file for use as swap.

Can I somehow designate the whole 64GB and make it persistent as Virtual memory for the swap file (without detriment)?
Why are there more than only the 2GB size even available when you are prompted for setup for Diversion/Entware/Skynet?
One size 2GB fits all for these ASUS Routers, from the information presented.
 
Wow I wake up bleary-eyed to find my post steeped in a swap-file debate 😀.

Can I steer this back on track a wee bit please?
  1. I only bought a small capacity and older SSD because of these being the only ones available whose power supply specs match what I believed to be limited to USB 2.0. @elorimer posed the question above in post #5 (paraphrasing) does the USB 2.0 mode only limit the throughput and not the voltage? This impacts available SSD options, if USB 3.0 voltage is available even in USB 2.0 mode.
  2. In post #12 I queried whether I should be considering whether due to the step down from 5V (2.5W) to 3.3V, an SSD with a higher current draw (758mA) is permissible? Or am I barking up the wrong tree?
  3. @L&LD opines in post #23 that smaller SSDs (including those used as cache drives) are poorer quality. Whether this is a function of smaller SSDs simply being older and less reliable technology I do not know. Are they? TBH I am more than happy to plump for a larger (newer tech) SSD IF the voltage specs are met, used these things are cheap.
  4. As regards voltage @L&LD opines that the voltage specs are not that critical stating that “max power levels are never seen with router workloads”. Does anyone have hard data on this? If you’re going to step out of rated specs (see points 1 and 2), what’s a reasonable amount “above” that specified rating? I am loathe to answer rhetorically “whatever works” as I don’t know if “yeah it works but it’s frying my SSD”.
  5. Finally the swap file debate. I still have no idea if I need one or not, nor size. Really. Whilst a new install might do so, the as-installed Diversion menu does not offer it as a recommendation (I do not have one, although the original Diversion install some time ago did say something about it), nor did the other Apps. Router RAM still only 67%. EDIT, OK I added a 2GB swap file as recommended by the amtm SW menu, which states only “required for Skynet”.
thanks !

k.
 
Last edited:
Finally the swap file debate. I still have no idea if I need one or not, nor size. Really. Diversion menu does not offer it as a recommendation (I do not have one, although the original Diversion install some time ago did say something about it), nor did the other Apps. Router RAM still only 67%.
See the Diversion Installation requirements page:
3) A minimum size of 2 GB is recommended. Diversion uses between 40 to 250 MB of disk space, depending on log file and blocking list size. Entware uses about 20 MB. In addition to that, creating a swap file is recommended with sw. The minimum swap file size is 1 GB
If I remember right when creating a basic swap file using amtm the default recommended size is 2GB.
 
1. I only bought a small capacity and older SSD because

You need 4GB in reality. Plenty for swap and scripts + wear levelling.

2. an SSD with a higher current draw (758mA)

As long as the drive doesn't exceed USB power specs - you're good.

3. smaller SSDs (including those used as cache drives) are poorer quality.

The size doesn't determine the quality. It's the NAND type and the controller.

4. Does anyone have hard data on this?

I have recommended this and many people are using same or similar with no issues.

5. Finally the swap file debate.

Use AMTM to create swap with the recommended 2GB size. Nothing more is needed.
 
I guess I'll be the one to ask. With respect to swap files, what do you think a swap file is supplanting the overflow of? A better way to ask this is; what do you think a swap file is used for? It helps to understand what a swap file is used for so one can better decide on it's size and if they really need more than 2GB's that is often recommended.

For those who don't know what swap is and why it's used on Linux the following gives a very basic low level explanation (that is targeted at Linux OS installs on PC's but the concept on routers for this discussion is similar).

Thanks for that link.

Someone here in the Fourm asked about upgrading the router RAM to 2 GB:

It appears that the upshot is that it is a waste.
It also appears that overly large USB drives or SSD's are a waste as well. But they get pushed all the time.
 
See the Diversion Installation requirements page:
Oops, I missed that. Thank you, it’s been a while since I first installed it. Have made a 2GB Swap. Bit odd that Diversion menu does not point to one, I swear it used to, maybe the amtm menu overrides it.
 
You need 4GB in reality. Plenty for swap and scripts + wear levelling.
Great, thanks, that’s what my USB drive (now a backup) is sized at.
As long as the drive doesn't exceed USB power specs - you're good.
Hmmm… but this is the issue. What is the spec in USB 2.0 mode? 500mA or is USB 3.0 power (900mA) retained.

And does the Voltage step down mean that a higher current is available?
The size doesn't determine the quality. It's the NAND type and the controller.
Yep…
I have recommended this and many people are using same or similar with no issues.
Thank you. I will see if I can find an M.2, mSATA or NVMe equivalent (for size).
Use AMTM to create swap with the recommended 2GB size. Nothing more is needed.
Done it. Thanks,
 
This adds to the confusion as you just said the flash media uses the whole 64GB area for wear leveling.

The USB stick you are using was never designed for frequent read/write cycles. It's a storage media. As an experiment I was running Ubuntu Server installed on a new Sandisk Ultra Flair USB stick and it lasted for about 5 days before failing. Forget about wear levelling - USB stick is a temporary solution.

About 5GB or larger swap file - this "available" memory with high physical (fast) vs swap (very slow) ratio is seen by the system similarly to your dog seeing a bucket of stone pebbles and thinking it's plenty of dog food. When the dog gets hungry though it quickly realizes the mistake - they are not good to eat.
 
Hmmm… but this is the issue. What is the spec in USB 2.0 mode?

USB 2.0 mode is the speed - software limitation in this case. If the port itself is a standard USB 3.0 - it has to provide up to 900mA current. This is what the circuit inside the router can do before triggering the overload protection. The ports do have overload protection. Forget about USB 3.2 and 100W power - not happening on a router.
 
I'll play some more on the SSD question but never again on the swap question. I posit the following.

1. The USB2 spec is 5v, 500ma or 2.5w. It has four pins: 2 power and 2 signaling pins. The USB3 spec is 5v, 900ma or 4.5w, with eight pins: the same 2 power pins and adding 4 more signaling pins. Voltage doesn't come into the spec here (unlike 3.1 and 3.2). We're only talking amps.
2. I do not know what the power draw of the SSDs you posted (and thanks for this!) is when specified at 3.3v when they are fed 5v. If it is just a resistor then the actual draw could be higher.
3. The power specs that are posted for the 3111 are actually average specs, not max specs. I remember having a USB2 HDD that came with a Y cable to draw power from two ports. You needed both plugged in to get it to start, but you could unplug the non-data cable and it would still run, but drop in and out at times. So I am a little skeptical that you can rely on calculations close to the 500ma USB2 limit to be reliable enough for this purpose.
4. I'm not sure what the USB2/3 setting does, but I suspect it might be selecting the driver for the port, perhaps whether it is the xHCI driver or not. I don't know whether the amp spec on the port is just a hardware feature or something that is selected by the driver. It's just the same two power pins, rather than whether the other signaling pins are activated by the driver. But the interference issue is not a power thing; it is a byproduct of the wires in the cable and connectors on both ends being energized by a spread frequency that raises the noise level in the 2.4 to 2.5 ghz spectrum; that impacts the SNR that causes devices to drop out. So it is possible that the setting only affects the signaling without changing the amperage.
5. This interference business is a really big deal for the router mfgs. We've seen aggressive hardware changes to shield the USB3 port, and to move the USB3 port to the other side of the board from the antennas. (We don't see the same issues with stacked USB2/3 ports on computer motherboards.)
 
Last edited:
About 5GB or larger swap file - this "available" memory with high physical (fast) vs swap (very slow) ratio is seen by the system similarly to your dog seeing a bucket of stone pebbles and thinking it's plenty of dog food. When the dog gets hungry though it quickly realizes the mistake - they are not good to eat.

I just love your colorful analogies.

So Fast ram and slow storage is not a good mix.

Tell me the speed difference (colorful) that makes up for the shortfall between a USB drive speed (Type-A 64GB 300MB/s Read 30MB/s Write Compact USB 3.1) and the basic SSD drive speed achieved on a USB interface?
 
This is what the circuit inside the router can do before triggering the overload protection. The ports do have overload protection.
!Brilliant point! This suggests that the power on USB2 and USB3 ports might be a hardware aspect rather than a software aspect.
 
The USB stick you are using was never designed for frequent read/write cycles. It's a storage media. As an experiment I was running Ubuntu Server installed on a new Sandisk Ultra Flair USB stick and it lasted for about 5 days before failing. Forget about wear levelling - USB stick is a temporary solution.

About 5GB or larger swap file - this "available" memory with high physical (fast) vs swap (very slow) ratio is seen by the system similarly to your dog seeing a bucket of stone pebbles and thinking it's plenty of dog food. When the dog gets hungry though it quickly realizes the mistake - they are not good to eat.

I think @RMerlin‘s post here is very pertinent at this point:
If you run anything that requires a large swap, it's probably going to run so slow that it's a bad idea anyway. Swapping off a USB thumbdrive is going to have major impacts on your router performance.

In 2022, swaps should only be used as temporary "spillover". If something constantly requires swap, then you need to address it.

Also @thelonelycoder’s in this post:
2 GB is plenty for Skynet, Diversion and most other apps combined. Then, there’s Unbound that some users report uses more than that for some specific operations. Don’t ask, I don’t remember the specifics. I added the 5 and 10GB size option upon request.
Go with 2 GB, it will be sufficient for 97,5% of the use cases.
 
Last edited:
Tell me the speed difference

Your router has DDR3 RAM. I don't know the clock rate, but let's say 1333MHz or PC3-10600. It can do >10GB/sec data rate. Your router's USB port is CPU limited to about 120MB/sec regardless of the drive specs. So the speed difference ratio is about 1 to 0.01 or worse. This is on read, on write is about 1 to 0.003 or worse. See the pebbles?
 
I'll play some more on the SSD question but never again on the swap question. I posit the following.
:)
1. The USB2 spec ..
Ok.
2. I do not know what the power draw of the SSDs you posted (and thanks for this!) when specified is at 3.3v is when they are fed 5v. If it is just a resistor then the actual draw could be higher.
I am not sure how the enclosure steps the voltage down TBH. Assume your comment on resistor is that it adds to the draw.
3. The power specs that are posted for the 3111 are actually average specs, not max specs. …. So I am a little skeptical that you can rely on calculations close to the 500ma USB2 limit to be reliable enough for this purpose.
Ok fair enough.
4. I'm not sure what the USB2/3 setting does ….so it is possible that the setting only affects the signaling without changing the amperage.
OK.
5. This interference business is a really big deal for the router mfgs...
All the more reason to run USB 2.0 mode. Whatever that means…
 
Your router has DDR3 RAM. I don't know the clock rate, but let's say 1333MHz or PC3-10600. It can do >10GB/sec data rate. Your router's USB port is CPU limited to about 120MB/sec regardless of the drive specs. So the speed difference ratio is about 1 to 0.01 or worse. This is on read, on write is about 1 to 0.003 or worse. See the pebbles?

And here I was thinking that an SSD was overkill, and that I would get advertised speed.
 
Status
Not open for further replies.

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top