Linux tmpfs file system (basic concept)

Personal blog home page (Click for more details) - https://blog.51cto.com/11495268
personal micro-channel public number (click to see details) - https://blog.51cto.com/11495268/2401194

    

1. Introduction
    ceph bluestore tmpfs file system is mounted, so learning under tmpfs file system; This article describes the basic concept tmpfs file system
 

2, tmpfs basics
2.1 tmpfs introduce
    tmpfs (temporary filesystem) is Linux-specific file system

  • Standard mount point is / dev / shm (also can be customized)
  • The default size is half of the actual memory
  • tmpfs is a separate file system, not a block device, as long as the mount, can be used immediately
         

# 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 features
    temporary: Since tmpfs is built in memory, all the data stored in tmpfs in the power outage will be lost after unloading or
    fast reading and writing skills: memory access speed is much faster than disk I / O operations, even if use the swap, the performance is still unsurpassed
    dynamic contraction: tmpfs started with a very small space, but with the copy and create files, tmpfs file system will allocate more memory, and in accordance with the needs of dynamically increases the file system space; and when tmpfs files are deleted, tmpfs file system will dynamically reduce the file and free up memory resources
    

3, tmpfs mount
3.1 Mounting
3.1.1 Direct mount

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

    

3.1.2 Remount

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

    

3.2 boot from Kai

# 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

Guess you like

Origin blog.51cto.com/11495268/2424414