How to mount /tmp folder as separate filesystem

Backup your

cp -rp /etc/fstab /etc/fstab_old

1. Create 1GB tmpmnt partition file

cd /var
dd if=/dev/zero of=tmpMnt bs=1024 count=1048576

2. Format new partition

mkfs.ext3 -j /var/tmpMnt
Press Y when asked

3. Backup old /tmp

cp -rp /tmp /tmp_old

4. Mount the new /tmp filesystem

mount -o loop,noexec,nosuid,rw /var/tmpMnt /tmp

5. Set the appropriate permissions

chmod 777 /tmp

6. Copy files back to /tmp

cp -rp /tmp_old/* /tmp/

7. Add new /tmp to fstab

echo '/var/tmpMnt /tmp ext3 loop,rw,noexec,nosuid,nodev 0 0' >> /etc/fstab

8. Symlink /var/tmp to /tmp

rm -rf /var/tmp/
ln -s /tmp/ /var/tmp

Similar Posts:

    None Found

Leave a Reply

Your email address will not be published. Required fields are marked *