Now Hiring: Are you a driven and motivated 1st Line IT Support Engineer?

Blog

Linux服务器上使用物理内存作为硬盘分区挂载

Linux服务器上使用物理内存作为硬盘分区挂载

Linux服务器上使用物理内存作为硬盘分区挂载

把内存当硬盘使用的好处是读写速度更快
普遍的内存读写速度是硬盘的100倍

如果你的服务器内存够大
使用不完的话,可以考虑这样做
这种分区一般作为交换分区使用,需要临时读写大量文件或者小文件的
密集型读写的用途

使用教程

新建目录

root@hostsoft1:~# mkdir -p /tmp/ram
root@hostsoft1:~# ls /tmp/ram
root@hostsoft1:~#

挂载内存的文件系统到/tmp/ram目录

mount -t tmpfs -o size=10M tmpfs /tmp/ram/

检查是否挂载上了

df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 10M 0 10M 0% /tmp/ram

下面我们在添加到开机启动,开机自动挂载

vi /etc/fstab
tmpfs /tmp/ram tmpfs defaults,size=10m 0 0

最后加上 后面这句

mount -a

查看全部挂载的分区
应该可以看到ram的分区
现在开始享受高速度的硬盘读写速度吧
哈哈……….

转载请保留www.idcsoft.net的本文章链接 大家尊重原创

相关:

  • linux

Leave your thought here

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare