Linux what is var cache

What goes in /var?

I read The Linux Command Line by William Shotts, and there are some descriptions of Linux files (system directories):

The /var directory contents don’t change. This tree is where data that is likely to change is stored. Various databases, spool files, user mail, etc. are located here.

I am wondering: If the /var directory contents are not supposed to change, why is there a www directory in /var/www after installing apache-php ? The /var/www directory is where we must edit, create or delete files. This is a localhost public directory. Why did he say, that the /var directory contents don’t change?

«don’t change. This tree is where data that is likely to change» — the quote is self-contradictory

Is this really what it says in your book? What I can find on page 23 in «The Linux Command Line» version 17.10 by William Shotts makes more sense: «With the exception of /tmp and /home, the directories we have looked at so far remain relatively static, that is, their contents don’t change. The /var directory tree is where data that is likely to change is stored. Various databases, spool files, user mail, etc. are located here.»

5 Answers 5

That description of /var is self-contradictory. /var contains things that are prone to change, such as websites, temporary files ( /var/tmp ) and databases. The name is an abbreviation of «variable».

@Sandeep I think the accepted answer is chosen by the person who asks the question. This person may not have had enough information before they chose an accepted answer. Generally speaking, answers with more votes will help more people. I suggest reading the comments below each answer, and follow any links provided by the answer’s author before making your decision. In my opinion, for this question, the accepted answer is incorrect.

Change can occur in more than one way. Variable files may change in size (footprint) or possibly quantity. Use /var if you have a set number of files which may be growing (i.e. due to log appending or rotation) over time so as not to run out of disk space.

From man hier , which has a «description of the filesystem hierarchy:»

/var This directory contains files which may change in size, such as spool and log files.

/var/account Process accounting logs (optional).

/var/adm This directory is superseded by /var/log and should be a symbolic link to /var/log .

/var/backups Reserved for historical reasons.

/var/cache Data cached for programs.

/var/cache/fonts Locally-generated fonts (optional).

/var/cache/man Locally-formatted man pages (optional).

/var/cache/www WWW proxy or cache data (optional).

/var/cache/ Package specific cache data (optional).

/var/catman/cat8 or /var/cache/man/cat7 These directories contain preformatted manual pages according to their man page section. (The use of preformatted manual pages is deprecated.)

/var/crash System crash dumps (optional).

/var/cron Reserved for historical reasons.

/var/games Variable game data (optional).

/var/lib Variable state information for programs.

/var/lib/hwclock State directory for hwclock (optional).

/var/lib/misc Miscellaneous state data.

/var/lib/xdm X display manager variable data (optional).

/var/lib/ Editor backup files and state (optional).

/var/lib/ These directories must be used for all distribution packaging support.

/var/lib/ State data for packages and subsystems (optional).

/var/lib/ Packaging support files (optional).

/var/local Variable data for /usr/local.

/var/lock Lock files are placed in this directory. The naming convention for device lock files is LCK.. where is the device’s name in the filesystem. The format used is that of HDU UUCP lock files, that is, lock files contain a PID as a 10-byte ASCII decimal number, followed by a newline character.

/var/log Miscellaneous log files.

/var/opt Variable data for /opt .

/var/mail Users’ mailboxes. Replaces /var/spool/mail .

/var/msgs Reserved for historical reasons.

/var/preserve Reserved for historical reasons.

/var/run Run-time variable files, like files holding process identifiers (PIDs) and logged user information (utmp). Files in this directory are usually cleared when the system boots.

/var/spool Spooled (or queued) files for various programs.

/var/spool Spooled (or queued) files for various programs.

/var/spool/at Spooled jobs for at(1) .

/var/spool/cron Spooled jobs for cron(8) .

/var/spool/lpd Spooled files for printing (optional).

/var/spool/lpd/printer Spools for a specific printer (optional).

/var/spool/mail Replaced by /var/mail.

/var/spool/mqueue Queued outgoing mail (optional).

/var/spool/news Spool directory for news (optional).

/var/spool/rwho Spooled files for rwhod(8) (optional).

/var/spool/smail Spooled files for the smail(1) mail delivery program.

/var/spool/uucp Spooled files for uucp(1) (optional).

/var/tmp Like /tmp, this directory holds temporary files stored for an unspecified duration.

/var/yp Database files for NIS, formerly known as the Sun Yellow Pages (YP).

Источник

Читайте также:  Как залогиниться в linux

Linux what is var cache

Библиотека сайта rus-linux.net

/var/cache предназначен для кэширования данных приложениями. Необходимость такого кэширования возникает при выполнении медленных процессов ввода-вывода или для хранения промежуточных результатов вычислений. Приложения должны иметь возможность регенерировать кэш и извлечь данные из кэша. В отличие от /var/spool , кэшированные файлы могут быть удалены без потери данных. Данные должны сохраняться между сеансами работы приложения и при перезагрузках системы.

Файлы, расположенные в /var/cache , могут удаляться либо самим приложением, либо администратором. Приложение должно всегда иметь возможность продолжить работу после удаления этих файлов вручную (например, при нехватке дискового пространства). Никаких других требований на формат данных в каталоге кэша не накладывается.

НАЧАЛО ПОЯСНЕНИЙ

Существование отдельной директории для кэшируемых данных позволяет системным администраторам устанавливать для этого каталога правила использования и резервного копирования, отличающиеся от правил, устанавливаемых для других каталогов в /var .

КОНЕЦ ПОЯСНЕНИЙ

5.5.2 Рекомендации

Дерево 5.5.2.1

5.5.3 /var/cache/fonts : Локально сгенерированные шрифты (optional)

5.5.3.1 Назначение

