Hi, I have a lot of RAM, could I have /tmp folder mounted to be ramdisk, as either tmpfs or ramfs or whatnot?
My understanding is that for tmpfs I only specify the upper limit, and there is no minimum reserved space, so that my /tmp won't claim unnecessary fixed memory from the start (?)
Are there other system folders that don't really need to persistent and are better to live in memory and be wiped every reboot?
/tmp mounted as tmpfs
-
- Warlord
- Posts: 622
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/tmp mounted as tmpfs
Last edited by rych on 14 Jul 2021, 10:06, edited 1 time in total.
- babam
- Warlord
- Posts: 528
- Joined: 16 Nov 2016, 10:30
- Distribution: Porteus 5.0rc3 Xfce K6.1.1
- Location: Rainy city
/tmp mounted as tmpfs
Add to /etc/rc.d/rc.local
Code: Select all
cp -af /tmp /var/tmp2tmpfs
mount -t tmpfs -o size=60% tmpfs /tmp
cp -af /var/tmp2tmpfs/. /tmp
rm -rf /var/tmp2tmpfs
Sorry, my English is bad.
-
- Warlord
- Posts: 622
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/tmp mounted as tmpfs
babam, thanks. One question: as we about to mount -t tmpfs -o size=60% tmpfs /tmp, the /tmp is probably nonempty. Don't we want to make it empty first?
- babam
- Warlord
- Posts: 528
- Joined: 16 Nov 2016, 10:30
- Distribution: Porteus 5.0rc3 Xfce K6.1.1
- Location: Rainy city
/tmp mounted as tmpfs
You can delete unnecessary files/directories.
But there are files/directories that are created every time the system boot and those files are important.
But there are files/directories that are created every time the system boot and those files are important.
Sorry, my English is bad.
-
- Warlord
- Posts: 622
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/tmp mounted as tmpfs
babam, So even if /tmp was empty to begin with, some files could be created already by the time /etc/rc.d/rc.local is processed? And those files will be mounted over and hidden, their copies brought on top the newly mounted /tmp? I'll probably try to comment out the rm -rf /var/tmp2tmpfs at least once to see what was there.
- Ed_P
- Contributor
- Posts: 8360
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
/tmp mounted as tmpfs
On my Porteus USB system the /tmp folder is in RAM and it's in RAM on the systems I boot as ISOs.
Ed
-
- Warlord
- Posts: 622
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
/tmp mounted as tmpfs
Nowadays I save changes on exit only and can exclude /tmp folder from ever being saved as changes to USB (well, it's not even mentioned in /etc/changes-exit.conf therefore unsaved by default), so I guess the /tmp and all changed session data lives in memory anyway and I don't need to specifically make /tmp a separate ramdisk -- its already in memory anyway?
So I'm going to remove that section from my /etc/rc.d/rc.local, returning it to the original.
- Rava
- Contributor
- Posts: 5401
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
/tmp mounted as tmpfs
Yes, by standard /tmp might not be mounted as a tmpfs.
But it not needs to, since it is part of / and / is mounted into RAM since we have a live system:
Porteus 5.01 on a mere 4GB of RAM PC (using ramsize=10% zram=8%) :
Code: Select all
guest@rava:/$ df -Tm /tmp/
Filesystem Type 1M-blocks Used Available Use% Mounted on
aufs aufs 388 276 112 72% /
Cheers!
Yours Rava
Yours Rava