LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-11-2018, 12:09 AM   #1
nejnej25
Member
 
Registered: Dec 2017
Location: Asia
Distribution: Slackware 14.2,CentOS 7, Ubuntu, Debian
Posts: 116

Rep: Reputation: Disabled
Use of tmpfs


I'm running Centos 7.4

I could not really understand the use of tmpfs. Yes, tmpfs is stored in memory instead of hard disk, then what now? What is the use of it

One more thing, devtmpfs. Correct me if I'm wrong. Is it now the one who maps the devices on my machine? I red on internet that even without udev it can map your devices.

Thanks!
 
Old 02-11-2018, 03:50 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by nejnej25 View Post
I could not really understand the use of tmpfs. Yes, tmpfs is stored in memory instead of hard disk, then what now? What is the use of it
It's extremely fast for a file system and is non-persistent between reboots. I've made use of the first for when I've wanted to compress large files, and the second where a process downloads decryption keys from another source and stores them in tmpfs, as this is stored in memory and not on a hard disk it is considered secure and not "at rest" for many audit processes.
 
Old 02-11-2018, 07:43 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,583
Blog Entries: 19

Rep: Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454
tmpfs is like a traditional ramdisk but with two great advances:

1) A ramdisk has a fixed size. For safety reasons, you usually make it larger than you really need, but that extra space gets subtracted from available memory whether you use it or not. A tmpfs system grows and shrinks as required by the content.

2) A ramdisk is always in ram. So that block of ram is sterilised; you can't use it for anything else. A tmpfs can be swapped out like a program image when it isn't being used.

As for devtmpfs, that's just a filesystem that combines the properties of a devices filesystem with tmpfs.
 
Old 02-11-2018, 10:05 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
yes, it was already well explained. Another example: programs usually create temporary files during their life. Using tmpfs (ramdisk) may allow to run those programs faster (this is especially true for compiling, where there will be a lot of intermediate files). tmpfs is (can be) at about 1000 times faster than an ssd.
 
Old 02-11-2018, 07:04 PM   #5
nejnej25
Member
 
Registered: Dec 2017
Location: Asia
Distribution: Slackware 14.2,CentOS 7, Ubuntu, Debian
Posts: 116

Original Poster
Rep: Reputation: Disabled
Wow, thanks for the explanations. I get it now. I might use it when I'm extracting/compressing large files for it to become faster. Know I know tmpfs is awesome as it can automatically increase and decrease its space.

Quote:
Originally Posted by hazel View Post
As for devtmpfs, that's just a filesystem that combines the properties of a devices filesystem with tmpfs.
So the devices lookup will become fast? My devtmpfs is mounted on /dev/shm
 
Old 02-11-2018, 10:36 PM   #6
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I use tmpfs for browser cache. I used to use it for application development to speed up compiles.
 
Old 02-12-2018, 09:17 PM   #7
nejnej25
Member
 
Registered: Dec 2017
Location: Asia
Distribution: Slackware 14.2,CentOS 7, Ubuntu, Debian
Posts: 116

Original Poster
Rep: Reputation: Disabled
Now, what I see on my machine when I use df command:

devtmpfs /dev

I don't get devtmpfs as much as tmpfs.
 
Old 02-12-2018, 09:25 PM   #8
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
devtmpfs is a device directory in ram.
 
Old 02-12-2018, 09:33 PM   #9
nejnej25
Member
 
Registered: Dec 2017
Location: Asia
Distribution: Slackware 14.2,CentOS 7, Ubuntu, Debian
Posts: 116

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
devtmpfs is a device directory in ram.
I don't get what's the use of it. Udev use devtmpfs?
 
Old 02-13-2018, 12:35 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
that means it is kept in RAM, not saved anywhere (else). But it is separated from anything else, that's why it has its own fs.
 
Old 02-13-2018, 01:38 AM   #11
nejnej25
Member
 
Registered: Dec 2017
Location: Asia
Distribution: Slackware 14.2,CentOS 7, Ubuntu, Debian
Posts: 116

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
that means it is kept in RAM, not saved anywhere (else). But it is separated from anything else, that's why it has its own fs.
Nice! Now I get it. Thank you!
 
Old 02-13-2018, 02:15 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
you are welcome.
If you think your problem is solved please mark the thread solved.
Also if you wish to say thanks just click on yes.
 
1 members found this post helpful.
Old 02-13-2018, 07:37 AM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942
Now, be very careful when you say that it is "in RAM, and not saved anywhere else." This is virtual memory and it can be swapped-out.
 
Old 02-13-2018, 08:12 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Hm, interesting question. I'm not really sure about that (devtmpfs or other special tmpfs can also be swapped out).
 
Old 02-13-2018, 10:06 AM   #15
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,583
Blog Entries: 19

Rep: Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454
Quote:
Originally Posted by pan64 View Post
Hm, interesting question. I'm not really sure about that (devtmpfs or other special tmpfs can also be swapped out).
Yes, that's the whole point of tmpfs. An old-fashioned ramdisk couldn't be swapped out; it was literally a ram disk.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] tmpfs not being used? tmerriam Linux - Kernel 3 05-15-2012 07:51 PM
/etc/fstab "tmpfs /tmp tmpfs defaults 0 0" ramfs?! HOW? xcislav Linux - General 2 06-04-2011 03:03 AM
TmpFS ?? jdecoto Red Hat 2 12-10-2006 08:55 PM
tmpfs mnotgninnep Debian 6 03-06-2006 04:52 PM
tmpfs akuate Linux - General 9 08-15-2004 01:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration