74 lines
4.3 KiB
Plaintext
74 lines
4.3 KiB
Plaintext
|
|
Episode: 277
|
||
|
|
Title: HPR0277: tmpfs
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0277/hpr0277.mp3
|
||
|
|
Transcribed: 2025-10-07 15:25:00
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
Here we go.
|
||
|
|
Welcome to another edition of Hacker Public Radio.
|
||
|
|
Today will be your host, Thutex, and today we'll be talking about TempeFS.
|
||
|
|
Why would you want to use a TempeFS?
|
||
|
|
Well the situation is similar to when you go to a gas station and you see those super
|
||
|
|
duper-sized colas that it just cost 10-20 cents more and you figure, hey, I'll buy the
|
||
|
|
big one.
|
||
|
|
But then when you try to drink in it, you don't want to do with all that sort of...
|
||
|
|
You might have a similar case with the RAM in your computer.
|
||
|
|
RAM is so cheap now that you can get gobs and gobs of it just for a little bit more
|
||
|
|
money.
|
||
|
|
But then you run into the problem of what do you do with it, how do you make use of it?
|
||
|
|
If you're running Linux, you might have a hard time getting over usage of one gigabyte
|
||
|
|
and you have all that extra RAM that you're not using.
|
||
|
|
So we can use this RAM as it was not originally intended and put a file system on there
|
||
|
|
and save files to the RAM disk.
|
||
|
|
One of the options that you have is a TempeFS file system.
|
||
|
|
This is available with most Unix distributions.
|
||
|
|
It's mounted by default in slash temp in the Suncelerus version.
|
||
|
|
There is not an elegant TempeFS file system in Microsoft Windows according to Wikipedia,
|
||
|
|
but they do have ways to save some files to memory.
|
||
|
|
So how would you do this in Linux?
|
||
|
|
Well, you could use the Mount command or your F-stab and you do Mount Space-T for the
|
||
|
|
type and the type is going to be TempeFS, TMP, FS, and you have a couple options that you
|
||
|
|
can specify with a space dash, dash, or switch.
|
||
|
|
One is size equals and that will specify the maximum size that this file system will have.
|
||
|
|
If you specify a size here, it's going to use only what it needs as it needs it.
|
||
|
|
So if you specify one gigabyte as your size, it's not going to take up one gigabyte right
|
||
|
|
away.
|
||
|
|
It's going to only take up one gigabyte when you start building up that gigabyte.
|
||
|
|
So that's just a maximum and unlike RAMFS, it can make use of your virtual memory too.
|
||
|
|
So size is one option you might want to specify.
|
||
|
|
Another option you might want to specify is the NR underscore I nodes and that is remember
|
||
|
|
I nodes are something like just a file on your system.
|
||
|
|
So if you plan on putting many, many files inside this file system, then you would want
|
||
|
|
to increase that number.
|
||
|
|
It's usually set to a default of a small number so you might want to increase that.
|
||
|
|
And then the device, you can just put something like none or TMPFS and then the mount point.
|
||
|
|
Why would you do this?
|
||
|
|
Why would you want to TMPFS?
|
||
|
|
Well, a lot of times, biggest bottleneck in the system will be writing IO to your hard disk.
|
||
|
|
IO to the hard disk is very slow and writing to system RAM is much, much faster.
|
||
|
|
So if you have something where you're writing to the disk a lot and you want to increase your speed,
|
||
|
|
you can write your files to the TMPFS.
|
||
|
|
This might be compiling some software or working with really large files like a video editing
|
||
|
|
or something like this.
|
||
|
|
And you can greatly improve your performance this way.
|
||
|
|
There's also other reason to do this.
|
||
|
|
A good example is for laptops.
|
||
|
|
If you have a solid state drive in your laptop and you want to prevent unnecessary writing to that drive,
|
||
|
|
to increase its lifetime, you can put all your temporary files in the TMPFS.
|
||
|
|
A typical spot to mount TMPFS is a lifetime or slash versus slash log.
|
||
|
|
And so your log files won't be written to slash temp.
|
||
|
|
So that can increase the lifetime of your SSD.
|
||
|
|
If you have a the usual disk hard drive, this is also a good idea.
|
||
|
|
Because spinning up the hard drive and spinning down the hard drive takes better battery life.
|
||
|
|
So to prevent that when with sparse usage, for example, you're browsing the web and you're just not running some images once in a while.
|
||
|
|
And those need to get written to the cache, say Firefox's cache.
|
||
|
|
And you can change where the Firefox writes its cache and the about colon config and put that on a TMPFS.
|
||
|
|
So your hard drive won't have to spin up when you download your do-comic that you're going to look at.
|
||
|
|
Also, slash versus slash log would help in that case.
|
||
|
|
And so that concludes TMPFS.
|
||
|
|
Have fun, happy hacking. Have a good day.
|
||
|
|
Thank you for listening to Hack Republic Radio.
|
||
|
|
Now we're sponsored by caro.net. So head on over to CARO.nc for all of us here.
|
||
|
|
Thanks for watching.
|