{"id":4464,"date":"2022-12-20T18:08:42","date_gmt":"2022-12-20T21:08:42","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/tmpfs-man5\/"},"modified":"2022-12-20T18:08:42","modified_gmt":"2022-12-20T21:08:42","slug":"tmpfs-man5","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/tmpfs-man5\/","title":{"rendered":"TMPFS (man5)"},"content":{"rendered":"<h1 align=\"center\">TMPFS<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#VERSIONS\">VERSIONS<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">tmpfs \u2212 a virtual memory filesystem<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>tmpfs<\/b> facility allows the creation of filesystems whose contents reside in virtual memory. Since the files on such filesystems typically reside in RAM, file access is extremely fast.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The filesystem is automatically created when mounting a filesystem with the type <b>tmpfs<\/b> via a command such as the following:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$ sudo mount \u2212t tmpfs \u2212o size=10M tmpfs \/mnt\/mytmpfs<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">A <b>tmpfs<\/b> filesystem has the following properties:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p>The filesystem can employ swap space when physical memory pressure demands it.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p>The filesystem consumes only as much physical memory and swap space as is required to store the current contents of the filesystem.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"85%\">\n<p>During a remount operation (<i>mount\u00a0\u2212o\u00a0remount<\/i>), the filesystem size can be changed (without losing the existing contents of the filesystem).<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">If a <b>tmpfs<\/b> filesystem is unmounted, its contents are discarded (lost).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Mount options<\/b> <br \/> The <b>tmpfs<\/b> filesystem supports the following mount options: <b><br \/> size<\/b>=<i>bytes<\/i><\/p>\n<p style=\"margin-left:22%;\">Specify an upper limit on the size of the filesystem. The size is given in bytes, and rounded up to entire pages.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The size may have a <b>k<\/b>, <b>m<\/b>, or <b>g<\/b> suffix for Ki, Mi, Gi (binary kilo (kibi), binary mega (mebi) and binary giga (gibi)).<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The size may also have a % suffix to limit this instance to a percentage of physical RAM.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The default, when neither <b>size<\/b> nor <b>nr_blocks<\/b> is specified, is <i>size=50%<\/i>.<\/p>\n<p style=\"margin-left:11%;\"><b>nr_blocks<\/b>=<i>blocks<\/i><\/p>\n<p style=\"margin-left:22%;\">The same as <b>size<\/b>, but in blocks of <b>PAGE_CACHE_SIZE<\/b>.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">Blocks may be specified with <b>k<\/b>, <b>m<\/b>, or <b>g<\/b> suffixes like <b>size<\/b>, but not a % suffix.<\/p>\n<p style=\"margin-left:11%;\"><b>nr_inodes<\/b>=<i>inodes<\/i><\/p>\n<p style=\"margin-left:22%;\">The maximum number of inodes for this instance. The default is half of the number of your physical RAM pages, or (on a machine with highmem) the number of lowmem RAM pages, whichever is smaller.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">Inodes may be specified with <b>k<\/b>, <b>m<\/b>, or <b>g<\/b> suffixes like <b>size<\/b>, but not a % suffix.<\/p>\n<p style=\"margin-left:11%;\"><b>mode<\/b>=<i>mode<\/i><\/p>\n<p style=\"margin-left:22%;\">Set initial permissions of the root directory.<\/p>\n<p style=\"margin-left:11%;\"><b>gid<\/b>=<i>gid<\/i> (since Linux 2.5.7)<\/p>\n<p style=\"margin-left:22%;\">Set the initial group ID of the root directory.<\/p>\n<p style=\"margin-left:11%;\"><b>uid<\/b>=<i>uid<\/i> (since Linux 2.5.7)<\/p>\n<p style=\"margin-left:22%;\">Set the initial user ID of the root directory.<\/p>\n<p style=\"margin-left:11%;\"><b>huge<\/b>=<i>huge_option<\/i> (since Linux 4.7.0)<\/p>\n<p style=\"margin-left:22%;\">Set the huge table memory allocation policy for all files in this instance (if <b>CONFIG_TRANSPARENT_HUGE_PAGECACHE<\/b> is enabled).<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>huge_option<\/i> value is one of the following:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>never<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>Do not allocate huge pages. This is the default.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>always<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>Attempt to allocate huge pages every time a new page is needed.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\"><b>within_size<\/b><\/p>\n<p style=\"margin-left:32%;\">Only allocate huge page if it will be fully within <i>i_size<\/i>. Also respect <b>fadvise<\/b>(2)\/<b>madvise<\/b>(2) hints<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>advise<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>Only allocate huge pages if requested with <b>fadvise<\/b>(2)\/<b>madvise<\/b>(2).<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>deny<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>For use in emergencies, to force the huge option off from all mounts.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>force<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>Force the huge option on for all mounts; useful for testing.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>mpol<\/b>=<i>mpol_option<\/i> (since Linux 2.6.15)<\/p>\n<p style=\"margin-left:22%;\">Set the NUMA memory allocation policy for all files in this instance (if <b>CONFIG_NUMA<\/b> is enabled).<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>mpol_option<\/i> value is one of the following: <b><br \/> default<\/b><\/p>\n<p style=\"margin-left:32%;\">Use the process allocation policy (see <b>set_mempolicy<\/b>(2)).<\/p>\n<p style=\"margin-left:22%;\"><b>prefer<\/b>:<i>node<\/i><\/p>\n<p style=\"margin-left:32%;\">Preferably allocate memory from the given <i>node<\/i>.<\/p>\n<p style=\"margin-left:22%;\"><b>bind<\/b>:<i>nodelist<\/i><\/p>\n<p style=\"margin-left:32%;\">Allocate memory only from nodes in <i>nodelist<\/i>.<\/p>\n<p style=\"margin-left:22%;\"><b>interleave<\/b><\/p>\n<p style=\"margin-left:32%;\">Allocate from each node in turn.<\/p>\n<p style=\"margin-left:22%;\"><b>interleave<\/b>:<i>nodelist<\/i><\/p>\n<p style=\"margin-left:32%;\">Allocate from each node of <i>in<\/i> turn.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"7%\">\n<p><b>local<\/b><\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"68%\">\n<p>Preferably allocate memory from the local node.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%; margin-top: 1em\">In the above, <i>nodelist<\/i> is a comma-separated list of decimal numbers and ranges that specify NUMA nodes. A range is a pair of hyphen-separated decimal numbers, the smallest and largest node numbers in the range. For example, <i>mpol=bind:0\u22123,5,7,9\u221215<\/i>.<\/p>\n<h2>VERSIONS <a name=\"VERSIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>tmpfs<\/b> facility was added in Linux 2.4, as a successor to the older <b>ramfs<\/b> facility, which did not provide limit checking or allow for the use of swap space.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">In order for user-space tools and applications to create <b>tmpfs<\/b> filesystems, the kernel must be configured with the <b>CONFIG_TMPFS<\/b> option.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>tmpfs<\/b> filesystem supports extended attributes (see <b>xattr<\/b>(7)), but <i>user<\/i> extended attributes are not permitted.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">An internal shared memory filesystem is used for System V shared memory (<b>shmget<\/b>(2)) and shared anonymous mappings (<b>mmap<\/b>(2) with the <b>MAP_SHARED<\/b> and <b>MAP_ANONYMOUS<\/b> flags). This filesystem is available regardless of whether the kernel was configured with the <b>CONFIG_TMPFS<\/b> option.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">A <b>tmpfs<\/b> filesystem mounted at <i>\/dev\/shm<\/i> is used for the implementation of POSIX shared memory (<b>shm_overview<\/b>(7)) and POSIX semaphores (<b>sem_overview<\/b>(7)).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The amount of memory consumed by all <b>tmpfs<\/b> filesystems is shown in the <i>Shmem<\/i> field of <i>\/proc\/meminfo<\/i> and in the <i>shared<\/i> field displayed by <b>free<\/b>(1).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>tmpfs<\/b> facility was formerly called <b>shmfs<\/b>.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>df<\/b>(1), <b>du<\/b>(1), <b>memfd_create<\/b>(2), <b>mmap<\/b>(2), <b>set_mempolicy<\/b>(2), <b>shm_open<\/b>(3), <b>mount<\/b>(8)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The kernel source files <i>Documentation\/filesystems\/tmpfs.txt<\/i> and <i>Documentation\/admin-guide\/mm\/transhuge.rst<\/i>.<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  tmpfs \u2212 a virtual memory filesystem <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[959],"tags":[961,1291,1441],"class_list":["post-4464","post","type-post","status-publish","format-standard","hentry","category-5-formatos-de-ficheros","tag-961","tag-man5","tag-tmpfs"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4464"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4464\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}