把記憶體當硬碟用
你希望有個資料夾可以關機之後就徹底清除嗎?
你感覺某個檔案在硬碟裡的執行速度還是不夠快嗎?
這時候你可以啟用ramdisk
修改檔案系統表
已root權限打開這個設定檔
/etc/fstab
裡頭長這樣
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb7 during installation
UUID=beaf8a82-1495-478f-b85f-951a4670f4d1 / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb6 during installation
UUID=a773e6bc-3536-4dfc-9e4c-b2128d50feb4 none swap sw 0 0
然後假設我們要產生一個50MB的資料夾在/mnt/happyDir
我們可以在行這個設定檔裡頭加上這後
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb7 during installation
UUID=beaf8a82-1495-478f-b85f-951a4670f4d1 / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb6 during installation
UUID=a773e6bc-3536-4dfc-9e4c-b2128d50feb4 none swap sw 0 0
# 將/mnt/happyDir 掛載到 tmpfs
tmpfs /mnt/happyDir tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=50M 0 0
然後測試看看輸入
sudo mount -a
如果沒有報錯就成功了 報錯就改回來~