最近需要使用到 ramfs 和 tmpfs 做記憶體檔案系統,下面對這兩個檔案系統相關的資訊,做一下總結:
參考鏈接:
https://www.thegeekstuff.com/2008/11/overview-of-ramfs-and-tmpfs-on-linux/
https://www.cnblogs.com/dosrun/p/4057112.html
https://www.cnblogs.com/zlhff/p/5436092.html
http://blog.chinaunix.net/uid-375398-id-4096820.html (ramdisk 于 ramfs )
ramfs, tmpfs, rootfs, initramfs的區別
ramfs 和 tmpfs 對比:
| Experimentation | Tmpfs | Ramfs |
|---|---|---|
| Fill maximum space and continue writing | Will display error | Will continue writing |
| Fixed Size | Yes | No |
| Uses Swap | Yes | No |
| Volatile Storage | Yes | Yes |
結論:
- ramfs 因為追求高效和簡單,去掉了容量計數;所以當使用的值超過分配的值的時候,將會繼續使用;
- tmpfs 使用了虛擬記憶體,其會使用swap和記憶體, 其會將一些不必要的檔案內容寫入到swap當中;并且會使用計數,來統計當前使用的容量,并進行容量限制;使用df -h 操作可以顯示其具體使用的容量和可用容量資訊;現在系統中,大多使用 tmpfs 作為記憶體檔案系統;
- ramdisk 是快設備,ramfs 是檔案系統;ramdisk的記憶體空間大小是固定的,一經設定就不能改變大小了;
- tmpfs 帶來了一定的管理機制,但是也是意味著 相對于 ramfs,tmpfs 性能較差一點;不過使用方式上基本相同;
Linux 社區檔案:
https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt
https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt
https://en.wikipedia.org/wiki/Tmpfs (/dev/shm)
ramfs 與 tmpfs 的使用和測驗(沒想到之前也寫過類似的博客,竟然忘記了):
https://www.cnblogs.com/xuyaowen/p/ramfs-tmpfs-test.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/155251.html
標籤:Linux
