引用 | 編輯
jengyic
2012-03-06 14:41 |
樓主
|
||
x0
原文標題太長貼不進來.全文在 FreeBSD, PC-BSD, Ubuntu, Mint, CentOS, Fedora, OpenSUSE, Debian 上使用 tmpfs 掛載 /tmp http://jengyic.blogspot.com/2012/03/freebsd-pc-bsd-ubuntu-mint-centos.html 首先說明一下, 以下是給懶人專用, RAM Disk 大小都是預設最大到 50% 記憶體. 如果有需要調整空間使用上限或在大型伺服器上實做, 請務必研究一下附件還有 tmpfs. 另外 NetBSD 5, OpenSolaris 及 Indiana 就不用傷腦筋了, 系統預設已經使用 tmpfs(在 NetBSD 使用 mfs) 掛載 /tmp. 由於現代的機器的記憶體基本上都是 GB 等級. 讓記憶體閒著也是一種浪費. 而更重要的原因是不想讓讀寫 /tmp 的動作大量存取 MLC SSD(雖然已經啟動了 TRIM). 再加上 guest VM 常常讀寫, 多跑幾台對 VM host 還是有效能上的影響. 就這樣看著大家的文件跟著做. 也順手將手邊的測試用 guest VM 加上這個簡單的設定. 以下就是實際上在各平台上的設定方式: [[[ FreeBSD 8, PC-BSD 8 & 9 beta ]]] 1. Edit /etc/fstab tmpfs /tmp tmpfs rw 0 0 2. Reboot the machine [[[ Ubuntu 11.X 12.04 LTS, Mint 11 ]]] 1. Edit /etc/init.d/ramtmp.sh #!/bin/sh # RamDisk tmp PATH=/sbin:/bin:/usr/bin:/usr/sbin mkdir /dev/shm/tmp chmod 1777 /dev/shm/tmp mount --bind /dev/shm/tmp /tmp 2. chmod 755 /etc/init.d/ramtmp.sh 3. cd /etc/rcS.d; ln -s /etc/init.d/ramtmp.sh SXXramtmp XX : 必須在所有需要 /tmp 目錄的服務之前. 請注意英文字母排序. 簡單的作法就是在 /etc/rcS.d 下 grep tmp ./* 看有哪些檔案需要 /tmp 目錄. 4. Reboot the machine [[[ CentOS 6, Fedora 15, ScientificLinux 5.6 ]]] 1. Edit /etc/rc.d/init.d/ramtmp #!/bin/bash # chkconfig: 35 80 70 # description: RAMDisk4Tmp # # History: ### 2012/02/25 RamDisk tmp PATH=/sbin:/bin:/usr/bin:/usr/sbin mkdir /dev/shm/tmp chmod 1777 /dev/shm/tmp mount --bind /dev/shm/tmp /tmp 2. chmod 755 /etc/rc.d/init.d/ramtmp 3. chkconfig --add ramtmp 4. Reboot the machine [[[ OpenSUSE 11.4 ]]] 1. Edit /etc/fstab tmpfs /tmp tmpfs defaults 0 0 2. Reboot the machine [[[ Smoothwall express 3.0 sp2 ]]] 1. Edit /etc/fstab none /tmp tmpfs defaults 0 0 2. Reboot the machine [[[ ArchLinux 3.0 ]]] 1. Edit /etc/fstab tmpfs /tmp tmpfs nodev,nosuid 0 0 2. Reboot the machine [[[ Debian 6 ]]] 1. Edit /etc/fstab tmpfs /tmp tmpfs defaults,nodev,nosuid 0 0 2. Reboot the machine [[[ Windows 7 Ultimate, Windows server 2003, Windows XP ]]] 請安裝 Dataram_RAMDisk_V3.5.130R22, 詳細步驟請看參考資料. 參考資料 Reference: FreeBSD : 【FreeBSD】用 tmpmfs 或 tmpfs 建立 Ramdisk Ubuntu : Firefox & Chrome Cache on RAM Drive -Fedora / Ubuntu 在 Ubuntu 將 Firefox 網頁快取檔,設到 Ramdisk 的方法 CentOS : [筆記]Linux Tmpfs 系統加速實作 OpenSUSE : SDB:SSD performance Debian : HOWTO: Using tmpfs for /tmp Windows : [桌面系統]Windows 7 (32bit/64bit) 使用RamDisk 外加ReadyBoost 增加效能 x0
|