Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    RRD Graphs on Embedded - CF Issue?

    Scheduled Pinned Locked Moved webGUI
    20 Posts 6 Posters 16.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MindTwist
      last edited by

      That did it, it is in both rc.shutdown and rc.reboot. The exact command is:

      cd / && tar -czf /cf/conf/rrd.tgz -C / var/db/rrd/*.rrd

      I tried doing it from Diagnostics / Command promt, then just turned off and on pfSense without shutting down correctly, and now I still have my RRD data. I just configured a cron job to run that command daily at 11:59 and 23:59, so hopefully I will never lose more than 12h of RRD data if the power gouts out.

      I do not think that writing 2 times daily will wear out too much my CF card.

      Thanks! :D

      1 Reply Last reply Reply Quote 0
      • F
        fabifri
        last edited by

        I have also the issue, that sometimes some hours of rrd-graphs are lost…due to power losses...

        So I have tried to install the PC-Edition on the CF, but it won't boot in my Alix - not only for the savings of the RRD-Databases, i also liked it to have packages-support on my Alix. I know it's not supported to run the PC-Build on Embedded platforms, but is there any guide for a workaround to get the PC-Edition running on my Alix-Board?

        So, as a temporal solution i would like to make this cron-job to save the data, but i first tried to issue the command manually on the shell. I got the following error:

        tar: Failed to open '/cf/conf/rrd.tgz': Read-only file system

        so i think, that the cron-job also would fail - i am running 1.2.1-RC2 on my Alix now.

        Thanks for any tipps and help

        regards
        Fabian

        1 Reply Last reply Reply Quote 0
        • M
          MindTwist
          last edited by

          It does work ok for me, but it ain't working when doing a cron job.

          http://forum.pfsense.org/index.php/topic,11275.msg62500.html#msg62500

          Note that the command I am using is exactly the following, so it will be one single line:
          /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/*.rrd

          When done from Diagnostics -> Command prompt, it does work. I can then do a ls -la /cf/conf and a new rrd.tgz has been created. I was unable to get it to work as a cron job like you can see on thread I link to above (haven't done any more trying after that)

          1 Reply Last reply Reply Quote 0
          • D
            databeestje
            last edited by

            the easiest way to get a full install onto a CF is using vmware server.

            I create a new VM in vmware server with a disk size of a little less then the CF card.
            I then install pfSense from the cdrom, select GRUB as the boot loader, and select the embedded kernel.

            Then I reboot pfsense after the install and power down the VM during the reboot when it hits the bios.

            I then use physdiskwrite to write the FreeBSD-flat.vmdk to the CF card.

            That works for me.

            1 Reply Last reply Reply Quote 0
            • M
              MindTwist
              last edited by

              Hi databeestje,

              The issue is not about installing pfSense on a CF card, but on what to do so the RRD graph information won't get lost when a cold reboot/power out happens! :)

              1 Reply Last reply Reply Quote 0
              • D
                databeestje
                last edited by

                fabifri asked for a solution to get the full install on a CF. So it's perfectly valid.

                1 Reply Last reply Reply Quote 0
                • GruensFroeschliG
                  GruensFroeschli
                  last edited by

                  I think a friend run into a similar problem recently.
                  I think he solved it by temporarily mounting the filesystem as read/write.

                  I'll ask him the next time i see him if he could post his solution.

                  We do what we must, because we can.

                  Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

                  1 Reply Last reply Reply Quote 0
                  • M
                    MindTwist
                    last edited by

                    databeestje, fabifri was trying to install the full version on a CF card because he was also having lost RRD information due to power losses.

                    I really do not know how many read/write cycles a CF card can sustain before passing out, but I do not think installing the full version on a CF card is a good solution for that. The RRD data on a normal installation is probably written to disk at least once a minute, which would ammount to at least 525600 extra writes every year on the card. CF cards are cheap, yeah, so it probably is not such a big deal to just throw an extra CF card every once in a while before your current CF dies, but I am sure the embedded version must exist for a reason.

                    By saving the RRD data with a cron job you can choose how often you want to do it, so if the power goes out you won't lose much data. Once a day? Every 12h? Hourly? It will probably be just easier than installing the full version on a CF card.

                    Thx!

                    1 Reply Last reply Reply Quote 0
                    • GruensFroeschliG
                      GruensFroeschli
                      last edited by

                      mount -o rw /cf/ ; /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/*.rrd ; mount -o ro /cf

                      We do what we must, because we can.

                      Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

                      1 Reply Last reply Reply Quote 0
                      • M
                        MindTwist
                        last edited by

                        Thanks, I will give that a try. Maybe the command I am running /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/*.rrd from the WebGUI is working ok but not working from a cron job for whatever permissions reason. I will try changing the cron job to mount -o rw /cf/ ; /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/*.rrd ; mount -o ro /cf and see how that works out! :D

                        1 Reply Last reply Reply Quote 0
                        • M
                          MindTwist
                          last edited by

                          I think that didn't do the trick for me. Not only the cron job still is doing nothing, but now I can not even do it by hand like I used to, dang… I created the cron job with mount -o rw /cf/ ; /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/*.rrd ; mount -o ro /cf yesterday at 17:23, restarted pfSense, and now my rrd.tgz has timestamp 17:23, the cron job has done nothing.

                          And doing a /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/*.rrd now does nothing at all either, I guess the directory/file is readonly… Not even if I do a mount -o rw /cf/ by hand before. Oh well :(

                          		 <minute>0</minute>
                          			<hour>1,7,13,19</hour>
                          			<mday>*</mday>
                          			<month>*</month>
                          			<wday>*</wday>
                          			<who>root</who>
                          			<command></command>mount -o rw /cf/ ; /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/*.rrd ; mount -o ro /cf 
                          
                          
                          1 Reply Last reply Reply Quote 0
                          • M
                            MindTwist
                            last edited by

                            Ok, that sucked. I would advise anyone to NOT try the command I tried above as a cron job, lol…

                            You end up with everything being readonly on /conf , so the RRD info does not get saved at all (not even on reboot), and I was not even able to restore one of the old config.xml I kept around, since it was giving me the following error:

                            Warning: copy(/conf/config.xml): failed to open stream: Read-only file system in /etc/inc/config.inc on line 1172 
                            

                            Now, what I end up doing was doing a mount -o rw /cf/ from the command prompt, and just deleting the /conf/config.xml. Luclily, pfSense is smarter than me, and it detected that the config file was gone, and restored one of the old ones. After rebooting, I was then able to restore a config.xml from the WebGUI.

                            So, a new gap on my RRD graphs due to lost data, and I still do not have a way of saving the RRD data at least once a day, except doing it once in a while from the command prompt… :(

                            1 Reply Last reply Reply Quote 0
                            • S
                              spock521
                              last edited by

                              I was having similar issues some time ago and I never found any working solution on these forums but after some experimentation I figured out a way to make this work (atleast for me). So in case someone else is trying to do the same I thought I'd share my solution (hopefully it will help someone).

                              Add this cron-entry to the configuration file:

                              <minute>0</minute>
                                <hour>3,15</hour>
                                <mday></mday>
                                <month>
                              </month>
                                <wday></wday>
                                <who>root</who>
                                <command></command>echo "RRD Graphs: Backup started." | logger; /etc/rc.conf_mount_rw ; /usr/bin/tar -czf /cf/conf/rrd.tgz -C /var/db/rrd/
                              .rrd ; /etc/rc.conf_mount_ro ; echo "RRD Graphs: Backup complete." | logger

                              I don't know if this is a proper way to do it, but it's the only way I found to work (manually remounting the CF read-write complains about permissions etc.). And it havent caused me any problems or side-effects so far.

                              1 Reply Last reply Reply Quote 0
                              • L
                                littlekp
                                last edited by

                                I'm just struggling with the lost RRD data on my 1.2 version.
                                Thanks for the info about the reason of lost data.
                                Next Time I will do the clean boot rather than just turn it off by the power button. :P

                                1 Reply Last reply Reply Quote 0
                                • M
                                  MindTwist
                                  last edited by

                                  I was out all movember and hadn't been able to try it, check out the results, and post back until now, but the cron job as above by spock521 works great for me too.
                                  Thanks!

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.