By default, Ubuntu uses half of the memory as ramdisk space. The mount point is/dev/shm. The file type tmpfs/dev/shm is not entirely RamDisk. If it uses more than half of the computer's RAM, it will start to eat SWAP. In addition, the unused parts will be automatically released to the system. Using ramdisk, you can place the cache in it, which will prolong the hard disk life and increase the computer speed by 1, modify the size of the/dev/shm directory in the ramdisk operation. 1) view the size.
By default, Ubuntu uses half of the memory as ramdisk space. Mount point:/dev/shm file type: tmpfs
/Dev/shm is not entirely RamDisk. If it uses more than half of the computer's RAM, it will start to eat SWAP. In addition, the unused parts are automatically released for use by the system.
Ramdisk can be used to store the cache, which can prolong the hard disk life and increase the computer speed.
1. Modify the ramdisk operation.
Resize the/dev/shm directory
1) view the size
Df-h/dev/shm
2) modify the size
Vi/etc/fstab
Tmpfs/dev/shm tmpfs ults, size = 4096 M 0 0
The size parameter can also use G as the unit: size = 1G.
Without this line, you can add and modify the size of www.linuxidc.com.
3) remount
Umount/dev/shm
Mount/dev/shm
4) view the modified size
Df-h/dev/shm
2. Set the/tmp directory to RamDisk.
Basically, you only need to run the following command to bind/tmp to/dev/shm.
Mkdir/dev/shm/tmp
Chmod 1777/dev/shm/tmp
Mount -- bind/dev/shm/tmp
※Note: Why is mount -- bind used instead of ln-s soft link? The reason is that the/tmp directory is not deleted.