Cleaning /tmp on boot

Ask a Question related to FreeBSD, Design and Development.

  1. #1

    Default Cleaning /tmp on boot

    Hi,
    Is there an easy way to have FreeBSD (RELEASE-5.3) clean /tmp on boot
    by means of setting a flag or something in /etc/rc.conf? I'd like to
    check before I start manually hacking up my boot scripts to get this
    done.

    Alternatively, is there something similar to tmpfs from Linux
    available on FreeBSD? I've heard about mfs but it statically
    allocates memory from the VM, I'd prefer if allocation was done only
    as needed on demand.



    --
    Paul Richards
    Paul Richards Guest

  2. Similar Questions and Discussions

    1. Creating a boot diskette that does nothing but boot from hard disk
      Is it possible to create a boot diskette that does nothing more than boot from a specific hard disk? How would I go about doing so? If I can't...
    2. Cleaning
      Dear All, I'm new to all this photography stuff and was wondering if someone could advise me. I noticed that I have got some dust/hair(?) on the...
    3. Cleaning Programs For Use with XP
      I use to use RegClean and Easy Cleaner when I ran Windows 98. Are these safe to use with Windows XP or can you recommend a different cleaner....
    4. Cleaning Lenses
      Hi all, Is there a cleaning solution or cloth you can get to clean lenses? Or is it worth just giving it to the local camera repair man to clean...
    5. Use of DVD-RAM cleaning kit
      Hello, The directions on the IBM DVD-RAM/CD-ROM cleaning kit are for windows. I have looked high-low, and everywhere for AIX usage...Does anyone...
  3. #2

    Default Re: Cleaning /tmp on boot

    On Thu, 24 Feb 2005 12:42:17 +0000, Paul Richards
    <paul.richards@gmail.com> wrote:
    > Hi,
    > Is there an easy way to have FreeBSD (RELEASE-5.3) clean /tmp on boot
    > by means of setting a flag or something in /etc/rc.conf? I'd like to
    > check before I start manually hacking up my boot scripts to get this
    > done.
    I believe it's: clear_tmp_enable="YES"


    Nelis
    Nelis Lamprecht Guest

  4. #3

    Default Re: Cleaning /tmp on boot

    On Thu, Feb 24, 2005 at 12:42:17PM +0000, Paul Richards wrote:
    > Is there an easy way to have FreeBSD (RELEASE-5.3) clean /tmp on boot
    > by means of setting a flag or something in /etc/rc.conf? I'd like to
    > check before I start manually hacking up my boot scripts to get this
    > done.
    Add:

    clear_tmp_enable="YES"

    to /etc/rc.conf. Also consider 'daily_clean_tmps_enable="YES"' in
    /etc/periodic.conf, which will enable a daily job to clean out old
    files from temporary directories.
    > Alternatively, is there something similar to tmpfs from Linux
    > available on FreeBSD? I've heard about mfs but it statically
    > allocates memory from the VM, I'd prefer if allocation was done only
    > as needed on demand.
    Yes -- correct, it is called 'mdmfs' under 5.x -- but it isn't
    necessarily true that it allocates memory out of VM: depending on the
    arguments used when configuring the underlying md(4) device, the
    memory can be swap or file backed. When it's used to provide a /tmp
    filesystem, it is specifically swap backed. As is explained in the
    mdmfs(8) man page. Add the following to /etc/rc.conf to enable using a
    memory filesystem for /tmp:

    tmpmfs="YES"
    tmpsize="128m"

    Note that tmpsize should be smaller than the amount of swap space on
    your machine -- preferably quite a bit smaller -- or you can end up
    with a situation where any user can potentially DoS your server simply
    by creating files under /tmp

    Cheers,

    Matthew

    --
    Dr Matthew J Seaman MA, D.Phil. 8 Dane Court Manor
    School Rd
    PGP: [url]http://www.infracaninophile.co.uk/pgpkey[/url] Tilmanstone
    Tel: +44 1304 617253 Kent, CT14 0JL UK

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.0 (FreeBSD)

    iQCVAwUBQh3SoJr7OpndfbmCAQIOKAP/RFJbM50+/jPZ6kiunMFxWh/fpMYqKR7Y
    VIR0vjScBmAXy2xRnuS3YfOXUh3V1D+zlgQLYmVZXjzFO7qnLr n1npBXgmikT2qZ
    pyohDxFNUwB2sArKuO8lXICIbdnjxy3/6ntMlOh2OoJ1b3Q55vF/8pOrh0xuOfLV
    Es2CRGlPUjc=
    =/Je9
    -----END PGP SIGNATURE-----

    Matthew Seaman Guest

  5. #4

    Default Re: Cleaning /tmp on boot

    On 2005-02-24 14:49, Nelis Lamprecht <nlamprecht@gmail.com> wrote:
    >On Thu, 24 Feb 2005 12:42:17 +0000, Paul Richards
    ><paul.richards@gmail.com> wrote:
    >> Hi,
    >> Is there an easy way to have FreeBSD (RELEASE-5.3) clean /tmp on boot
    >> by means of setting a flag or something in /etc/rc.conf? I'd like to
    >> check before I start manually hacking up my boot scripts to get this
    >> done.
    >
    > I believe it's: clear_tmp_enable="YES"
    True. I'm just replying here to note that this and other tunables of
    the rc.d scripts are documented in rc.conf(5):

    % man rc.conf

    If anyone happens to find an option that is not documented, then it's a
    bug of the manpage and the freebsd-doc people will be glad to hear about
    it; either with a simple post to the list or (preferably) through a new
    problem report submission :-)

    - Giorgos

    Giorgos Keramidas Guest

  6. #5

    Default Re: Cleaning /tmp on boot

    > Alternatively, is there something similar to tmpfs from Linux
    > available on FreeBSD? I've heard about mfs but it statically
    > allocates memory from the VM, I'd prefer if allocation was done only
    > as needed on demand.
    Found these:
    [url]http://docs.freebsd.org/cgi/mid.cgi?41E01905.3040200[/url]
    [url]http://docs.freebsd.org/cgi/mid.cgi?45044.1105365790[/url]

    So swap backed memory disks only swaps to disk when necessary.

    Wish that could have been mentioned in the handbook or man-pages.
    Should I try to PR that? Someone more knowledgeable will do it I hope :-)


    --
    Hilsen Lars


    Lars Kristiansen Guest

  7. #6

    Default Re: Cleaning /tmp on boot

    "Lars Kristiansen" <lars+lister.freebsd@adventuras.no> writes:
    > > Alternatively, is there something similar to tmpfs from Linux
    > > available on FreeBSD? I've heard about mfs but it statically
    > > allocates memory from the VM, I'd prefer if allocation was done only
    > > as needed on demand.
    >
    > Found these:
    > [url]http://docs.freebsd.org/cgi/mid.cgi?41E01905.3040200[/url]
    > [url]http://docs.freebsd.org/cgi/mid.cgi?45044.1105365790[/url]
    >
    > So swap backed memory disks only swaps to disk when necessary.
    >
    > Wish that could have been mentioned in the handbook or man-pages.
    > Should I try to PR that? Someone more knowledgeable will do it I hope :-)
    --- src/share/man/man4/md.4.ORIG Thu Feb 24 11:51:37 2005
    +++ src/share/man/man4/md.4 Thu Feb 24 11:51:51 2005
    @@ -50,7 +50,7 @@
    This allows for mounting ISO images without the tedious
    detour over actual physical media.
    .It Cm swap
    -Backing store is allocated from swap space.
    +Backing store is allocated from virtual memory space.
    .El
    .Pp
    For more information, please see

    Feel free to PR.
    --
    Lowell Gilbert, embedded/networking software engineer, Boston area
    [url]http://be-well.ilk.org/~lowell/[/url]
    Lowell Gilbert Guest

  8. #7

    Default Re: Cleaning /tmp on boot

    Lowell Gilbert skrev:
    >"Lars Kristiansen" <lars+lister.freebsd@adventuras.no> writes:
    >
    >
    >
    >>>Alternatively, is there something similar to tmpfs from Linux
    >>>available on FreeBSD? I've heard about mfs but it statically
    >>>allocates memory from the VM, I'd prefer if allocation was done only
    >>>as needed on demand.
    >>>
    >>>
    >>Found these:
    >>[url]http://docs.freebsd.org/cgi/mid.cgi?41E01905.3040200[/url]
    >>[url]http://docs.freebsd.org/cgi/mid.cgi?45044.1105365790[/url]
    >>
    >>So swap backed memory disks only swaps to disk when necessary.
    >>
    >>Wish that could have been mentioned in the handbook or man-pages.
    >>Should I try to PR that? Someone more knowledgeable will do it I hope :-)
    >>
    >>
    >
    >--- src/share/man/man4/md.4.ORIG Thu Feb 24 11:51:37 2005
    >+++ src/share/man/man4/md.4 Thu Feb 24 11:51:51 2005
    >@@ -50,7 +50,7 @@
    > This allows for mounting ISO images without the tedious
    > detour over actual physical media.
    > .It Cm swap
    >-Backing store is allocated from swap space.
    >+Backing store is allocated from virtual memory space.
    > .El
    > .Pp
    > For more information, please see
    >
    >Feel free to PR.
    >
    >
    Thank you, done. (or tried to)
    [url]http://www.freebsd.org/cgi/query-pr.cgi?pr=78041[/url]


    --
    Still dark.
    Hilsen Lars

    Lars Kristiansen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139