SUMMARY: tmpfs vs. swap (Was: X server won't start)

From: Alan Miller (
Date: Wed Jun 23 1999 - 04:38:11 CDT

Dear Sun Managers,

First off all, thank you to the respondents who,
in according to appearance were:

  Brad Young <>
  Jonathan Loh <>
  Arthur Darren Dunham <>
  Matthew Atkinson <>
  Bill Armand <>
  Kevin Shehan <>
  Roger Fujii <>
  Jon LaBadie <>

Most of the respondents (as well as: man 7 tmpfs) noted that
"the tmpfs is a memory based filesystem which uses kernel resources
 relating to the VM system and page cache as a filesystem"

So: The short summary is this.
 /tmp /tmp is (normally) mounted on a tmpfs file system
 tmpfs tmpfs is a "memory based" file system that consists of
           physical memory + all available swap space.
           Usage for the tmpfs (i.e.; df /tmp) will grows and shrink
           according to memory usage on the system.
           So if you use alot of disk space under /tmp you have less
           swap space for your apps; and if your apps swap alot then
           you'll have left disk space in /tmp.
And using my E450 as an example:
  ->Memory: 1024 MB (See: /usr/platform/`uname -m`/sbin/prtdiag)
  ->Swap: /dev/md/dsk/d17 is mounted as a tmpfs under /tmp

A swap partition was created on /dev/dsk/c0t0d0s4 at install time.
>From the file: /var/sadm/system/logs/install_log

Physically, this partition is 1000.90MB, which was obtained from:
 [root@server] /usr/sbin/format c0t0d0
 format> partition
 format> print

  Part Tag Flag Cylinders Size Blocks
  4 swap wu 1452 - 2400 1000.90MB (949/0/0) 2049840

You can list the status of all swap areas with:
 [root@server] swap -l
 swapfile dev swaplo blocks free
 /dev/md/dsk/d17 85,17 16 2049824 1814896

   n.b.: The swapfile, /dev/md/dsk/d17 is a meta device which is a
         mirror of partitions /dev/dsk/c0t0d0s4 and /dev/dsk/c3t0d0s4
 As shown by swap -l the swap partition size is 2049824 512K-blocks,
 or 1049509888 bytes (2049824 * 512)
 or 1000.89 MB (1049509888 / 1024 / 1024)
 which agrees with the output of: format -> partition -> print

(When not under stress) my systems /tmp (tmpfs) typically shows:
 [root@server]# df -k /tmp ; echo ; swap -s
 Filesystem kbytes used avail capacity Mounted on
 swap 1531464 26648 1504816 2% /tmp
 total: 280408k bytes allocated + 39336k reserved = 319744k used,
        1506896k available

 Here df shows 1504816 MB available space which is roughly the
 same as the available space reported by swap -s which is
 1506896k bytes.
 n.b.: Although the man page for tmpfs states that the output of df
       may not be accurate, the theoretical maximum size of /tmp is
       thus 2.0 GB on my system.

Original question:
On Mon, Jun 21, 1999, Alan Miller wrote:
> Hi David,
> Could you, or somebody on the list clarify the statement about
> /tmp, tmpfs, and swap. I've been left alitte confused.
> On my Sun E450 /tmp gets mounted via /etc/vfstab which says:
> # device device mount FS fsck mount mount
> # to mount to fsck point type pass at boot options
> swap - /tmp tmpfs - yes -
> and the command: `df -klt swap` says:
> Filesystem kbytes used avail capacity Mounted on
> swap 1576744 42584 1534160 3% /tmp
> What confuses me is your disctinction between tmpfs and swap.

Alan Miller

| Alan Miller BinTec Commmunications AG |
| System/Network Administrator Südwestpark 94 |
| Voice: +49 911 96 73 14 55 D-90449, Nürnberg |
| Fax: +49 911 96 73 14 99 Germany |
| |

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:22 CDT