/tmp mounted as tmpfs

Post here if you are a new Porteus member and you're looking for some help.
rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

/tmp mounted as tmpfs

Post#1 by rych » 14 Jul 2021, 07:57

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?
Last edited by rych on 14 Jul 2021, 10:06, edited 1 time in total.

User avatar
babam
Warlord
Warlord
Posts: 528
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

/tmp mounted as tmpfs

Post#2 by babam » 14 Jul 2021, 08:53

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.

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

/tmp mounted as tmpfs

Post#3 by rych » 14 Jul 2021, 09:32

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?

User avatar
babam
Warlord
Warlord
Posts: 528
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

/tmp mounted as tmpfs

Post#4 by babam » 14 Jul 2021, 09:44

You can delete unnecessary files/directories.

But there are files/directories that are created every time the system boot and those files are important.
Sorry, my English is bad.

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

/tmp mounted as tmpfs

Post#5 by rych » 14 Jul 2021, 09:55

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.

User avatar
Ed_P
Contributor
Contributor
Posts: 8360
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

/tmp mounted as tmpfs

Post#6 by Ed_P » 14 Jul 2021, 15:47

On my Porteus USB system the /tmp folder is in RAM and it's in RAM on the systems I boot as ISOs.
Ed

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

/tmp mounted as tmpfs

Post#7 by rych » 28 Oct 2023, 15:16

babam wrote:
14 Jul 2021, 08:53
Add to /etc/rc.d/rc.local
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.

User avatar
Rava
Contributor
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

Post#8 by Rava » 03 Nov 2023, 06:16

rych wrote:
28 Oct 2023, 15:16
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.
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

Post Reply