Wednesday, January 27, 2010

HowTo: Increase /tmp partition size

How to increase /tmp partition? In case your server isn’t built with a /tmp partition OR you need to increase the disk space of the partition for some reason, you will have to create a virtual partition and have to mount it on /tmp.

The following steps will guide you to create a virtual partition:

1) To create a partition of 2GB, use the below dd command:

dd if=/dev/zero of=/home/tmp-dir bs=1024M count=2

2) Once the partition is created, you need to create the file system on it using the mke2fs command

mke2fs -j /home/tmp-dir

3) Now, the partition is ready to be used but you need to mount it on /tmp directory.

mount -t ext3 -o loop /home/tmp-dir /tmp

Here, we have used ‘loop’ while mounting /home/tmp-dir partition because we are not mounting an actual block device but to make a file accessible as a block device.

4) To verify the partition, execute

mount

5) To make sure this partition is mounted automatically after every reboot, edit the /etc/fstab file and replace the /tmp line with the following one:

/home/tmp-dir /tmp ext3 defaults,loop 0 0

Hope, this helps.

No comments:

Post a Comment