al-caughey / YAMon-v4

Official repository for YAMon v4
https://usage-monitoring.com
63 stars 21 forks source link

All YaMon4 files disappear after router reboot #44

Open AmateurCoder105 opened 1 year ago

AmateurCoder105 commented 1 year ago

I am running DD-WRT 40559 std on a Trendnet TEW818DRU. My USB drive is formatted EXT3. All attempts to mount my USB drive to /opt fail with the message that /opt is read-only. The drive auto-mounts to /tmp/mnt/sda1 upon a reboot. So I unzip the zip archive on my PC, use dos2unix to make sure all text files are UNIX formatted, copy the folder structure to /tmp/mnt/sda1 and run the install, and all works fine -- that is until I reboot the router! YaMon was no longer running and when I checked, /tmp/mnt/sda1 was completely empty.

Now, I realize /tmp is volatile, but /tmp/mnt/sda1 should be writing to the USB drive, correct? If so, why are my files disappearing? I'm familiar with UNIX so this behavior is not making sense to me.

In the meantime, I created a tar archive of the entire YaMon4 directory and used WinSCP to copy it back to my laptop; rebooted again to test and, sure enough, my files were gone -- but simply copying the tar file back, extracting it and running the start.sh script got me going again. At least if I have an unexpected router reboot I'll only lose the captured data, not my config and settings ...

UPDATE 12/26/22: I think I've discovered the source of the problem. For starters, when I formatted the USB drive, I did not name the volume. I was trying to manually link the drive to /opt using the "ln" command (failed saying /opt was read-only). The DD-WRT interface said it mounted the drive on /tmp/mnt/sda1 but this was a ramdisk, which explains why everything disappeared after a reboot. It may also explain why I was losing Wifi connectivity after a few days, forcing me to reboot the router -- the collected files were likely filling up router's the RAM. When I named the volume "opt" the router automatically mounted the disk at /opt and the information persisted after a reboot. I'll see what happens now ...