# [solved] how do I use part of ram as /tmp

## logical_guy

Hi guys, I've got 4 gigs of RAM on my laptop, and i want to use maybe one gig as /tmp partition to speed up emerging and compiling things, etc.  Any ideas on ow to proceed?  Thanks.Last edited by logical_guy on Mon Aug 15, 2011 3:55 pm; edited 1 time in total

----------

## asturm

temp storage during compilation is /var/tmp/portage, however it is also not a bad idea to have /tmp in RAM.

This is what I have in my fstab:

```
# grep tmpfs /etc/fstab

tmp_ram                 /tmp                    tmpfs           size=1024M      0 0

portage_ram             /var/tmp/portage        tmpfs           size=3052M      0 0
```

You also need to have tmpfs enabled in kernel:

```
# grep TMPFS /usr/src/linux/.config

CONFIG_DEVTMPFS=y

CONFIG_DEVTMPFS_MOUNT=y

CONFIG_TMPFS=y
```

----------

## rh1

Well unless you chage it, portage compiles stuff in /var/tmp

All you need is to add an entry to /etc/fstab like this

```

tmpfs     /tmp     tmpfs     rw,size=10g,mode=1777   0 0

```

You could change it to /var/tmp, personally I just link /var/tmp to /tmp on my system. Of course, adjust the size to whatever you want. The mode is to insure proper permissions for /tmp. Then though you could mount it over top of whatever is there I recommend just rebooting.

Edit:Darn it, genstorm beat me

----------

## tclover

If you want to mount a tmpfs based /tmp you can simply run `mount -t tmpfs -o size=1024m tmp /tmp` and you're all set. If its for portage temporary directory it's default value/location is `/var/tmp/portage' so you can replace /tmp by /var/tmp/portage above to speed your compilations. Note that {Libre,Open}Office or even GCC and probably Chromium etc. may require much more space to compile. You can find several threads on the forums for similar usages.

EDIT: couldn't you have waited my post before posting anything?!

----------

## logical_guy

 *genstorm wrote:*   

> temp storage during compilation is /var/tmp/portage, however it is also not a bad idea to have /tmp in RAM.
> 
> This is what I have in my fstab:
> 
> ```
> ...

 

So how much RAM have you got on your computer?

----------

## m0p

Consider checking out zram under staging drivers in kernel 3.0.0+ (there's patches for older kernels as well).

----------

## asturm

 *logical_guy wrote:*   

>  *genstorm wrote:*   temp storage during compilation is /var/tmp/portage, however it is also not a bad idea to have /tmp in RAM.
> 
> This is what I have in my fstab:
> 
> ```
> ...

 

4 GB  :Wink: 

----------

## logical_guy

 *genstorm wrote:*   

>  *logical_guy wrote:*    *genstorm wrote:*   temp storage during compilation is /var/tmp/portage, however it is also not a bad idea to have /tmp in RAM.
> 
> This is what I have in my fstab:
> 
> ```
> ...

 

Okay, so I don't get it.. here, are you using ALL of your ram for tmp_ram and portage_ram??

----------

## djdunn

I have my machine set up to use more than my available ram when i compile because i need more ram to compile certain programs than I currently have, because of how memory management is done on Linux when that happens it begins to use swap space, which is slower than compiling in ram but basically no slower than a normal compile.

----------

## fuzzykiller

 *logical_guy wrote:*   

> Okay, so I don't get it.. here, are you using ALL of your ram for tmp_ram and portage_ram??

 

tmpfs doesn't use the whole memory all the time. If the whole filesystem is free, very little memory is used. Only space occupied by files is actually used from your RAM.

----------

## logical_guy

Thanks, guys, for the tips.  Got /tmp and /var/tmp in tmpfs now and portage installs are just zipping through!!

----------

## saverik1967

Sorry, but can someone  write the right step by step...

sorry but i am very newbie..

i have  enabled tmpfs in kernel...

thanks

----------

## jormartr

You don not need anything else than the line in the fstab, like in the second post.

----------

