tmpfs は本当に容量が動的なのか


Linux  tmpfs 便
$ mount -t tmpfs -o size=64m tmpfs /dev/shm
$ mount -t tmpfs -o size=64m /dev/shm /var/tmp

/var/tmp  mount /var/tmp  I/O I/O使 RAM ()

 tmpfs 便 I/O  MySQL  MyISAM  tmpfs 使(OK)

Linux  RAM  tmpfs  ramfs  tmpfs  ramfs 

Google  tmpfs RAM使

tmpfs使RAM使


 ramfs  tmpfs 


2GB ramfs  1.5GB OS使 500MB ramfs

2GB tmpfs  1.5GB OS使 2GBtmpfs  700MB OS使 1.3GB 




Linux JF

If you compare it to ramfs (which was the template to create tmpfs) you gain swapping and limit checking. Another similar thing is the RAM disk (/dev/ram*), which simulates a fixed size hard disk in physical RAM, where you have to create an ordinary filesystem on top. Ramdisks cannot swap and you do not have the possibility to resize them. 
(tmpfs ) ramfs RAM ( /dev/ram ) RAM RAM 


 tmpfs  ramfs tmpfs OS使



tmpfsramfstmpfsramfs


 tmpfs  ramfs ()


tmpfs OSOS


tmpfs  


tmpfs 使OS

tmpfs OS




 tmpfs  tmpfs tmpfs OS

 id:danjou 1GB1GB tmpfs 
$ sudo mount -t tmpfs -o remount,size=1024m tmpfs /dev/shm
$ sudo mount -t tmpfs -o size=1024m /dev/shm /home/danjou/tmp

tmpfsdffree
$ free
             total       used       free     shared    buffers     cached
Mem:       1002952      97600     905352          0       6500      46828
-/+ buffers/cache:      44272     958680
Swap:      2031608          0    2031608

 1GB 使(free) 900 MB tmpfs 
$ df
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
                      35740376   1534852  32360688   5% /
/dev/hda1               101086      9950     85917  11% /boot
/dev/shm               1048576         0   1048576   0% /dev/shm
/dev/shm               1048576         4   1048572   1% /home/danjou/tmp

dftmpfs  mount 使( 4bytes )

dd tmpfs 
$ dd if=/dev/zero of=/home/danjou/tmp/zero count=1024M

 vmstat 1 I/O 
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 0  0      0 903508   6636  47368    0    0     0     0 1008    25  0  0 100  0
 1  0      0 795600   6636 155076    0    0     0     0 1033    36 12 49 38  0
 1  0      0 615304   6636 335016    0    0     0     0 1011    12 21 79  0  0
 1  0      0 435256   6636 514692    0    0     0     0 1027    27 21 79  0  0
 1  0      0 255208   6636 694300    0    0     0     0 1008    11 18 82  0  0
 1  0      0  75532   6636 873636    0    0     0     0 1023    27 23 77  0  0
 0  3   3864  10792   1724 938992    0    0     0    60 1016    84 11 46  0 44
 1  4  55980  10876     64 889272    0  768     0   768 1029   149  0  4  0 96
 1  1 187092  10976     64 759104    0  896     0   896 1011   170  1  5  0 94
 0  3 430128  10872     64 517548    0 1460     0  1460 1033   193  0  6  0 94
 0  4 681312  10680     64 267632    0 1356     0  1356 1014   133  0  5  0 95
 0  2 841800  10420     64 110308    0 19636     0 19636 1037   201  1  7  0 92
 0  4 854548  11168     64 102244    0 74420     0 74420 1016   125  1  7  0 92
 3  2 862244  14152     64  95552    0 50584     0 50584 1047    82  0 65  0 35
 2  2 862452  28720     64  95344    0 4744     0  4744 1017    15  0 100  0  0
 3  1 863100  10916     64 124964    0 14764     0 14764 1035    51  3 97  0  0
 2  1 863676  10916     64 134912    0 10888     0 10888 1024    60  1 99  0  0
 2  2 864076  15008     64 146280    0 9948     0  9948 1018    39  2 98  0  0
 3  2 864276  10792     64 159844    0 5144     0  5144 1033    58  1 99  0  0
 2  2 868280  11388     64 163068    0 61056     0 61056 1025    53  1 99  0  0
 2  3 868860  10396     68 172464    0 1728     4  1728 1021    29  1 99  0  0
 2  3 869484  14268     76 181948    0 4268     8  4268 1045    36  2 98  0  0
 3  2 869968  17876     92 187880    0  956    12   956 1031    25  1 99  0  0
 0  2 869968  16388    100 190704    0    4    40     4 1028    29  0 16  0 84
 0  2 869968  17132    108 190704    0    0     8     0 1021    23  0  0  0 100

tmpfs ddtmpfs 

dd free df
$ df
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
                      35740376   1534856  32360684   5% /
/dev/hda1               101086      9950     85917  11% /boot
/dev/shm               1048576         0   1048576   0% /dev/shm
/dev/shm               1048576   1048576         0 100% /home/danjou/tmp

tmpfs  100% 使
$ free
             total       used       free     shared    buffers     cached
Mem:       1002952     977660      25292          0        336     191648
-/+ buffers/cache:     785676     217276
Swap:      2031608     869968    1161640

free  870MB使ddtmpfs 退
$ sudo umount /home/danjou/tmp
$ free
             total       used       free     shared    buffers     cached
Mem:       1002952     351380     651572          0      13628     273932
-/+ buffers/cache:      63820     939132
Swap:      2031608        856    2030752

 umount  free 




tmpfs OS

tmpfs  @IT 




使

調tmpfs