RAM Disk enabled, but still constant writes to disk…



  • Hi everyone.

    I'm running 2.4.3-RELEASE (latest at the time of this writing) on HyperV.  It's a plain vanilla install with no plugins or additional packages – essentially just out of the box config with a few NAT rules.  I recently attempted to enable RAM Disk in the settings like so:

    I've rebooted several times, and I can confirm I can see "/tmp" and "/var" on the main page dashboard under "Disk Usage", however I still see almost constant writes to disk, according to the Hypervisor.  Even when I'm not logged in to the console or web admin pages, I'm still seeing constant writes:

    I should also note that disk usage reported on the dashboard for /tmp is always 0%.

    Is this a bug?  Am I missing something?


  • Rebel Alliance Developer Netgate

    How much RAM/Swap do you have on that VM? Maybe it's swapping to disk because it doesn't have enough RAM.

    You can check programs doing disk i/o with utilities at the shell, like "top -am io"



  • Thanks for the reply.

    I gave this VM 2GB of RAM, which I figured was probably more than enough.  Here's a shot from the dashboard:

    I ran the top command you suggested and watched it for a bit.  I didn't see anything that seemed out of the ordinary, and I never once saw anything but 0s in the "Read' or "Write" columns.  The list jumped around a lot, but here's a screenshot from a random point in time:

    Looks pretty normal but it's quite possible I don't know what I'm looking at.

    Any other suggestions?



  • Edit: The post is incorrect, see below.

    What filesystem is your pfSense box?
    If you picked ZFS it's probably always writing out to the journal.



  • Interesting thought, but it looks like I'm using UFS:

    
    [2.4.3-RELEASE][admin@pfSense]/root: df -T
    Filesystem                   Type  1K-blocks   Used    Avail Capacity  Mounted on
    /dev/ufsid/59877dae5429c116  ufs    16226924 830328 14098444     6%    /
    devfs                        devfs         1      1        0   100%    /dev
    /dev/md0                     ufs       98716    172    90648     0%    /tmp
    /dev/md1                     ufs       98716  18744    72076    21%    /var
    devfs                        devfs         1      1        0   100%    /var/dhcpd/dev
    
    


  • @muppet:

    What filesystem is your pfSense box?
    If you picked ZFS it's probably always writing out to the journal.

    Completely untrue. The so called "journal" (ZIL aka ZFS intent log)  is used only when synchronous writes are requested by an application. Afaik there's very little on a standard pfSense install that would request synchronous writes, most likely nothing.



  • Update: I was searching for old threads about issues with RAM Disk and I found one where jimp suggested using a slightly different top command: "top -aSH -m io -o total".  I tried running this, and with this one I noticed every couple of seconds, I saw [syncer] jump to the top of the list, with some actual writes:

    So, hmm… I'm guessing [syncer] is a process that actually performs writes that are queued up to disk.  But I figured if I had RAM Disk set, it would be syncing to the ramdisk and not to /.  But that doesn't seem to be what's happening…


  • Rebel Alliance Developer Netgate

    The "100%" in that output can be misleading. It means that of all the writes happening in that moment, 100% are being performed by that process. It doesn't mean that it's using 100% of the disk write capability.

    RAM disks being enabled means that anything writing to /var or /tmp is writing to a RAM disk, not permanent storage. There could still be other unrelated writes happening not to /tmp and /var, however.



  • Thanks, that makes sense.  Any idea how to check what it is writing so frequently to disk outside of /tmp and /var?  I SSH'd in and I ran the following command at / to sort all files by last modified time:

    find . -print0 | xargs -0 -n 100 stat -f"%m %Sm %N" | sort -n|awk '{$1="";print}'
    

    I see a bunch of writes to stuff in /tmp and /var, but the most recent write I see outside of there was almost 25 minutes beforehand (on the hour, when /tmp and /var got flushed to disk).  Still, Hyper-V reports nearly constant writes.  I've got several Linux VMs on the same box running at the same time, but pfSense is always at the top of the list for disk writes.  Very strange.