ramfs/tmpfs: Linux RAM filesystems
Previously in windows, I uses ramdisk, to accelerate chrome browsing. However, in linux, this is made possible by tmpfs/ramfs already by default.
Also can be specified (according to archwiki)by running:
echo "tmpfs /tmp tmpfs defaults,size=100M 0 0" >> /etc/fstab
Let us use tmpfs by:
mount -t tmpfs -o size=20M tmpfs /dir
Where we can see this dir by df -h command. The /dir lookes like a 'real' disk on our server.
We can use ramfs by:
mount -t ramfs -o size=20M ramfs /dir
After this we can only check this dir as ramfs by:
mount -l | grep dir
Note:
The 2 file sytems are exactly the same except for 2 differences:
1. tmpfs's size option is the maximum size of the dir (starting as 0kb), but ramfs's is the starting size of the dir;
2. ramfs always be on ram, tmpfs might use SWAP area.
The above 2 differences make tmpfs may come across speed problem and ramfs meet with out of ram exception.
un-mount these partitions by:
umount /dir