Week 7: TMPFS
Note
It’s faster because RAM is volatile per definition, and all data will be lost in case of powering off the system, so there is no point in implementing back ups.

ramfs vs tmpfsramfstmpfsfree command, cannot be seen with dffree -g
total used free shared buffers cached
Mem: 31 29 2 0 0 8
-/+ buffers/cache: 20 11
Swap: 13 6 7Note
This kind of memory is used by Linux to cache recent files and access them from RAM
tmpfsdisk full error upon going over itdfmount point to anchor the new file systemsudo mkdir -p /mnt/mytmpfs # Create dir
sudo mount -t tmpfs tmpfs /mnt/mytmpfs # Simple tmpfs
sudo mount -t tmpfs -o size=1G,uid=1000,gid=1000,mode=0770 tmpfs /mnt/mytmpfs
# -t tmpfs -> filesystem type
# -o size=<size> -> filesystem size
# -o uid=<user_id> -> owner user id
# -o mode=<mode> -> set fs permissions, i.e. 0770 to make it like `/tmp`
# <name> -> device name
df -h /tmp/myramdisk # See space and usage
sudo umount /mnt/mytmpfs # Unmount fsSee more on the man page
/etc/fstab is a file that tells the Linux system what systems to mount automatically, where and with what options.
tmpfs /mntmytmpfs tmpfs size=1G,uid=alice,,mode=0770 0 0
sudo mount -t tmpfs -o size=1G,uid=amsa,,mode=0770 tmpfs /mnt/mytmpfsIn the first command, last two zeros are dump and fsck, non-specifics
What do we change to make a ram disk automatically mount on boot?
Which is the current used one?
Which of tmpfs or ramfs uses SWAP? Is that bad or good?
What’s the max size of either one of them?
James Coyle blog on tmpfs vs ramfs difference: https://www.jamescoyle.net/knowledge/951-the-difference-between-a-tmpfs-and-ramfs-ram-disk
ramfsvs tmpfs youtube video: https://www.youtube.com/watch?v=WHPD-QL12N4&pp=ygUOcmFtZnMgdnMgdG1wZnPSBwkJ-wkBhyohjO8%3D
Redhat’s docs on mounting a file system: https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/managing_file_systems/mounting-file-systems
Create a swapfile, mount a tmpfs and max out the RAM so that it uses the SWAP. Provide us proof of this happening.
Ready to have some fun? Check out the third AMSA activity here!

AMSA 2025-2026 - 🏠 Home