Overview of RAMFS and TMPFS on Linux

Embed Size (px)

DESCRIPTION

Linux

Citation preview

  • 3/21/2015 RedHat iTOps: Overview of RAMFS and TMPFS on Linux

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

    RedHat iTOpsiTOps Home RedHat Basics RHCSA Networking

    RedHatiTOps

    RedHatiTOpsTube

    PopularSearches

    MyContent

    Tuesday,February21,2012

    OverviewofRAMFSandTMPFSonLinux

    Usingramfsortmpfsyoucanallocatepartofthephysicalmemorytobeusedasa

    iTOpsTubePortal

    UbuntuItops

    FedoraItops

    RedHatItops

    MacItops

    UnixItops

    LinuxITOPS

    SUSELinuxItops

    DebianiTOps

    CoreiTOpsTube

    windowsItops

    2012(578)

    December(7)

    June(25)

    May(180)

    April(300)

    February(66)

    Feb23(13)

    Feb21(16)

    WOLWakeonlanGuide:TurnOnServersRemotelyWith...

    TheEvolutionandFutureofCommunicationTechnolo...

    3StepstoPerformSSHLoginWithoutPasswor

    RedHatRecentUpdates

    http://www.fedora.itopstube.com/http://www.itopstube.com/javascript:void(0)http://www.redhat.itopstube.com/http://www.redhat.itopstube.com/http://www.windows.itopstube.com/javascript:void(0)javascript:void(0)http://www.unix.itopstube.com/http://www.lijit.com/javascript:void(0)http://www.redhat.itopstube.com/http://www.redhat.itopstube.com/search?updated-min=2012-05-01T00:00:00-07:00&updated-max=2012-06-01T00:00:00-07:00&max-results=50http://www.redhat.itopstube.com/search?updated-min=2012-12-01T00:00:00-08:00&updated-max=2013-01-01T00:00:00-08:00&max-results=7http://www.redhat.itopstube.com/2012/02/evolution-and-future-of-communication.htmlhttp://www.debian.itopstube.com/http://1.bp.blogspot.com/-vfYDHSBDzIc/T0PYMhbxFuI/AAAAAAAAC1w/SWUPh4BNIL8/s1600/image001-722061.jpghttp://www.lijit.com/informer?uri=http%3A%2F%2Fwww.redhat.itopstube.com%2Fhttp://www.mac.itopstube.com/http://www.core.itopstube.com/p/core.htmlhttp://www.redhat.itopstube.com/p/rhcsa.htmljavascript:void(0)http://www.core.itopstube.com/http://www.linux.itopstube.com/http://www.redhat.itopstube.com/search?updated-min=2012-06-01T00:00:00-07:00&updated-max=2012-07-01T00:00:00-07:00&max-results=25javascript:void(0)http://www.suselinux.itopstube.com/http://www.redhat.itopstube.com/2012/02/wol-wakeonlan-guide-turn-on-servers.htmlhttp://www.redhat.itopstube.com/2012/02/3-steps-to-perform-ssh-login-without.htmlhttp://www.ubuntu.itopstube.com/http://itopstube.blogspot.com/p/networking.htmljavascript:void(0)http://www.redhat.itopstube.com/search?updated-min=2012-01-01T00:00:00-08:00&updated-max=2013-01-01T00:00:00-08:00&max-results=50http://www.redhat.itopstube.com/search?updated-min=2012-04-01T00:00:00-07:00&updated-max=2012-05-01T00:00:00-07:00&max-results=50http://www.redhat.itopstube.com/search?updated-min=2012-02-01T00:00:00-08:00&updated-max=2012-03-01T00:00:00-08:00&max-results=50javascript:void(0)http://www.redhat.itopstube.com/2012_02_21_archive.htmlhttp://www.redhat.itopstube.com/2012_02_23_archive.html

  • 3/21/2015 RedHat iTOps: Overview of RAMFS and TMPFS on Linux

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

    partition.Youcanmountthispartitionandstartwritingandreadingfileslikeaharddisk

    partition.SinceyoullbereadingandwritingtotheRAM,itwillbefaster.

    Whenavitalprocessbecomesdrasticallyslowbecauseofdiskwrites,youcanchoose

    eitherramfsortmpfsfilesystemsforwritingfilestotheRAM.

    Bothtmpfsandramfsmountwillgiveyouthepoweroffastreadingandwritingfilesfrom

    andtotheprimarymemory.Whenyoutestthisonasmallfile,youmaynotseeahuge

    difference.Youllnoticethedifferenceonlywhenyouwritelargeamountofdatatoafile

    withsomeotherprocessingoverheadsuchasnetwork.

    #mkdirp/mnt/tmp

    #mountttmpfsosize=20mtmpfs/mnt/tmp

    Thelastlineinthefollowingdfkshowstheabovemounted/mnt/tmptmpfsfilesystem.

    #dfk

    Filesystem1KblocksUsedAvailableUse%Mountedon

    /dev/sda23270540050024882604157617%/

    /dev/sda11944421856716583611%/boot

    1.HowtomountTmpfs

    51,307

    TotalPageviewsonredhat.itopstube.com

    dUsin...

    HowToManageDellServersusingOMSA?OpenManage...

    OverviewofMySQLinformation_schemaDatabaseWith...

    HowToGetHardwareInformationOnLinuxUsingdmi...

    OverviewofRAMFSandTMPFSonLinux

    HowToMonitorNetworkSwitchandPortsUsingNagi...

    IncreaseBugzillaAttachmentSizeUsingMySQLmax_...

    http://www.redhat.itopstube.com/2012/02/overview-of-ramfs-and-tmpfs-on-linux.htmlhttp://www.redhat.itopstube.com/2012/02/how-to-manage-dell-servers-using-omsa.htmlhttp://www.redhat.itopstube.com/2012/02/how-to-get-hardware-information-on.htmlhttp://www.redhat.itopstube.com/2012/02/how-to-monitor-network-switch-and-ports.htmlhttp://www.redhat.itopstube.com/2012/02/overview-of-mysql-informationschema.htmlhttp://www.redhat.itopstube.com/2012/02/3-steps-to-perform-ssh-login-without.htmlhttp://www.redhat.itopstube.com/2012/02/increase-bugzilla-attachment-size-using.html

  • 3/21/2015 RedHat iTOps: Overview of RAMFS and TMPFS on Linux

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

    tmpfs51732005173200%/dev/shm

    tmpfs204800204800%/mnt/tmp

    #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)

    2.HowtomountRamfs

    ViewDELLServiceTagandExpressServiceCodeFro...

    HowToPerformSSHandSCPWithoutPasswordfromS...

    MidnightCommander(mc)Guide:PowerfulTextbased...

    HowToUploadDatatoMySQLtablesusingmysqlimpo...

    6AwesomeLinuxcdcommandHacksProductivityTi...

    Executionsequencefor.bash_profile,.bashrc,.ba...

    Oracle11g

    http://www.redhat.itopstube.com/2012/02/midnight-commander-mc-guide-powerful.htmlhttp://www.redhat.itopstube.com/2012/02/how-to-upload-data-to-mysql-tables.htmlhttp://www.redhat.itopstube.com/2012/02/oracle-11g-step-by-step-installation.htmlhttp://www.redhat.itopstube.com/2012/02/execution-sequence-for-bashprofile.htmlhttp://www.redhat.itopstube.com/2012/02/6-awesome-linux-cd-command-hacks.htmlhttp://www.redhat.itopstube.com/2012/02/how-to-perform-ssh-and-scp-without.htmlhttp://www.redhat.itopstube.com/2012/02/view-dell-service-tag-and-express.html

  • 3/21/2015 RedHat iTOps: Overview of RAMFS and TMPFS on Linux

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

    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)

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

    Youcanmountramfsandtmpfsduringboottimebyaddinganentrytothe/etc/fstab.

    Primarilybothramfsandtmpfsdoesthesamethingwithfewminordifferences.

    Ramfswillgrowdynamically.So,youneedcontroltheprocessthatwritesthedatatomakesureramfsdoesntgoabovetheavailableRAMsizeinthesystem.Letus

    sayyouhave2GBofRAMonyoursystemandcreateda1GBramfsandmounted

    as/tmp/ram.Whenthetotalsizeofthe/tmp/ramcrosses1GB,youcanstillwritedata

    toit.Systemwillnotstopyoufromwritingdatamorethan1GB.However,whenit

    goesabovetotalRAMsizeof2GB,thesystemmayhang,asthereisnoplaceinthe

    RAMtokeepthedata.

    Tmpfswillnotgrowdynamically.Itwouldnotallowyoutowritemorethanthesizeyouvespecifiedwhilemountingthetmpfs.So,youdontneedtoworryabout

    controllingtheprocessthatwritesthedatatomakesuretmpfsdoesntgoabovethe

    specifiedlimit.ItmaygiveerrorssimilartoNospaceleftondevice.

    Tmpfsusesswap.

    3.RamfsvsTmpfs

    stepbystepInstallationGuidewithSc...

    Feb19(17)

    Feb14(6)

    Feb11(1)

    Feb06(13)

    2011(515)

    http://wiki.linuxquestions.org/wiki/Fstabjavascript:void(0)javascript:void(0)http://www.redhat.itopstube.com/2012_02_06_archive.htmljavascript:void(0)http://www.redhat.itopstube.com/2012/02/oracle-11g-step-by-step-installation.htmlhttp://www.redhat.itopstube.com/2012_02_19_archive.htmlhttp://www.linux.com/feature/121916javascript:void(0)http://www.redhat.itopstube.com/search?updated-min=2011-01-01T00:00:00-08:00&updated-max=2012-01-01T00:00:00-08:00&max-results=50http://www.redhat.itopstube.com/2012_02_11_archive.htmlhttp://www.redhat.itopstube.com/2012_02_14_archive.htmljavascript:void(0)

  • 3/21/2015 RedHat iTOps: Overview of RAMFS and TMPFS on Linux

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

    PostedbyiTOpsTubeat9:45AM

    Ramfsdoesnotuseswap.

    SincebothramfsandtmpfsiswritingtothesystemRAM,itwouldgetdeletedoncethe

    systemgetsrebooted,orcrashed.So,youshouldwriteaprocesstopickupthedata

    fromramfs/tmpfstodiskinperiodicintervals.Youcanalsowriteaprocesstowritedown

    thedatafromramfs/tmpfstodiskwhilethesystemisshuttingdown.But,thiswillnothelp

    youinthetimeofsystemcrash.

    Table:Comparisonoframfsandtmpfs

    Experimentation Tmpfs Ramfs

    FillmaximumspaceandcontinuewritingWilldisplayerrorWillcontinuewriting

    FixedSize Yes No

    UsesSwap Yes No

    VolatileStorage Yes Yes

    Ifyouwantyourprocesstowritefaster,optingfortmpfsisabetterchoicewith

    precautionsaboutthesystemcrash.

    4.DisadvantagesofRamfsandTmpfs

    Recommend this on Google

    http://www.redhat.itopstube.com/2012/02/overview-of-ramfs-and-tmpfs-on-linux.htmlhttp://www.blogger.com/share-post.g?blogID=4456266953071702743&postID=1959764286767588535&target=emailhttp://www.blogger.com/share-post.g?blogID=4456266953071702743&postID=1959764286767588535&target=pinteresthttp://www.blogger.com/share-post.g?blogID=4456266953071702743&postID=1959764286767588535&target=facebookhttp://www.blogger.com/share-post.g?blogID=4456266953071702743&postID=1959764286767588535&target=bloghttp://www.blogger.com/share-post.g?blogID=4456266953071702743&postID=1959764286767588535&target=twitter