USB flash in failsafe

Hi,

I have an D-Link DIR-505 that is very practical because it is very small. The problem is the size of the flash (only 4 MB).
So I'm using it with a small pen drive, but with 4 GB.
The first thing I do after the basic configuration is install the USB packages, install, format the USB flash drive, copy the /overlay to it and change fstab.
So now, when rebooting I have a big /overlay to install more packages.

The problem is when making a wrong configuration and the router is no more accessible (ports open but no answer; only pinging). In this case it is needed to boot in failsafe mode.

The question is: how to load the USB flash drive manualy the have access to the valid /overlay?
Right after having access to console in failsafe mode, I execute mount_root to have access to /overlay. But this is not "my" USB overlay but the "DIR-505" overlay. Besides that, there is no sda device in /dev. How to mount them manualy?
The "block info" command shows only 2 /dev/mtdblock7 and /dev/mtdblock8 (squashfs and jffs2), no /dev/sda1.

I tried a lot without success. Can anyone help me?

Thanks in advance.

carliedu
SP-Brazil

DIR-505 has 8MB flash.
Why do you think it has only 4MB?

The "best" would be to build your "ROM" image with the USB drivers, file system drivers, and mounting tools.

The other approach would be to install them onto the flash-based overlay, mount that, load the drivers, then mount the USB stick. That's roughly how the "extroot" configuration works.

You are right. I don't know where I found this information. Probably on TOH on Openwrt because I only look there for this type of information.
Now I looked there again and it shows 8 MB. Can be that it was corrected.
Thanks for your comment.

Hi Tmomas,
I found why I think it has only 4MB flash.
Right after installing a fresh firmware (Version 18.06.0), with terminal I get the following:

root@D505:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    29.5M    604.0K     28.9M   2% /tmp
/dev/mtdblock8            3.9M    300.0K      3.6M   7% /overlay
overlayfs:/overlay        3.9M    300.0K      3.6M   7% /
tmpfs                   512.0K         0    512.0K   0% /dev

So, I convinced that TOH is wrong.

Can you check yours again, please?

Best,
carliedu

Looks like 2.5 MB for the ROM, 4 MB for the overlay, then the rest perhaps for the boot loader and the like = 8 MB total flash

1 Like

Unlikely.

Compare your output of cat /proc/mtd with https://openwrt.org/toh/d-link/dir-505#flash_layout

Hi tmomas and jeff.
Both your comments were very important.
-tmomas: I convinced you wrong about TOH. TOH is right. DIR-505 has 8 MB flash size.
-jeff: You showed me an information that was new for me and so I'm convinced that DIR-505 has 8 MB flash size.

Flash memory is mtd formated and holds other partitions besides /overlay.
The command cat /proc/mtd shows the partioning. On DIR-505 it is:

root@(none):~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00010000 00010000 "u-boot"
mtd1: 00010000 00010000 "art"
mtd2: 00010000 00010000 "mac"
mtd3: 00010000 00010000 "nvram"
mtd4: 00040000 00010000 "language"
mtd5: 00780000 00010000 "firmware"
mtd6: 0014da84 00010000 "kernel"
mtd7: 0063257c 00010000 "rootfs"
mtd8: 003f0000 00010000 "rootfs_data"

I will continue to study about and try to understand how to gain access to the /overlay on USB-device.

Thanks for now.

Best,
carliedu

Just wonder if anyone working to bring this little gem to ath79 dts too.....

You're certainly welcome to port it yourself as I don't see it on master on ath79.

There isn't a lot of appetite to spend time on devices nearly a decade old that have little hope of running what most people consider a minimal OpenWrt install (both flash and RAM both). Suitable replacements with at least 16/128 are available starting at under US$20.