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

    SG-3100 ram disk question

    Scheduled Pinned Locked Moved Official Netgate® Hardware
    29 Posts 4 Posters 2.7k 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
      mcury Rebel Alliance
      last edited by

      I'm planning to enable RAM disk in my SG-3100.

      With my current config, I have around 1GB of free RAM.
      The size of /var directory is around 650MB.

      What size of /var should I set? To be safe.

      last pid: 26515;  load averages:  0.27,  0.32,  0.28    up 3+03:22:25  19:28:04
      150 threads:   3 running, 125 sleeping, 22 waiting
      CPU:  0.0% user,  0.0% nice,  0.6% system,  0.0% interrupt, 99.4% idle
      Mem: 201M Active, 411M Inact, 209M Wired, 84M Buf, 1231M Free
      
      [22.05-RELEASE][root@pfsense.home.arpa]/: du -sh /var
      632M	/var
      [22.05-RELEASE][root@pfsense.home.arpa]/: du -sh /tmp
      284K	/tmp
      

      dead on arrival, nowhere to be found.

      M 1 Reply Last reply Reply Quote 0
      • M
        mcury Rebel Alliance @mcury
        last edited by mcury

        Replying to myself, set /var to 850M and /tmp to 80M, boot successfully.

        dead on arrival, nowhere to be found.

        S 1 Reply Last reply Reply Quote 0
        • S
          SteveITS Galactic Empire @mcury
          last edited by SteveITS

          @mcury "monitor it a while" is going to be the answer (for /tmp and /var). 650 MB sounds pretty big? I've set up RAM disks on most of the routers under our care and /var is usually around 80-120 MB used space, off the top of my head. Just wondering for you if there are extra/old files there to clean up.

          Using tmpfs, it won't allocate the RAM until used, but a 3100 only has 2 GB to start with.

          Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
          When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
          Upvote 👍 helpful posts!

          M 1 Reply Last reply Reply Quote 0
          • M
            mcury Rebel Alliance @SteveITS
            last edited by mcury

            @steveits Thanks for the input.

            I suppose the /var size is due to pfblockerng and dnsbl big lists I'm using..

            So far its working fine, I'll be monitoring it.
            In case of problems, I can perform a clean install, I have the previous config saved here.

            [22.05-RELEASE][root@pfsense.home.arpa]/var: du -sh unbound/
            482M	unbound/
            [22.05-RELEASE][root@pfsense.home.arpa]/var/db: du -sh pfblockerng/
            122M	pfblockerng/
            

            The io in my eMMC is already way lower than it used to be, so its a very good sign already.

            [22.05-RELEASE][root@pfsense.home.arpa]/var: iostat -x
                                    extended device statistics  
            device       r/s     w/s     kr/s     kw/s  ms/r  ms/w  ms/o  ms/t qlen  %b  
            flash/sp       0       0      0.0      0.0     7     0     0     7    0   0 
            mmcsd0         1       0     13.1     16.5     1    13     0     6    0   0 
            mmcsd0bo       0       0      0.0      0.0     0     0     0     0    0   0 
            mmcsd0bo       0       0      0.0      0.0     0     0     0     0    0   0 
            [22.05-RELEASE][root@pfsense.home.arpa]/var: uptime 
            11:08PM  up  2:09, 1 user, load averages: 0.40, 0.40, 0.28
            

            dead on arrival, nowhere to be found.

            S 1 Reply Last reply Reply Quote 0
            • S
              SteveITS Galactic Empire @mcury
              last edited by

              @mcury said in SG-3100 ram disk question:

              io in my eMMC is already way lower

              Yep.... :) 👍

              @mcury said in SG-3100 ram disk question:

              I suppose the /var size is due to pfblockerng and dnsbl big lists I'm using..

              So if it's using 480 MB in RAM and 680 in RAM disk....1 GB just for that? Not saying you're wrong to do so, but that leaves only half for the rest. What is the memory usage on the dashboard? (am curious)

              Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
              When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
              Upvote 👍 helpful posts!

              M 1 Reply Last reply Reply Quote 0
              • M
                mcury Rebel Alliance @SteveITS
                last edited by mcury

                @steveits

                9e542b07-70d9-4f80-9c9b-4b9df19fb584-image.png

                [22.05-RELEASE][root@pfsense.home.arpa]/root: iostat -x
                                        extended device statistics  
                device       r/s     w/s     kr/s     kw/s  ms/r  ms/w  ms/o  ms/t qlen  %b  
                flash/sp       0       0      0.0      0.0     7     0     0     7    0   0 
                mmcsd0         0       0      2.7      5.1     1    11     0     6    0   0 
                mmcsd0bo       0       0      0.0      0.0     0     0     0     0    0   0 
                mmcsd0bo       0       0      0.0      0.0     0     0     0     0    0   0 
                

                dead on arrival, nowhere to be found.

                S 1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  Mmm, 650MB is large for a 3100 but if you have lists that big you might need it. That wouldn't be possible in previous pfSense versions. Just something to be aware of if you have any older installs.

                  You might consider if you really needs lists that big.

                  Steve

                  M 1 Reply Last reply Reply Quote 0
                  • S
                    SteveITS Galactic Empire @mcury
                    last edited by

                    @mcury "df -h"? Now I'm more curious, since 26% of 2017 is only 524.

                    Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                    When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                    Upvote 👍 helpful posts!

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      mcury Rebel Alliance @SteveITS
                      last edited by mcury

                      @steveits said in SG-3100 ram disk question:

                      @mcury "df -h"? Now I'm more curious, since 26% of 2017 is only 524.

                      [22.05-RELEASE][root@pfsense.home.arpa]/root: df -h
                      Filesystem                      Size    Used   Avail Capacity  Mounted on
                      /dev/diskid/DISK-D4EC8498s2a    7.0G    1.4G    5.1G    21%    /
                      devfs                           1.0K    1.0K      0B   100%    /dev
                      /dev/diskid/DISK-D4EC8498s1      34M    2.0M     32M     6%    /boot/u-boot
                      tmpfs                            80M    236K     80M     0%    /tmp
                      tmpfs                           850M    186M    664M    22%    /var
                      /usr/local/bin                  7.0G    1.4G    5.1G    21%    /var/unbound/usr/local/bin
                      /usr/local/lib                  7.0G    1.4G    5.1G    21%    /var/unbound/usr/local/lib
                      devfs                           1.0K    1.0K      0B   100%    /var/dhcpd/dev
                      /lib                            7.0G    1.4G    5.1G    21%    /var/unbound/lib
                      devfs                           1.0K    1.0K      0B   100%    /var/unbound/dev
                      /var/log/pfblockerng            850M    186M    664M    22%    /var/unbound/var/log/pfblockerng
                      /usr/local/share/GeoIP          7.0G    1.4G    5.1G    21%    /var/unbound/usr/local/share/GeoIP
                      

                      dead on arrival, nowhere to be found.

                      S 1 Reply Last reply Reply Quote 0
                      • M
                        mcury Rebel Alliance @stephenw10
                        last edited by

                        @stephenw10 said in SG-3100 ram disk question:

                        Mmm, 650MB is large for a 3100 but if you have lists that big you might need it. That wouldn't be possible in previous pfSense versions. Just something to be aware of if you have any older installs.
                        You might consider if you really needs lists that big.

                        hm, so far so good ✌

                        dead on arrival, nowhere to be found.

                        1 Reply Last reply Reply Quote 0
                        • S
                          SteveITS Galactic Empire @mcury
                          last edited by

                          @mcury said in SG-3100 ram disk question:

                          tmpfs 850M 186M 664M 22% /var

                          Hmm, so it's only using 186 MB for some reason, not 650. Looks like it's all pfB.

                          side note: the /usr/local/share/GeoIP I looked at is only 26 MB.

                          Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                          When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                          Upvote 👍 helpful posts!

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            mcury Rebel Alliance @SteveITS
                            last edited by

                            @steveits Strange, I put both configuration in Meld for comparison, and it seems that this ram disk change doesn't go to the xml config.

                            So, in the future in case of a new install, I can restore this configuration and then enable RAM disk, but this won't be automatic.

                            dead on arrival, nowhere to be found.

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              SteveITS Galactic Empire @mcury
                              last edited by

                              @mcury It should be in the config. Look for:

                              <use_mfs_tmp_size>128</use_mfs_tmp_size>
                              <use_mfs_var_size>256</use_mfs_var_size>
                              and
                              <use_mfs_tmpvar/>

                              Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                              When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                              Upvote 👍 helpful posts!

                              M 1 Reply Last reply Reply Quote 1
                              • M
                                mcury Rebel Alliance @SteveITS
                                last edited by mcury

                                @steveits Oh yes, you are correct, I don't know how I missed that :)

                                7def233f-c5c0-4be4-9308-57bf9de9d332-image.png

                                So, to disable I can just remove that line:

                                use_mfs_tmpvar></use_mfs_tmpvar>
                                

                                That is useful because I noticed that when you perform a clean install and restore a config, during packages reinstall there is a lot of RAM usage, which could break things for me..

                                dead on arrival, nowhere to be found.

                                1 Reply Last reply Reply Quote 0
                                • stephenw10S
                                  stephenw10 Netgate Administrator
                                  last edited by

                                  Yes, that's the config line that triggers creating and using the ramdisks.

                                  You'll find that the usage is much higher when pfBlocker updates. Probably around double what you see there now.

                                  Steve

                                  M 1 Reply Last reply Reply Quote 0
                                  • M
                                    mcury Rebel Alliance @stephenw10
                                    last edited by

                                    @stephenw10 said in SG-3100 ram disk question:

                                    You'll find that the usage is much higher when pfBlocker updates. Probably around double what you see there now.

                                    hm, ramdisk for /var is set to 850M, and not problems yet, I've been monitoring and so far so good.
                                    Do you think I'll face problems with this size?

                                    In case of a pfsense reinstall and config restore, I would disable the ram disk just to be safe.

                                    dead on arrival, nowhere to be found.

                                    1 Reply Last reply Reply Quote 0
                                    • stephenw10S
                                      stephenw10 Netgate Administrator
                                      last edited by

                                      I think that's big enough for pfBlocker to update.
                                      I'm not sure if a RAM disk that size is sustainable on the 3100. But it could be the years of battling kernel memory limits we had before we switched to tmpfs making me paranoid! 😉

                                      Before that ~120MB was the most you could set. That's what I use on most installs:

                                      [22.05-RELEASE][admin@fw1.stevew.lan]/root: df -h
                                      Filesystem                      Size    Used   Avail Capacity  Mounted on
                                      /dev/diskid/DISK-9E18E959s2a    7.0G    2.3G    4.1G    36%    /
                                      devfs                           1.0K    1.0K      0B   100%    /dev
                                      /dev/diskid/DISK-9E18E959s1      34M    2.0M     32M     6%    /boot/u-boot
                                      tmpfs                            80M    2.2M     78M     3%    /tmp
                                      tmpfs                           120M     34M     86M    28%    /var
                                      devfs                           1.0K    1.0K      0B   100%    /var/dhcpd/dev
                                      

                                      Steve

                                      M 1 Reply Last reply Reply Quote 0
                                      • M
                                        mcury Rebel Alliance @stephenw10
                                        last edited by

                                        @stephenw10 I'll be testing and in case of problems I'll post here to help others that try this same approach.

                                        Thanks stephenw10

                                        I was getting around 2TB a year of writes before making this change.. Almost 5 years using device already :)

                                        [22.05-RELEASE][root@pfsense.home.arpa]/root: iostat -x
                                                                extended device statistics  
                                        device       r/s     w/s     kr/s     kw/s  ms/r  ms/w  ms/o  ms/t qlen  %b  
                                        flash/sp       0       0      0.0      0.0     8     0     0     8    0   0 
                                        mmcsd0         0       0      1.5      4.0     1    10     0     6    0   0 
                                        mmcsd0bo       0       0      0.0      0.0     0     0     0     0    0   0 
                                        mmcsd0bo       0       0      0.0      0.0     0     0     0     0    0   0 
                                        [22.05-RELEASE][root@pfsense.home.arpa]/root: uptime 
                                        10:25AM  up 18:38, 1 user, load averages: 0.29, 0.28, 0.25
                                        

                                        dead on arrival, nowhere to be found.

                                        1 Reply Last reply Reply Quote 1
                                        • F
                                          FSC830
                                          last edited by

                                          I am a bit confused about the RAM disk limits.
                                          At my SG-3100 the limit is:

                                          Maximum total size of all RAM disks cannot exceed available memory: 269.75 MiB
                                          

                                          To which packages/options/values/... is the limit referring/calculating?

                                          I do not use RAM disks any longer since my issues, just to still curiosity 😉 .

                                          Regards

                                          1 Reply Last reply Reply Quote 0
                                          • stephenw10S
                                            stephenw10 Netgate Administrator
                                            last edited by stephenw10

                                            You are probably running an older version before we switched to tmpfs?

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