Hi,
Is there a preferred method to go about using a USB flashdrive to store the feed data and/or log files generated by emonCMS on my shiny, new emonPI?
After doing some searching on this forum and coming up short, I installed MC and went about exploring the filesystem on the emonPi. Having done this, my intuition was that this might be accomplished by moving the /home/pi/data directory to the USB drive, adding a symlink in its place and adding the drive to /etc/fstab.
With this in mind, I viewed /etc/fstab and found this:
mpfs /tmp tmpfs nodev,nosuid,size=30M,mode=1777 0 0
tmpfs /var/log tmpfs nodev,nosuid,size=30M,mode=1777 0 0
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,ro,noatime,errors=remount-ro 0 1
/dev/mmcblk0p3 /home/pi/data ext2 defaults,rw,noatime 0 2
This confirmed my suspicions and suggests that I should be able to format a USB stick to ext2 and change that last line to something like:
"/dev/sda /home/pi/data ext2 defaults,rw,noatime 0 2";
but this has now lead to some important questions:
- How big is this data partition?
- How much data is stored here?
- What files are put here?
- How big can the files get?
- How long are they retained?
- Is there any rotation/deletion for logs/feeds when they start getting too large?
- What difference will changing their location make to any retention policies?
- Are there any plans to manage/automate the moving of this data directory, via the emonCMS interface?
I will continue to look into this myself, but if anyone can help shine some light on the subject, I'd very much appreciate their reply.
Thanks,
Rich.
Re: Logging to a USB Flash Drive
Rich,
You are correct that the database is under /home/pi/data.
This command shows the partition size:
You'll see a line something like this:
/dev/mmcblk0p3 788M 32M 716M 5% /home/pi/data
Which says the partition is 788 Mbytes, with 32 used in this case. Actually it's an 800 Mbyte partition minus filesystem overhead.
To view the partition table of the SD card:
Partition 1 is a small one mounted on /boot, then 2 is the root partition and 3 is /home/pi/data.
Steve