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

    Bug 2401 - Workaround/ Mounting RO after mounting RW can be very slow on nanoBSD

    Scheduled Pinned Locked Moved 2.1 Snapshot Feedback and Problems - RETIRED
    4 Posts 3 Posters 2.0k 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.
    • H
      helixxx
      last edited by

      Posting this separately so it's easier to find…

      Description:
      https://redmine.pfsense.org/issues/2401
      Mounting read-only after mounting read-write can be very slow on NanoBSD
      /sbin/mount -u -r -f -o sync,noatime /
      takes ages to finish, thus any changes in the web interfaces take a lot of time when one clicks 'save'.
      Remounting /cf doesn't seem to cause any problems.

      I have tried killing almost all processes, yet there was no change in behavior. Even when I remounted / RW and RO back to back with no delay, it stalled at the remount RO.

      Workaround (not a fix!):

      in /etc/inc/config.lib.inc line 361 replace

      mwexec("/sbin/mount -u -r -f -o sync,noatime /");
      
      

      with

      mwexec("/sbin/mount -u -w -f -o async,noatime / && /sbin/mount -u -r -f -o async,noatime / && /sbin/mount -u -r -f -o sync,noatime /");
      
      

      Possible problems
      Note the async option.
      This may lead to loss of data, actually, but hasn't caused any problems for me so far.
      Time for remount RO has dropped on my Alix Board from ~ 70 seconds to ~7 seconds.

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        async is scary dangerous. Try pulling the plug on your ALIX at random times with async or sync. See what happens.

        From mount(8):

        async   All I/O to the file system should be done asynchronously.
                            This is a dangerous flag to set, since it does not guar-
                            antee that the file system structure on the disk will
                            remain consistent.  For this reason, the async flag
                            should be used sparingly, and only when some data recov-
                            ery mechanism is present.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • H
          helixxx
          last edited by

          I know it's dangerous, yet I'm only enabling async for a very short period of time while re-enabling the RO mode and I disable it right after (check the code, it's RW+sync to RW+async -> RO+async -> RO+sync). It doesn't stay in async mode.
          Chances of messing up the filesystem should be very slim since I would have to pull the plug during those <10 seconds for that to happen.
          I hope I got this right.

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

            I would very much like to this guy I met, he's called murphy. You'll love him, he has a great sense of humor.

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