Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: HOW TO: mount /tmp to ram for increased preformance.

  1. #1
    Join Date
    May 2008
    Beans
    245
    Distro
    Ubuntu Karmic Koala (testing)

    Post HOW TO: mount /tmp to ram for increased preformance.

    If you watch a lot of youtube video's or run a lot of programs that cache to /tmp you will notice that it can be incredibly slow while multi-tasking because the other programs are using the disk too. As long as you have enough ram you can mount /tmp as to your ram. However, use at your own risk - programs that cache backup data to /tmp (Like firefox [although open office does not]) will not be able to restore your previous session after rebooting. If that is no problem then continue on reading.

    Open your /etc/fstab as root in your favourite text editor (I will be using gedit because it is by far the most simple) by launching it from the terminal.
    Code:
    sudo gedit /etc/fstab
    Add this line to the end.
    Code:
    ##RAMDISK##
    none /tmp tmpfs defaults,size=424m 0 0
    You can change the size to whatever amount you want in megabytes but do not go over half of your ram. <Ctrl>+<s> and <Ctrl>+<q>

    Reboot, yes this is needed, you can mount -a but its pointless because then your xserver will crash because the display property will become unset.

    Enjoy much faster website loads!

    Also a tip for youtube users, the video is stores in /tmp so you dont need to use a flash down-loader to save a youtube video - just copy the file to your folder of choice after watching it.

    EDIT*

    The size parameter is optional as I have found out from experience so you might want to use this instead to save RAM!
    Code:
    ##RAMDISK##
    none /tmp tmpfs defaults 0 0
    EDIT**

    Okay I just found out how to do this without rebooting but its not quite as simple. Continue from the last step before rebooting, exit everything, and <ctrl>+<F1>. Enter your username and password. Run these commands.
    Code:
    sudo -i
    gdm stop
    rm -fR /tmp/*
    mount /tmp ##or mount -a
    gdm restart
    EDIT***
    Do not use this trick if you use proprietary types of enterprise software, because they store files in /tmp for security reasons.
    Last edited by modmadmike; October 11th, 2009 at 05:29 AM. Reason: fixed somting pointed out by waster. && added info
    CPU: 4ghz AMD 6 core | RAM: 16gb 1800mhz | HDD: 2*1TB (Striped lvm) 4*30GB SSD (Striped lvm) | Nvidia 9800GTX+ | ASUS Xonar D2X | Marantz 2265B Audio Console With Vacuum Tube Preamps

  2. #2
    Join Date
    Apr 2005
    Location
    UK
    Beans
    148
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    not sure about the value of this (RAM caches disk anyway), but you certainly don't need the 1 and 2 at the end.


    From man /etc/fstab:

    The fifth field, (fs_freq), is used for these filesystems by the dump(8) com‐
    mand to determine which filesystems need to be dumped. If the fifth field is
    not present, a value of zero is returned and dump will assume that the
    filesystem does not need to be dumped.

    The sixth field, (fs_passno), is used by the fsck(8) program to determine the
    order in which filesystem checks are done at reboot time. The root filesys‐
    tem should be specified with a fs_passno of 1, and other filesystems should
    have a fs_passno of 2. Filesystems within a drive will be checked sequen‐
    tially, but filesystems on different drives will be checked at the same time
    to utilize parallelism available in the hardware. If the sixth field is not
    present or zero, a value of zero is returned and fsck will assume that the
    filesystem does not need to be checked.

  3. #3
    Join Date
    May 2008
    Beans
    245
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    oh noes!!!!!!!!!! my /etc/fstab disappeared after using webmin (and looking to update it)!!!!!!!!!!!! better not restart no matter what till I fix this lol!
    CPU: 4ghz AMD 6 core | RAM: 16gb 1800mhz | HDD: 2*1TB (Striped lvm) 4*30GB SSD (Striped lvm) | Nvidia 9800GTX+ | ASUS Xonar D2X | Marantz 2265B Audio Console With Vacuum Tube Preamps

  4. #4
    Join Date
    May 2008
    Beans
    245
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    oh phew I just typed /ect/fstab instead of /etc/fstab rofl
    CPU: 4ghz AMD 6 core | RAM: 16gb 1800mhz | HDD: 2*1TB (Striped lvm) 4*30GB SSD (Striped lvm) | Nvidia 9800GTX+ | ASUS Xonar D2X | Marantz 2265B Audio Console With Vacuum Tube Preamps

  5. #5
    Join Date
    Jun 2006
    Location
    Gothenburg
    Beans
    142
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    Thanks! Works like a charm!
    Ubuntu 7.10

  6. #6
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    Quote Originally Posted by modmadmike View Post
    If you watch a lot of youtube video's or run a lot of programs that cache to /tmp you will notice that it can be incredibly slow while multi-tasking because the other programs are using the disk too. As long as you have enough ram you can mount /tmp as a ramdisk.
    .......
    A tmpfs mount is NOT a "ramdisk" mount. A "ramdisk" is a totally different thing that is set up with a kernel boot parameter and removes a set amount of RAM for use.

    A tmpfs mount will use your Virtual Memory as required, which will be RAM as well as Swap, so in a heavily loaded system it could well be using disk space.

    http://en.wikipedia.org/wiki/TMPFS

    Using /tmp in this manner can certainly improve "performance", but it also can cause issues in things like DVD creation if a temporary image file (~8GB) happens to be created in that folder.....
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  7. #7
    Join Date
    Oct 2005
    Location
    Tucson, AZ
    Beans
    135
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    I am thinking about trying this out, since I have 2gb ram. If I wast to reverse the changes I made, I am assuming I would only have to enter:

    sudo gedit /etc/fstab

    and then delete the following line of code (the code I previously added). Is that correct?

    ##RAMDISK##
    none /tmp tmpfs defaults 0 0
    System76 Lemur running Ubuntu 16.04

  8. #8
    Join Date
    Sep 2006
    Beans
    3,165
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    Quote Originally Posted by Cowchip7 View Post
    I am thinking about trying this out, since I have 2gb ram. If I wast to reverse the changes I made, I am assuming I would only have to enter:

    sudo gedit /etc/fstab

    and then delete the following line of code (the code I previously added). Is that correct?

    ##RAMDISK##
    none /tmp tmpfs defaults 0 0
    Yep

  9. #9
    Join Date
    May 2008
    Beans
    245
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOW TO: mount /tmp to ram for insreased preformance.

    Quote Originally Posted by dcstar View Post
    A tmpfs mount is NOT a "ramdisk" mount. A "ramdisk" is a totally different thing that is set up with a kernel boot parameter and removes a set amount of RAM for use.

    A tmpfs mount will use your Virtual Memory as required, which will be RAM as well as Swap, so in a heavily loaded system it could well be using disk space.

    http://en.wikipedia.org/wiki/TMPFS

    Using /tmp in this manner can certainly improve "performance", but it also can cause issues in things like DVD creation if a temporary image file (~8GB) happens to be created in that folder.....
    Thanks for pointing that out, but at the time it seemed simpler to use the term "ramdisk" lol
    CPU: 4ghz AMD 6 core | RAM: 16gb 1800mhz | HDD: 2*1TB (Striped lvm) 4*30GB SSD (Striped lvm) | Nvidia 9800GTX+ | ASUS Xonar D2X | Marantz 2265B Audio Console With Vacuum Tube Preamps

  10. #10
    Join Date
    Oct 2007
    Location
    Chennai
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOW TO: mount /tmp to ram for increased preformance.

    Quote Originally Posted by modmadmike View Post
    If you watch a lot of youtube video's or run a lot of programs that cache to /tmp you will notice that it can be incredibly slow while multi-tasking because the other programs are using the disk too. As long as you have enough ram you can mount /tmp as to your ram. However, use at your own risk - programs that cache backup data to /tmp (Like firefox [although open office does not]) will not be able to restore your previous session after rebooting. If that is no problem then continue on reading.

    Open your /etc/fstab as root in your favourite text editor (I will be using gedit because it is by far the most simple) by launching it from the terminal.
    Code:
    sudo gedit /etc/fstab
    Add this line to the end.
    Code:
    ##RAMDISK##
    none /tmp tmpfs defaults,size=424m 0 0
    You can change the size to whatever amount you want in megabytes but do not go over half of your ram. <Ctrl>+<s> and <Ctrl>+<q>

    Reboot, yes this is needed, you can mount -a but its pointless because then your xserver will crash because the display property will become unset.

    Enjoy much faster website loads!

    Also a tip for youtube users, the video is stores in /tmp so you dont need to use a flash down-loader to save a youtube video - just copy the file to your folder of choice after watching it.

    EDIT*

    The size parameter is optional as I have found out from experience so you might want to use this instead to save RAM!
    Code:
    ##RAMDISK##
    none /tmp tmpfs defaults 0 0
    EDIT**

    Okay I just found out how to do this without rebooting but its not quite as simple. Continue from the last step before rebooting, exit everything, and <ctrl>+<F1>. Enter your username and password. Run these commands.
    Code:
    sudo -i
    gdm stop
    rm -fR /tmp/*
    mount /tmp ##or mount -a
    gdm restart
    EDIT***
    Do not use this trick if you use proprietary types of enterprise software, because they store files in /tmp for security reasons.
    Thanks

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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