Var file system in linux

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.

Читайте также:  Дистрибутив linux для web

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/cat2 or /var/cache/man/cat5 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).

Источник

Читайте также:  Manjaro linux install nvidia driver

The /var Directory

/var is a standard subdirectory of the root directory in Linux and other Unix-like operating systems that contains files to which the system writes data during the course of its operation.

The root directory is the directory that contains all other directories and files on a system and which is designated by a forward slash ( / ). Among the other directories that are usually installed by default in the root directory are /bin, /boot, /dev, /etc, /home, /initrd, /lib, /lost+found, /misc, /mnt, /opt, /proc, /root, /sbin, /tmp and /usr.

/var is specific for each computer; that is, it is not shared over a network with other computers, in contrast to many other high-level directories. Its contents are not included in /usr because situations can occur in which it is desired to mount /usr as read-only, such as when it is on a CDROM or on another computer. /usr, which is generally the largest directory (at least on a newly installed system) and is used to store application programs, should only contain static data.

Among the various subdirectories within /var are /var/cache (contains cached data from application programs), /var/games (contains variable data relating to games in /usr), /var/lib (contains dynamic data libraries and files), /var/lock (contains lock files created by programs to indicate that they are using a particular file or device), /var/log (contains log files), /var/run (contains PIDs and other system information that is valid until the system is booted again) and /var/spool (contains mail, news and printer queues).

Created February 25, 2006.
Copyright © 2006 The Linux Information Project. All Rights Reserved.

Источник

Var file system in linux

LuckyAds поставлен 29.08.2022 —>

Наши партнеры

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

The /var contains data that is changed when the system is running normally. It is specific for each system, i.e., not shared over the network with other computers.

A cache for man pages that are formatted on demand. The source for manual pages is usually stored in /usr/share/man/man?/ (where ? is the manual section. See the manual page for man in section 7); some manual pages might come with a pre-formatted version, which might be stored in /usr/share/man/cat* . Other manual pages need to be formatted when they are first viewed; the formatted version is then stored in /var/cache/man so that the next person to view the same page won’t have to wait for it to be formatted.

Читайте также:  Linux test cpu performance

Any variable data belonging to games in /usr should be placed here. This is in case /usr is mounted read only.

Files that change while the system is running normally.

Variable data for programs that are installed in /usr/local (i.e., programs that have been installed by the system administrator). Note that even locally installed programs should use the other /var directories if they are appropriate, e.g., /var/lock .

Lock files. Many programs follow a convention to create a lock file in /var/lock to indicate that they are using a particular device or file. Other programs will notice the lock file and won’t attempt to use the device or file.

Log files from various programs, especially login( /var/log/wtmp , which logs all logins and logouts into the system) and syslog( /var/log/messages , where all kernel and system program message are usually stored). Files in /var/log can often grow indefinitely, and may require cleaning at regular intervals.

This is the FHS approved location for user mailbox files. Depending on how far your distribution has gone towards FHS compliance, these files may still be held in /var/spool/mail .

Files that contain information about the system that is valid until the system is next booted. For example, /var/run/utmp contains information about people currently logged in.

Directories for news, printer queues, and other queued work. Each different spool has its own subdirectory below /var/spool , e.g., the news spool is in /var/spool/news . Note that some installations which are not fully compliant with the latest version of the FHS may have user mailboxes under /var/spool/mail .

Temporary files that are large or that need to exist for a longer time than what is allowed for /tmp . (Although the system administrator might not allow very old files in /var/tmp either.)

Источник

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