Sunday, October 16, 2011

How to resize/recreate /tmp parition in linux

Today I am going to explain about how to resize/recreate /temp partition in Linux. Why you need it? Many software like MySQL writes temporary files in /tmp partition and if /tmp is of less space then sometimes software are unable to function properly. Following are the steps I use to fix this problem:

  1. umount -l /tmp
  2. dd if=/dev/zero of=/usr/tmpDSK bs=1024 count=512000
  3. mkfs.ext3 /usr/tmpDSK
Then mount this to /tmp
  1.     mount -o loop,rw,noexec,nosuid /usr/tmpDSK /tmp
Now new /tmp partition is created by you may have to give proper permission to your applications to this new /tmp directory. In my case I had to give permission to MySQL and achieved using following commands;
  1. usermod -G mysql /tmp
  2. chmod 0770 -R /tmp
 That's it and you are done with it.