How to increase /tmp partition size
On a Linux server /tmp partition was only 1 GB, it get full at times.
Server had following in its /etc/fstab file
1 2 3 4 5 |
[root@imeicheck-2020 ~]# cat /etc/fstab UUID=c0f46bb1-c0bc-4199-95d6-551d03c12a0a / xfs defaults 1 1 /var/.tempdisk /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0 /tmp /var/tmp none bind 0 0 [root@imeicheck-2020 ~]# |
Currenly file /var/.tempdisk is mounted as /tmp.
So i created a new file with 4 GB size
1 |
dd if=/dev/zero of=/var/sok_tmp bs=1M count=4096 |
Format it as ext4 file system
1 |
mkfs -t ext4 /var/sok_tmp |
Before i swith /tmp to newly created disk, i need to copy content of current /tmp to it. For this i mount the new disk as /tmp2
1 2 3 |
mkdir /tmp2 mount -o loop /var/sok_tmp /tmp2 rsync -avzP /tmp/ /tmp2/ |
Now you have all files of /tmp in /tmp2, edit /etc/fstab
1 |
vi /etc/fstab |
Find entry for current /tmp partition
1 |
/var/.tempdisk /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0 |
Replace it with new file you created
1 |
/var/sok_tmp /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0 |
Reboot the server. You will have 4 GB /tmp partition now.