Sie sind auf Seite 1von 5

3/21/2015

RedHat iTOps: Overview of RAMFS and TMPFS on Linux

RedHat iTOps
iTOps Home

iTOpsTube
Portal

RedHat

Basics

RHCSA

Networking

RedHatiTOpsTube

RedHatRecentUpdates
2012(578)

Ubuntu
Itops

December(7)
PopularSearches

June(25)

MyContent

Fedora
Itops

May(180)

RedHatiTOps

RedHat
Itops
MacItops
UnixItops

February(66)
Feb23(13)

Tuesday,February21,2012

OverviewofRAMFSandTMPFSonLinux

Linux
ITOPS
SUSE
Linux
Itops

Feb21(16)
WOL
Wakeonl
an
Guide:
TurnOn
Servers
Remotely
With...
The
Evolution
and
Futureof
Communi
cation
Technolo
...

Debian
iTOps
Core
iTOps
Tube
windows
Itops

April(300)

Usingramfsortmpfsyoucanallocatepartofthephysicalmemorytobeusedasa

http://www.redhat.itopstube.com/2012/02/overview-of-ramfs-and-tmpfs-on-linux.html

3Stepsto
Perform
SSH
Login
Without
Passwor
1/8

3/21/2015

RedHat iTOps: Overview of RAMFS and TMPFS on Linux

partition.Youcanmountthispartitionandstartwritingandreadingfileslikeaharddisk
Total
Pageviews
on
redhat.itops
tube.com

partition.SinceyoullbereadingandwritingtotheRAM,itwillbefaster.

51,307

Bothtmpfsandramfsmountwillgiveyouthepoweroffastreadingandwritingfilesfrom

Whenavitalprocessbecomesdrasticallyslowbecauseofdiskwrites,youcanchoose
eitherramfsortmpfsfilesystemsforwritingfilestotheRAM.

andtotheprimarymemory.Whenyoutestthisonasmallfile,youmaynotseeahuge
difference.Youllnoticethedifferenceonlywhenyouwritelargeamountofdatatoafile
withsomeotherprocessingoverheadsuchasnetwork.

1.HowtomountTmpfs
#mkdirp/mnt/tmp

#mountttmpfsosize=20mtmpfs/mnt/tmp

Thelastlineinthefollowingdfkshowstheabovemounted/mnt/tmptmpfsfilesystem.

#dfk

Filesystem1KblocksUsedAvailableUse%Mountedon

/dev/sda23270540050024882604157617%/

/dev/sda11944421856716583611%/boot
http://www.redhat.itopstube.com/2012/02/overview-of-ramfs-and-tmpfs-on-linux.html

dUsin...
HowTo
Manage
Dell
Servers
using
OMSA?
OpenMa
nage...
Overviewof
MySQL
informati
on_sche
ma
Databas
eWith...
HowToGet
Hardwar
e
Informati
onOn
Linux
Using
dmi...
Overviewof
RAMFS
and
TMPFS
onLinux
HowTo
Monitor
Network
Switch
and
Ports
Using
Nagi...
Increase
Bugzilla
Attachme
ntSize
Using
MySQL
max_...
2/8

3/21/2015

RedHat iTOps: Overview of RAMFS and TMPFS on Linux

tmpfs51732005173200%/dev/shm

tmpfs204800204800%/mnt/tmp

2.HowtomountRamfs
#mkdirp/mnt/ram

#mounttramfsosize=20mramfs/mnt/ram

Thelastlineinthefollowingmountcommandshowstheabovemounted/mnt/ramramfs
filesystem.

#mount

/dev/sda2on/typeext3(rw)

procon/proctypeproc(rw)

sysfson/systypesysfs(rw)

devptson/dev/ptstypedevpts(rw,gid=5,mode=620)

/dev/sda1on/boottypeext3(rw)

