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

LVL 16
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.