Here is a solution that doesn’t require an external drive:
There is a package in the Arch user repository that allows caching of anywhere in the file system using /tmp. It keeps the data in ram, and syncs to disk once per hour by default. On a Pi 2, there is plenty of ram spare to do this. Details are here: wiki.archlinux.org/index.php/An … ync-daemon
It uses systemd timers, so also works on Raspbian Jessie OK.
To install on arch, do “yaourt anything-sync-daemon” or whatever AUR tool you use.
Anything-sync-daemon v5.76 on Raspbian GNU/Linux 8 (jessie)
Systemd service is currently active.
Systemd resync service is currently active.
Overlayfs v23 is currently active.
Asd will manage the following per /run/asd.conf settings:
owner/group id: root/0
target to manage: /var/lib/monitorix
sync target: /var/lib/.monitorix-backup_asd
tmpfs target: /tmp/asd-root/var/lib/monitorix
dir size: 75M
overlayfs size: 71M
recovery dirs: none
owner/group id: root/0
target to manage: /var/lib/collectd
sync target: /var/lib/.collectd-backup_asd
tmpfs target: /tmp/asd-root/var/lib/collectd
dir size: 28M
overlayfs size: 7.8M
recovery dirs: none
Thanks everyone for the suggestions , particulary caius .
I ended up installing the ync-daemon, so far so good, disk writes are greatly reduced so this one will go on the standard build recipe.
Did quite a bit of digging around the web on the subject SD wear leveling. There is plenty of spin out there but real info is a bit hard to find so what i d d come away with is that :
1 there is no requirement for wear leveling in the official SD card specification
2 the cheap ebay cards etc probably don’t have any implemented (no surprise)
3 consumer grade cards from reputable manufactures generally have some type of leveling algorithm implemented but these tend to be more suable for the intended market i.e. File storage for cameras and holding your pirated mp3 collection in your smart phone.
4 if you want real ware leveling and error detection / correction for applications that hammer the card then the “high data integrity” industrial cards are the way to go. But at 5+ times the price I’ll probably stick with the $8 ones from kmart and a good backup
This might be the issue. I’ve been using Rpi’s for many things as soon as the came out. With a good, brand name cards, I don’t have the issues you’re having.
Maybe. Ive killed 2 so far (one from ebay before i realized there was a problem) and 1 Verbatum.
The Verbatum SD from kmart for $8 are bubble packed premium 8gb class 10 in bubble pack. I can certanly pay a lot more around town but I’m not convinced ill have much more luck short of getting the industrial rated ones from RS or Element14.
I tried this but it does not work because systemctl is not available/installed on my Raspian Wheezy system. I found on the Internet that I may need to install
sudo apt-get install systemd systemd-sysv
but this is telling me:
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
sysvinit
0 upgraded, 7 newly installed, 3 to remove and 1 not upgraded.
Need to get 1,580 kB of archives.
After this operation, 3,557 kB of additional disk space will be used.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?]
Naturally, since I don’t know exactly what I’m doing, I answered ‘no’ and the installation aborted. Would you know if it was safe to install/remove these packages?
If you are running wheezy then I wouldn’t mess with installing systemd unless you are already familiar with it, otherwise you are asking for a world of hassle getting things working. It will affect everything installed on the machine, so in most cases it’s not worth it and is easier to just start with a fresh Jessie installation (or arch if you like tinkering) rather than try to upgrade.
With you there caius as far as systemd goes. Unless your going from Wheezy to Jessie doing a dist-upgrade using Jessie repositories I wouldn’t attempt it. Even then your probably better off going with a fresh installation of Jessie. Jessie is coming up on a year old and for applications such as those discussed here is more than matured enough to run them stably. I do not see why it is not used more so than Wheezy here.
The foundation images only started using Jessie about 3 months ago, and the piaware sdcard images are still wheezy-based (I’m working on that…) which is probably why wheezy is still mostly used here.
Something I noticed - If you are going to use the anything-sync-daemon it’s worth checking that your /tmp directory is actually mounted on tmpfs. The standard Raspbian Jessie image doesn’t do this by default, so you won’t see any reduced disk writes.
The /etc/fstab file should contain:
tmpfs /tmp tmpfs defaults,noatime 0 0
Add this, and either reboot or do
sudo mount /tmp
to get it working.
To check all is OK do
df -T /tmp
You should see output with the type indicating tmpfs.
Make sure you stop anything-sync-daemon before doing this to allow it to write anything new back to its proper location, then restart afterwards.
Quite an improvement there. Might have to give it a try and possibly free up a WD Elements drive for use someplace else to be figured out at a later date. Although it has made for an extra place to store files on my home network where it’s at now…
Defiantly makes sense. Know your a busy person but glad to hear your working on a Jessie image.
I have been curious how much data is flowing to/from my “production” piaware box. My primary feeder is used solely for Dump1090-mutability and piaware with no feeds to other sites or utilities. I have been playing with two tools: nethogs, and vnstat.
Nethogs: shows current network utilization for running processes
Installation: sudo apt-get install vnstat
Operation: sudo nethogs
Sample output:
NetHogs version 0.8.0
PID USER PROGRAM DEV SENT RECEIVED
1985 root /usr/bin/piaware eth0 0.756 5.240 KB/sec
29446 pi sshd: pi@pts/0 eth0 0.000 0.000 KB/sec
? root unknown TCP 0.000 0.000 KB/sec
TOTAL 0.756 5.240 KB/sec
Another tool for long term network monitoring: vnstat (tracks network statistics and saves to database)
installation: sudo apt-get install vnstat
Operation: Automatically collects stats on network in background
Sample of default output:
pi@piaware ~ $ vnstat -h
eth0 12:10
^ t
| t t t t t t
| t t t t t t t t t t t
| t t t t t t t t t t t t t
| t t t rt rt rt t rt t t t rt rt rt t
| rt rt rt rt rt rt rt rt t t t t rt rt rt rt t
| rt rt rt rt rt rt rt rt rt t t t rt rt rt rt rt
| rt rt rt rt rt rt rt rt rt rt rt rt rt rt rt rt rt
| rt rt rt rt rt rt rt rt rt rt rt t t rt rt rt rt rt rt
| rt rt rt rt rt rt rt rt rt rt rt rt t rt rt rt rt rt rt rt t
-+--------------------------------------------------------------------------->
| 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12
h rx (KiB) tx (KiB) h rx (KiB) tx (KiB) h rx (KiB) tx (KiB)
13 17169 25675 21 12987 20597 05 3216 8438
14 17671 24686 22 11740 18995 06 9363 15977
15 18454 27364 23 9850 15916 07 16643 25209
16 19573 27380 00 3885 7233 08 20044 28596
17 19116 28175 01 752 2090 09 20257 29536
18 21781 31176 02 605 1774 10 21279 28601
19 18186 27137 03 766 2563 11 15437 22333
20 19275 28533 04 1202 4852 12 2251 3155
Other options:
pi@piaware ~ $ vnstat -?
vnStat 1.11 by Teemu Toivola <tst at iki dot fi>
-q, --query query database
-h, --hours show hours
-d, --days show days
-m, --months show months
-w, --weeks show weeks
-t, --top10 show top10
-s, --short use short output
-u, --update update database
-i, --iface select interface (default: eth0)
-?, --help short help
-v, --version show version
-tr, --traffic calculate traffic
-ru, --rateunit swap configured rate unit
-l, --live show transfer rate in real time
iptraf is another tool to consider. It is ncurses based and can be cryptic for customizing, but the default will easily show all port traffic, both on the loopback and externally. I find iptraf especially helpful to check that all my expected connections are flowing data.
Sorry to drag this thread out, but I’m having a problem, I am trying to generate the following graph and rrdtool is giving me a segmentation fault and no other info…
Has anyone else had this issue and have a solution they would care to share? rrdtool version is 1.5.4… On Ubuntu ARM… (Pi2 with Ubuntu on it) (not the radar host)…
Hi jepolch. I am using Raspbian Stretch, when I get as far as the cd ~/pi/dump-tools there is no pi directory. Not sure if this is a difference in the Raspbian version. When I check for /collectd I get a 404 error. I created a pi directory and re ran the script but the directory is empty and still get a 404. Do you have any ideas? Sorry bit of a Luddite.
Regards
Rick