ViewDELL
Service
Tagand
Express
Service
Code
Fro...
HowTo
Perform
SSHand
SCP
Without
Passwor
dfrom
S...
Midnight
Comman
der(mc)
Guide:
Powerful
Text
based...
HowTo
Upload
Datato
MySQL
tables
using
mysqlimp
o...
6Awesome
Linuxcd
comman
dHacks
Productiv
ityTi...
Execution
sequenc
efor
.bash_pr
ofile,
.bashrc,
.ba...
Oracle11g

http://www.redhat.itopstube.com/2012/02/overview-of-ramfs-and-tmpfs-on-linux.html

3/8

3/21/2015

RedHat iTOps: Overview of RAMFS and TMPFS on Linux

tmpfson/dev/shmtypetmpfs(rw)

noneon/proc/sys/fs/binfmt_misctypebinfmt_misc(rw)

sunrpcon/var/lib/nfs/rpc_pipefstyperpc_pipefs(rw)

fusectlon/sys/fs/fuse/connectionstypefusectl(rw)

tmpfson/mnt/tmptypetmpfs(rw,size=20m)

stepby
step
Installatio
nGuide
withSc...
Feb19(17)
Feb14(6)
Feb11(1)
Feb06(13)
2011(515)

ramfson/mnt/ramtyperamfs(rw,size=20m)

Youcanmountramfsandtmpfsduringboottimebyaddinganentrytothe/etc/fstab.

3.RamfsvsTmpfs
Primarilybothramfsandtmpfsdoesthesamethingwithfewminordifferences.

Ramfswillgrowdynamically.So,youneedcontroltheprocessthatwritesthedata

tomakesureramfsdoesntgoabovetheavailableRAMsizeinthesystem.Letus
sayyouhave2GBofRAMonyoursystemandcreateda1GBramfsandmounted
as/tmp/ram.Whenthetotalsizeofthe/tmp/ramcrosses1GB,youcanstillwritedata
toit.Systemwillnotstopyoufromwritingdatamorethan1GB.However,whenit
goesabovetotalRAMsizeof2GB,thesystemmayhang,asthereisnoplaceinthe
RAMtokeepthedata.
Tmpfswillnotgrowdynamically.Itwouldnotallowyoutowritemorethanthesize

youvespecifiedwhilemountingthetmpfs.So,youdontneedtoworryabout
controllingtheprocessthatwritesthedatatomakesuretmpfsdoesntgoabovethe
specifiedlimit.ItmaygiveerrorssimilartoNospaceleftondevice.
Tmpfsusesswap.
http://www.redhat.itopstube.com/2012/02/overview-of-ramfs-and-tmpfs-on-linux.html

4/8

3/21/2015

RedHat iTOps: Overview of RAMFS and TMPFS on Linux

Ramfsdoesnotuseswap.

4.DisadvantagesofRamfsandTmpfs
SincebothramfsandtmpfsiswritingtothesystemRAM,itwouldgetdeletedoncethe
systemgetsrebooted,orcrashed.So,youshouldwriteaprocesstopickupthedata
fromramfs/tmpfstodiskinperiodicintervals.Youcanalsowriteaprocesstowritedown
thedatafromramfs/tmpfstodiskwhilethesystemisshuttingdown.But,thiswillnothelp
youinthetimeofsystemcrash.

Table:Comparisonoframfsandtmpfs
Experimentation

Tmpfs

Ramfs

Fillmaximumspaceandcontinuewriting Willdisplayerror Willcontinuewriting

FixedSize

Yes

No

UsesSwap

Yes

No

VolatileStorage

Yes

Yes

Ifyouwantyourprocesstowritefaster,optingfortmpfsisabetterchoicewith
precautionsaboutthesystemcrash.

PostedbyiTOpsTubeat9:45AM
Recommend this on Google

http://www.redhat.itopstube.com/2012/02/overview-of-ramfs-and-tmpfs-on-linux.html

5/8

Das könnte Ihnen auch gefallen