广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 41356 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
jengyic
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x0 鲜花 x0
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[FreeBSD][转载] 在 FreeBSD, PC-BSD, Ubuntu, CentOS, OpenSUSE 上使用 tmpfs 挂载 /tm
原文标题太长贴不进来.
全文在 FreeBSD, PC-BSD, Ubuntu, Mint, CentOS, Fedora, OpenSUSE, Debian 上使用 tmpfs 挂载 /tmp
http://jengyic.blogspot.com/2012/03/fre...-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 回到顶端 [楼 主] From:台湾中华电信股份有限公司 | Posted:2012-03-06 14:41 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.018739 second(s),query:15 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言