Linux tmpfs 文件系统(基础概念)

我的博客首页(点击查看 详情) -- https://blog.51cto.com/11495268
我的微信公众号(点击查看详情) -- https://blog.51cto.com/11495268/2401194

    微信

一、简介
    ceph bluestore 挂载的 就是 tmpfs 文件系统,因此 学习 下 tmpfs 文件系统;本文 描述 tmpfs 文件系统 基础概念
 ide

二、tmpfs 基础知识
2.1 tmpfs 介绍
    tmpfs(temporary filesystem)是Linux特有的文件系统性能

  • 标准挂载点是/dev/shm(也能够自定义)
  • 默认大小是实际内存的一半
  • tmpfs是一个独立的文件系统,不是块设备,只要挂载,就能够当即使用
         
# free -h
              total        used        free      shared  buff/cache   available
Mem:            31G        8.5G         22G         33M        654M         22G
Swap:           15G        4.0M         15G

# df -h 
Filesystem                   Size  Used Avail Use% Mounted on
tmpfs                         16G   24K   16G   1% /var/lib/ceph/osd/ceph-4
tmpfs                         16G   24K   16G   1% /var/lib/ceph/osd/ceph-2
tmpfs                         16G   24K   16G   1% /var/lib/ceph/osd/ceph-0
... ...

    

2.2 tmpfs 特色
    临时性:因为tmpfs是构建在内存中的,存放在 tmpfs 中的全部数据在卸载或断电后都会丢失
    快速读写能力:内存的访问速度要远快于磁盘I/O操做,即便使用了swap,性能仍然很是卓越
    动态收缩:tmpfs一开始使用很小的空间,但随着文件的复制和建立,tmpfs文件系统会分配更多的内存,并按照需求动态地增长文件系统的空间;并且 tmpfs中的文件被删除时,tmpfs文件系统会动态地减少文件并释放内存资源
    学习

三、tmpfs 挂载
3.1 挂载
3.1.1 直接 挂载this

# mount -t tmpfs -o size={size} tmpfs {mount_point}

    

3.1.2 从新 挂载code

# mount -t tmpfs -o remount tmpfs {mount_point}

    

3.2 开机 自启orm

# cat /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/sda3 during installation
tmpfs                   /tmp    tmpfs   defaults,size=25M        0 0
相关文章
相关标签/搜索