Create Ram disk and share over SMB

  • Hi
    My OMV NAS has plenty of RAM available.
    So I wonder, is it possible to set aside a part of free RAM into a tmpfs disk and share it over SMB/CIFS?
    Just so you know, I have already achieved this on one of my ubuntu-server which is working great.

    The reason why I'm not thinking to apply that same procedure on OMV is because for e.g. fstab and samba configurations are better handled through its web admin-interface.
    Therefore, I would appreciate a similar sophisticated solution through GUI.
    Or Is there any plugin for that as I couldn't find one?

    In case, it is not possible with GUI, then how can I instruct OMV not to overwrite my manually set configs?


    • Official Post

    In case, it is not possible with GUI, then how can I instruct OMV not to overwrite my manually set configs?

    It is kind of possible using the web interface but the setup would require CLI. You would need to create a directory and then add a tmpfs entry to /etc/fstab outside of the OMV tags. Then mount it and in the extra options box on the samba plugin's settings tab, you would need to add a complete samba share entry. This would make the changes persist other samba changes and it does work (I've done it for other types of shares but not tmpfs).

    omv 6.9.0-1 Shaitan | 64 bit | 6.2 proxmox kernel

    plugins :: omvextrasorg 6.3.1 | kvm 6.2.16 | compose 6.10.3 | cputemp 6.1.3 | mergerfs 6.3.7 plugins source code and issue tracker - github

    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Thanks for the tips.
    I added a tmpfs entry (line#16) in fstab and the file looks as below:

    And when I df -h in console, I can see the RamDrive (line#9) mounted correctly:

    However, under web-admin -> File Systems I cannot find the option to mount the RamDrive. It is not listed there.

    Am I doing anything wrong at this point?

  • Possibly related: but what do you want to achieve with this approach of sharing a RAM disk? OMV is about NAS so we're talking about network access. Isn't this already the bottleneck for spinning rust or is your OMV box equipped with 40GbE or better?

    I wanted to to have a storage location which is not bind to any physical disk, so that I can transact some trivial data without waking the drives.
    One use case scenario is surveillance camera video files that are constantly written to ram disk and in parallel sync on to a cloud storage (and removed afterwards).

  • Thanks @ryecoaaron, now I understand what you mean by using the extra options of SMB/CIFS.
    I've added the following in the SMB/CIFS -> Setup (Advanced settings) and it worked as expected.

    comment = All the data will be erased itself once the host is restarted.
    path = /mnt/RamDrive
    browseable = yes
    create mask = 0775
    directory mask = 0775
    guest ok = yes
    read only = no

    Now I can find RamDrive as a samba share in Windows and it's working great. :)

  • Interesting use case... As @ryecoaaron explained you won't see this mountpoint anywhere in the OMV UI but need to create Samba share definition manually and then add it to the Samba module's global options. Kind of a hack but this will ensure that your added share definition will be transferred by OMV to smb.conf and doesn't get in conflict with other OMV settings.

    OK, you figured it out in the meantime yourself :)

  • Not for the @waqaslam use case with already highly compressed data but for other users stumbling across this thread... using a compressed zram device instead of tmpfs can be a great idea to store stuff that compresses good (e.g. text or log files -- they easily shrink to 1/10). But then you need some scripting to set up the zram device at boot. As an idea see this function we use on the ARM OMV images to optionally use compressed /tmp:…bian-zram-config#L96-L114

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!