Каталог /var/cache/fonts должен использоваться для хранения динамически создаваемых шрифтов. В частности, все шрифты, автоматически генерируемые программой mktexpk , должны размещаться в соответствующим образом названных подкаталогах каталога /var/cache/fonts . [примечание 31]

5.5.3.2 Рекомендации

Другие динамически создаваемые шрифты могут тоже размещаться в этом дереве, в соответствующим образом названных подкаталогах каталога /var/cache/fonts .

5.5.4 /var/cache/man : Локально отформатированные страницы руководства (optional)

5.5.4.1 Назначение

  • Хранить предварительно отформатированные версии всех страниц руководства параллельно с не отформатированными версиями.
  • Не допускать кэширования отформатированных страниц на диск, требуя, чтобы форматирование выполнялось при каждом обращении к конкретной странице руководства.
  • Разрешить хранение отформатированных man-страниц в каталоге /var/cache/man .
НАЧАЛО ПОЯСНЕНИЙ

Версия 1.2 настоящего стандарта определяла каталог /var/catman для этой структуры. Теперь ее местоположение перенесено в /var/cache для более адекватного отражения динамической природы форматированных страниц руководства. Название каталога было заменено на man , что более соответствует динамической структуре форматированных страниц руководства. Имя каталога было заменено на man , для того, чтобы дать возможность включить в каталоговую структуру каталоги для новых форматов, отличных от «cat», таких, например, как PostScript, HTML или DVI.

Читайте также:  Linux deleting file command
КОНЕЦ ПОЯСНЕНИЙ

[31] Настоящий стандарт пока не предусматривает поглощение или замену the TeX Directory Structure (документ, который задает размещение файлов формата TeX и структуру соответствующих каталогов), так что этот документ полезно прочитать. Он размещается по адресу ftp://ctan.tug.org/tex/ . [32] Например, отформатированный вариант страницы /usr/share/man/man1/ls.1 размещается как /var/cache/man/cat1/ls.1 , а /usr/X11R6/man//man3/XtClass.3x — как /var/cache/man/X11R6//cat3/XtClass.3x . Previous: /var/account : Протоколы работы процессов (optional)
Next: /var/crash : Дампы памяти при крахе системы (optional)
Up: Оглавление
Translated by troff2html v1.5 on 29 March 2002 by Daniel Quinlan

Источник

Linux what is var cache

/var/cache is intended for cached data from applications. Such data is locally generated as a result of time-consuming I/O or calculation. The application must be able to regenerate or restore the data. Unlike /var/spool , the cached files can be deleted without data loss. The data must remain valid between invocations of the application and rebooting the system.

Files located under /var/cache may be expired in an application specific manner, by the system administrator, or both. The application must always be able to recover from manual deletion of these files (generally because of a disk space shortage). No other requirements are made on the data format of the cache directories.

Rationale

The existence of a separate directory for cached data allows system administrators to set different disk and backup policies from other directories in /var .

5.5.2. Specific Options

Directory Description
fonts Locally-generated fonts (optional)
man Locally-formatted manual pages (optional)
www WWW proxy or cache data (optional)
Package specific cache data (optional)

5.5.3. /var/cache/fonts : Locally-generated fonts (optional)

5.5.3.1. Purpose

The directory /var/cache/fonts should be used to store any dynamically-created fonts. In particular, all of the fonts which are automatically generated by mktexpk must be located in appropriately-named subdirectories of /var/cache/fonts . [38]

5.5.3.2. Specific Options

Other dynamically created fonts may also be placed in this tree, under appropriately-named subdirectories of /var/cache/fonts .

5.5.4. /var/cache/man : Locally-formatted manual pages (optional)

5.5.4.1. Purpose

This directory provides a standard location for sites that provide a read-only /usr partition, but wish to allow caching of locally-formatted man pages. Sites that mount /usr as writable (e.g., single-user installations) may choose not to use /var/cache/man and may write formatted man pages into the cat directories in /usr/share/man directly. We recommend that most sites use one of the following options instead:

  • Preformat all manual pages alongside the unformatted versions.
  • Allow no caching of formatted man pages, and require formatting to be done each time a man page is brought up.
  • Allow local caching of formatted man pages in /var/cache/man .

The structure of /var/cache/man needs to reflect both the fact of multiple man page hierarchies and the possibility of multiple language support.

Given an unformatted manual page that normally appears in /man//man , the directory to place formatted man pages in is /var/cache/man///cat , where is derived from by removing any leading usr and/or trailing share pathname components. (Note that the component may be missing.) [39]

Man pages written to /var/cache/man may eventually be transferred to the appropriate preformatted directories in the source man hierarchy or expired; likewise formatted man pages in the source man hierarchy may be expired if they are not accessed for a period of time.

If preformatted manual pages come with a system on read-only media (a CD-ROM, for instance), they must be installed in the source man hierarchy (e.g. /usr/share/man/cat ). /var/cache/man is reserved as a writable cache for formatted manual pages.

Rationale

Release 1.2 of this standard specified /var/catman for this hierarchy. The path has been moved under /var/cache to better reflect the dynamic nature of the formatted man pages. The directory name has been changed to man to allow for enhancing the hierarchy to include post-processed formats other than «cat», such as PostScript, HTML, or DVI.

[38] This standard does not currently incorporate the TeX Directory Structure (a document that describes the layout TeX files and directories), but it may be useful reading. It is located at ftp://ctan.tug.org/tex/

[39] For example, /usr/share/man/man1/ls.1 is formatted into /var/cache/man/cat1/ls.1 , and /usr/X11R6/man//man3/XtClass.3x into /var/cache/man/X11R6//cat3/XtClass.3x .

Источник

Оцените статью
Adblock
detector