Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

/tmp not wiping on boot

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
printf
Apprentice
Apprentice
Posts: 157
Joined: Thu Dec 02, 2010 9:05 am

/tmp not wiping on boot

  • Quote

Post by printf » Mon Apr 28, 2025 4:46 pm

Noticed, that my /tmp directory never gets wiped.
I have the default /etc/conf.d/bootmisc settings:

Code: Select all

# List of /tmp directories we should clean up
clean_tmp_dirs="/tmp"

# Should we wipe the tmp paths completely or just selectively remove known
# locks / files / etc... ?
wipe_tmp="YES"

# Write the initial dmesg log into /var/log/dmesg after boot
# This may be useful if you need the kernel boot log afterwards
log_dmesg="YES"

# Save the previous dmesg log to dmesg.old
# This may be useful if you need to compare the current boot to the
# previous one.
#previous_dmesg=no
bootmisc is correctly enabled:

Code: Select all

Runlevel: boot
 hwclock                                                                       [  started  ]
 modules                                                                       [  started  ]
 fsck                                                                          [  started  ]
 root                                                                          [  started  ]
 mtab                                                                          [  started  ]
 swap                                                                          [  started  ]
 localmount                                                                    [  started  ]
 sysctl                                                                        [  started  ]
 bootmisc                                                                      [  started  ]
 elogind                                                                       [  started  ]
 termencoding                                                                  [  started  ]
 save-termencoding                                                             [  started  ]
 procfs                                                                        [  started  ]
 hostname                                                                      [  started  ]
 loopback                                                                      [  started  ]
 keymaps                                                                       [  started  ]
 save-keymaps                                                                  [  started  ]
 binfmt                                                                        [  started  ]
 seedrng                                                                       [  started  ]
 systemd-tmpfiles-setup                                                        [  started  ]
The only thing, that is a bit out of ordinary is my fstab because:
  • I use a notebook with an SSD in it's only slot
  • I like to reduce SSD wear, so I also have a HDD, as an USB drive
  • sometimes the external HDD does not get recognized on boot, so i set up a mechanism in fstab, where I mount az 1MB tmpfs as the heavy-write directories so I don't accidentally cause unnecessary wear to the SSD
The important parts of the fstab:

Code: Select all

#ssd
#/dev/sda1 - bootloader
PARTLABEL=boot                  /boot                   vfat    defaults,noatime                        0 2
PARTLABEL=rootfs                /                       ext4    defaults,noatime,discard                0 1
PARTLABEL=home                  /home                   ext4    defaults,noatime,discard                0 2

#tmpfs                          /tmp                    tmpfs   nodev,nosuid,size=1G                    0 0
#workarnoud: do not write to disk
tmpfs                           /tmp                    tmpfs   nodev,nosuid,size=2G                    0 0
tmpfs                           /var/tmp                tmpfs   noatime,size=1M                         0 0
tmpfs                           /usr/portage            tmpfs   noatime,size=1M                         0 0
tmpfs                           /usr/src                tmpfs   noatime,size=1M                         0 0

#hdd - support
PARTLABEL=swap                  none                    swap    sw                                      0 0
PARTLABEL=support               /mnt/support            ext4    defaults,noatime,discard                0 2
/mnt/support/tmp                /tmp                    none    defaults,bind                           0 0
/mnt/support/var_tmp            /var/tmp                none    defaults,bind                           0 0
/mnt/support/usr_portage        /usr/portage            none    defaults,bind                           0 0
/mnt/support/usr_src            /usr/src                none    defaults,bind                           0 0
Could this be because it gets mounted after bootmisc is executed? What else I am missing?
Top
user
Apprentice
Apprentice
Posts: 245
Joined: Sun Feb 08, 2004 4:57 pm

Re: /tmp not wiping on boot

  • Quote

Post by user » Mon Apr 28, 2025 9:19 pm

Overmount looks odd to me. Later fstab entry "wins" and you discard 2G memory for nothing.
printf wrote:Noticed, that my /tmp directory never gets wiped.

Code: Select all

...
tmpfs                           /tmp                    tmpfs   nodev,nosuid,size=2G                    0 0
...
PARTLABEL=support               /mnt/support            ext4    defaults,noatime,discard                0 2
/mnt/support/tmp                /tmp                    none    defaults,bind                           0 0
...
Why not using zram for /tmp to reduce HDD/SSD writes?

Code: Select all

# cat /etc/udev/rules.d/10-zram.rules 
KERNEL=="zram0", SUBSYSTEM=="block", DRIVER=="", ACTION=="add", ATTR{initstate}=="0", ATTR{comp_algorithm}="lz4", ATTR{disksize}="4G", RUN+="/sbin/mkfs.ext4 -O fast_commit,inline_data,^metadata_csum,^has_journal,^resize_inode,^dir_nlink,^huge_file -m 0 -L $name $env{DEVNAME}"

# cat /etc/fstab
/dev/zram0                                         /tmp                    ext4     discard,nobarrier,nodelalloc,nombcache,dioread_nolock,nodev,nosuid,noatime,user_xattr,acl 0 0

# zramctl zram0
NAME       ALGORITHM DISKSIZE   DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4             4G 522.7M 24.2M 31.4M       2 /tmp
No need to wipe after reboot, as mountpoint is in-memory filesystem.
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Mon Apr 28, 2025 10:41 pm

user wrote:you discard 2G memory for nothing.
This is not how tmpfs works. It only allocates when used not at mount time.
Top
Post Reply

3 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic