Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Preventing multiple instances

by Bod (Chaplain)
on Dec 17, 2020 at 23:07 UTC ( #11125375=note: print w/replies, xml ) Need Help??


in reply to Re: Preventing multiple instances
in thread Preventing multiple instances

Add the following line to the bottom of your /etc/fstab file (you'll need sudo to do this):
tmpfs /var/memdir tmpfs nodev,nosuid,size=1M 0 0

This is a very interesting approach!
Can you explain why you chose /var/memdir and not /tmp/memdir as it by its very nature temporary.

Also, any reason to set the number of blocks to zero?

Does the /etc/fstab contain all the information about the entire file systems?

Replies are listed 'Best First'.
Re^3: Preventing multiple instances
by afoken (Canon) on Dec 18, 2020 at 00:27 UTC

    Also, any reason to set the number of blocks to zero?

    Does the /etc/fstab contain all the information about the entire file systems?

    fstab(5)

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      Thanks for the link afoken but it only answers one of my three questions...no, not the entire system is defined there but most of it is.

      Can you explain why you chose /var/memdir and not /tmp/memdir as it is by its very nature temporary.

      I'm guessing this is a design decision, not something that is going to be explained in the documentation.

      Also, any reason to set the number of blocks to zero?

      This documentation doesn't cover the size=1M 0 0 parameter and I cannot find reference to it in the links. I asked because when I looked up what these parameters do I found advice that "It is generally unwise to mount with such options" in this article.

        Can you explain why you chose /var/memdir and not /tmp/memdir as it is by its very nature temporary.

        I'm guessing this is a design decision, not something that is going to be explained in the documentation.

        /tmp is often already on a ramdisk-like virtual filesystem, e.g. tmpfs. If not, some boot script cleans up tmp. So /tmp/memdir is gone after a reboot. /var is on persistent storage, so /var/memdir will survive a reboot.

        Also, any reason to set the number of blocks to zero?

        This documentation doesn't cover the size=1M 0 0 parameter and I cannot find reference to it in the links. I asked because when I looked up what these parameters do I found advice that "It is generally unwise to mount with such options" in this article.

        /etc/fstab is structured, six fields separated by whitespace. This implies that no field can contain whitespace. The fields are (in order):

        1. fs_spec (roughly the device to be mounted)
        2. fs_file (the mount point)
        3. fs_vfstype (filesystem type
        4. fs_mntops (mount options for the filesystem)
        5. fs_freq ("This field is used by dump(8) to determine which filesystems need to be dumped. Defaults to zero (don't dump) if not present.")
        6. fs_passno (used to select the order for fsck at boot. / should have 1, others 2, 0 disables fsck at boot)

        "size=1M" is part of the mount options in field 4, the two zeros after that are fields 5 and 6.

        stevieb proposed to add this to fstab:

        tmpfs /var/memdir tmpfs nodev,nosuid,size=1M 0 0

        Split at whitespace and compare with the field descriptions.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11125375]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2021-05-12 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (124 votes). Check out past polls.

    Notices?