Increase the size of /tmp (/usr/tmpDSK) partition in Linux?
How to increase the size of /tmp partition in Linux?
Proceed with the given steps:-
========================
1) Stop httpd and mysqld service and process kill the tailwatchd process (CPanel uses this).
Stopping MySQL: [ OK ]
[root@antg ~]# /etc/init.d/httpd stop
Stopping httpd: [ OK ]
[root@antg ~]# pstree -p | grep tailwatchd
Find the tailwatchd process id and kill it
[root@antg ~]# kill -9 2522
2) Take a backup of /tmp as /tmp.bak
3) Create a 2GB file in the avaliable freespace
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 73.6908 seconds, 29.1 MB/s
[root@antg ~]# du -sch /usr/tmpDSK
2.1G /usr/tmpDSK
2.1G total
4) Assign ext3 filesystem to the file
mke2fs 1.39 (29-May-2006)
/usr/tmpDSK is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
262144 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5) Check the file system type:-
/usr/tmpDSK: Linux rev 1.0 ext3 filesystem data (large files)
Note:-
You may also use the following comands for making ext3 file system on a file:
[root@antg ~]# mke2fs /usr/tmpDSK
6) Unmount /tmp partition
7) Mount the new /tmp filesystem with noexec
8) Set the correct permission for /tmp
[root@antg ~]# ls -ld /tmp
drwxrwxrwt 3 root root 4096 Feb 6 08:42 /tmp
( you may use the command chmod 1777 /tmp for doing the same )
Filesystem Size Used Avail Use% Mounted on
/dev/sda9 28G 6.4G 20G 25% /
/dev/sda8 99M 10M 84M 11% /boot
tmpfs 500M 0 500M 0% /dev/shm
/usr/tmpDSK 2.0G 68M 1.9G 4% /tmp
7)Restore the content of old /tmp.bkp directory
8) Restart the mysql or mysqld and tailwathchd service (if you have CPanel installed).
[root@antg ~]# /etc/init.d/httpd start
[root@antg ~]# /scripts/restartsrv_tailwatchd
9)Edit the fstab and replace /tmp entry line with :-
10) Mount all filesystems
Check it now:-
[root@antg ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda9 28G 6.4G 20G 25% /
/dev/sda8 99M 10M 84M 11% /boot
tmpfs 500M 0 500M 0% /dev/shm
/usr/tmpDSK 2.0G 68M 1.9G 4% /tmp
Done.
Awesome
Thank you. Its very good tutorial.
amazing article
Hi donie
Thank you for sharing this really good article. This worked fine on my case.
For your information:
When un-mounting the /tmp it generates the error: (umount: /tmp: device is busy)
I used (umount -l /tmp ) command instead of umount /tmp .
Thanks
Chamantha