OpenWrt Forum Archive

Topic: USB external storage with rootfs and swap

The content of this topic has been archived on 29 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have just posted a tutorial on howto increase memory to TL-MR3420 router with recourse to external HDD. It is all found in my blog at:

http://redacacia.me/2013/04/08/openwrt- … otfs-swap/

Effectively is based upon on documentation found at this site and elsewhere on the Web.

Please keep us updated about longterm reliability, especially with that usb swap partition. I have been using extroot on a WR1043ND during the last year and had my problems with sudden usb disconnects/resets out of the sudden or due to EMI. That normally occurred after 10-20 days.

Thank you for your input. Will do by posting here.

Note that is why also I have also added idle-time routine.

The original work was published by K.  L. Seet as mentioned in acknowledgements based on documents at OpenWRT site.

I don't see a relationship between spinning down the hdd and usb disconnects/resets (with disconnect I don't mean to physically unplug the usb cable; it is the behavior of the controller/driver).

I thought you were saying about issues with Swap becoming error prone.  In your case it seems something is happening. Where is the fault on HDD side or router's side of USB connection? I have read elsewhere issues with the USB port. To avoid problem with power supply - a common cause of USB ports misbehaving - I have in my setup with USB hub with power supply.

My setup was: Router <--> USB-Hub <--> SD Card Reader <--> SD Card
I used the hub bus powered, since all the usb components should draw less than 500 mA. And all worked quite well in over 99% of the time. It is just that due to the long uptime, you will catch some unlikely events, like the mentioned EMI issues (sometimes seen when connecting another device on the same power line).
To sum it up: I have already seen the behavior, when the overlayed root filesystem gets temporarily disconnected: it still stays mounted, since there is still activity/open files. As a result, /dev/sda1 (my extroot) is not released and during reenumeration the flash drive got named /dev/sdb1.
What I have not yet seen is the behavior, when swap suddenly disappears.

If I may disagree the issue seems some switching caused by overdriving your USB port. I suggest trying out a hub that is externally supplied. The spike you are mentioning may just be inducing such a switching effect.

Also I suggest reading "The Ten Commandments of USB":

http://www.bb-elec.com/Learning-Center/ … f-USB.aspx

I draw your attention on assuming you can draw 500mA. I would not rule EMI but I would suggest it is a multiplying factor.

(Last edited by Tayeb on 9 Apr 2013, 23:34)

One thing that has occured to me is how do you connect the hub to usb port of your router, whether you have tried to use a good shielded usb cable that is not too long.

First I had a hub with a thin 5cm cable, until it more or less died after a couple of months of 24/7 operation. Now I use one with external cable of about 1 m length, with regular shield.

And is the problem overcome or you still face the same problem? Unshielded 5m cable was inviting trouble surely!

(Last edited by Tayeb on 16 Apr 2013, 20:48)

Still the same. Last time this happened after about 1500000 seconds uptime, dmesg just outputs "usb disconnect" and then the regular enumeration begins.
Btw. my first hub came with a builtin thin 5 centimeter cable, I never used 5 meter cable at all.

Has the problem persisted with the same frequency or has improved? I am asking this perhaps to help you out in determining how to overcome the problem, based on my experience with USB connections in PCs.

(Last edited by Tayeb on 17 Apr 2013, 08:53)

Hard to say, since it is almost a year since I changed to the new hub and I just used the old hub for 2 or 3 months.
So, the pattern I noticed is, that it does that "usb disconnect" every 10 to 15 days. Besides, EMI has not been an issue ever since I moved the device to another power outlet, with no other inductive devices close by.
For myself I came to the conclusion, that hotplug devices are not the best choice, if long term stability and reliability is of concern. So sooner or later I will move my storage part to a raspberry pi with SD or a low power x86 with SSD.

The discussion might have continued from here.