How to increase your /tmp partition size

The /tmp directory is just a directory. Most people who install Ubuntu do so by setting up one big partition, so /tmp doesn't really have a fixed size limit, aside from the size of the main Ubuntu installation. It is possible, though, to set up /tmp on a separate partition, and if that's how your system is configured, /tmp will have a separate fixed size. To know what you've got, you should look at the output of "df -h". This will produce something like this:

Run
[email protected]:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           20G   11G  8.0G  57% /
/dev/root        20G   11G  8.0G  57% /
none            3.2G  256K  3.2G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none             16G     0   16G   0% /run/shm
/dev/md3         92G   11G   77G  12% /home
overflow         10M   52K   10M   1% /tmp

If you see a separate entry for /tmp, then you've got a separate /tmp partition; but if there's no separate entry for /tmp, it's just part of your main root (/) filesystem.
If you've got a separate /tmp partition, then you have just three choices for increasing its size:

  • Use a partition resizing tool, such as GParted, to increase the size of the /tmp partition. You'll almost certainly have to decrease the size of another partition to do this. You may need to shut down and do this job from an emergency disc, depending on the layout.
  • Stop using the /tmp partition, which will then cause the system to use space on the root filesystem for /tmp. You could optionally delete the /tmp partition and increase the size of the partition(s) around it, if you like. To do this, you must comment out or delete the entry for /tmp in /etc/fstab and reboot. (Actually, it can be done without rebooting, but it's easier to describe how to do it with a reboot.)
  • Stop using the /tmp partition, and create a symbolic link to temporary space elsewhere. This is just like the previous option, but you'd remove the /tmp directory and replace it with a symbolic link to a new temporary space directory on another (non-root) partition. This involves jumping through another hoop or two to set up.

Above source from Ubuntu Forum:

Now let's talk about how to increase the partition size in few steps:

Note : try with sudo if you only have sudo permissions

Step 1: Unmount the /tmp partition 

umount /tmp

In this case I've got these erros:

umount: /tmp: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
So the fix is really simple, check who is using the temp, run lsof | grep /tmp and stop all the programs that are using /tmp directory.
Step 2: Mount a new partition with bigger size (10485760 = 10MB)
mount -t tmpfs -o size=10485760,mode=1777 overflow /tmp
Done!
Tags: