• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2330
  • Last Modified:

Increase tmp space

I frequently find my server runs out of /tmp/ space and /var/temp/ space.  

This causes lots of problems, like this, when a simple query is run on a 3 gig database:
                            MySQL said:  
                            #3 - Error writing file '/tmp/MYMQtOBo' (Errcode: 28)

How can I increase the available tmp space by at least 3 gigs?

I use CentOS 4.5, and I also have Cpanel/WHM installed.
dev/sdb5             10317828    767396   9026316   8% /
/dev/sdb1               101086     30267     65600  32% /boot
none                   1037156         0   1037156   0% /dev/shm
/dev/sdc1            241083332     94284 228742704   1% /disk2
/dev/sdb7            206927892  35177592 161238976  18% /home
/dev/sdb8              1035660   1034700         0 100% /tmp
/dev/sdb3             10317860   4532016   5261724  47% /usr
/dev/sdb2             10317860   2074264   7719476  22% /var
/tmp                   1035660   1034700         0 100% /var/tmp

Open in new window

2 Solutions
If you are using LVM to handle your logical partitions you can add space with the lvextend command.

You can check your partition space with the command:
   df -h

You can use pvscan to show you what physical volumes you have available.

Then to actually extend the partition you can use:
  lvextend +1G  /dev/sdb8

Then to actually make the space available to the file system (assuming you have an ext type file system):
  ext2online /dev/sb8

You may want to check out this link before you begin.  http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html
It looks like you took a specific partition mounted it on /var and then mapped the path /tmp to /var/tmp.

It doesnt appear that the /tmp mount on /var/tmp is working correctly as your readout is showing /tmp at 100% full which is false if the mount happened correctly since /var/ is only 22% full  it should be showing you available space

Mind you I would do this the opposite way you have, I would mount and actual disk partition as /tmp and then map /var/tmp there.

The first thing you need to do is make sure the mount is working the way you think it should.

It may be that /tmp doesnt actually exist according to the filesystem and thats why you are getting your error.

In the mean time, to answer your question of how you get more /tmp space....

After a FULL backup in single user mode (you dont want users connecting to the box during this time.)

repartition the drive so that your tmp partition is larger

restore from backup, and go back to multiuser.

Add a small drive to the system and partition that, and then remount /tmp on that drive.

You might still want to work on A) though if you do this so that what was /tmp can be used for something else.

C)  Use LVM to mount partitions other than /boot  LVM makes it very easy later to add disks and use the space the way you need to.


Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now