zoukankan      html  css  js  c++  java
  • liunx 内存文件 tmpfs

    tmpfs是Linux/Unix系统上的一种基于内存的文件系统。tmpfs可以使用您的内存或swap分区来存储文件

    tmpfs默认情况下会mount到/dev/shm目录下

    1 创建将被挂载的文件

    mkdir /tmp/tmpfs/

    2 写入测试文件内容。大小2G

    dd if=/dev/zero of=/tmp/tmpfs/testfile bs=1G count=2
    记录了2+0 的读入
    记录了2+0 的写出
    2147483648字节(2.1 GB)已复制,16.4153 秒,131 MB/秒

    3 挂载测试目录,限制大小为2G ,注意挂载的是文件目录

     mount tmpfs /tmp/tmpfs/ -t tmpfs -o size=2G

    4 挂载前后对比

    root@ubuntu:/tmp# free -g
                 total       used       free     shared    buffers     cached
    Mem:            15         11          4          2          0          2
    -/+ buffers/cache:          8          7
    Swap:            7          0          7
    
    mount tmpfs /tmp/tmpfs/ -t tmpfs -o size=2G
    
    root@ubuntu:/tmp# free -g
                 total       used       free     shared    buffers     cached
    Mem:            15          9          6          0          0          0
    -/+ buffers/cache:          8          7
    Swap:            7          0          7

    5 卸载 unmout

    umount /tmp/tmpfs/
  • 相关阅读:
    IEnumerator & IEnumerable
    GameObject.Active
    Unity3D的四种坐标系
    gvim
    Platform Dependent Compilation
    delegate
    new 约束
    UIPanel
    UIButton
    UISprite
  • 原文地址:https://www.cnblogs.com/zhangeamon/p/5457432.html
Copyright © 2011-2022 走看看