8

CentOS 5.x

My understanding is that the contents of /tmp/ in CentOS 5.x can/are automatically purged by the OS via one of two methods:

  • A daily cron task running tmpwatch
  • If /tmp/is mounted on a tmpfs (RAM), a system reboot/power cycle will clear everything.

Is that correct? If so, how can I confirm if /tmp is mounted on tmpfs?

I checked /etc/fstab and saw this:

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda2         swap                    swap    defaults        0 0

4 Answers 4

26

You can resolve which filesystem a directory or file is on with the command df, and if you include the -T option, the output will include the filesystem type.

$ df -T /tmp
Filesystem     Type 1K-blocks    Used Available Use% Mounted on
/dev/sda3      ext4  38715020 5073600  31674780  14% /

In the above example, the /tmp directory is on an ext4 filesystem, not tmpfs.

4

The mount command shows what is currently mounted.

$ mount|grep -i tmp
none on /tmp type tmpfs (rw)
0
df --output=target /tmp

Also check df manpage for other field names apart from the "target".

0

findmnt utility will even show you the options. Try this:

findmnt --target /tmp

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .