+1 vote

/tmp partition full…

How to increase /tmp partition? 

asked by (6k points)

1 Answer

+1 vote

You can create a Virtual partition on Linux 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, and then you can mount the virtual partition as /tmp.

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

1) Tocreate 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 thispartition 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

answered by (6k points)
...