Arch filesystem hierarchy (Italiano)

From ArchWiki
Revision as of 00:47, 21 August 2010 by Morbin (Talk | contribs) (/etc: Host-specific configuration)

Jump to: navigation, search

Template:Article summary start Template:Article summary text Template:Article summary heading Template:I18n entry Template:Article summary end

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Arch filesystem hierarchy (Italiano)#)

Tratto dal sito di FHS:

"Il filesystem standard è stato progettato per essere utilizzato dagli sviluppatori della distribuzione Unix, gli sviluppatori del pacchetto, e implementatori di sistema. Tuttavia, è principalmente destinato a essere un riferimento e non è un tutorial su come gestire un filesystem Unix o una gerarchia di directory."

Arch Linux è tra le molte distribuzioni che seguono il filesystem hierarchy standard. Oltre a spiegare tutte le directory con le loro denominazioni, in questo articolo verranno illustrate anche le modifiche specifiche per Arch.

Distinzione tra i file condivisibili e non condivisibili

"Condivisibili" sono definiti quei file che possono essere memorizzati su un host e utilizzati su altri. "Non condivisibili" sono, come da definizione, quelli che non sono condivisibili. Ad esempio, i file nelle directory home sono condivisibili, considerando che i file di blocco del dispositivo non lo sono. I file "statici" includono file binari, librerie, file di documentazione e altri non modificabili senza l'intervento dell'amministratore di sistema. Vengono definiti file "variabili", tutti quei file che non sono statici.

Il filesystem root

Il filesystem di root, rappresentato dal simbolo slash (/), è il filesystem principale da cui derivano tutti gli altri filesystem, il vertice della gerarchia. Tutti i file e le directory appaiono sotto la directory root "/", anche se sono memorizzati su dispositivi fisici differenti. Il contenuto del filesystem root deve essere adeguato per l'avvio, il ripristino, il recupero e/o la correzione del sistema.

/bin: Comandi binari indispensabili

È l'ubicazione per tutti quei binari che devono essere disponibili in modalità singolo utente ed accessibili a tutti gli utenti (ad esempio cat, ls, cp). /bin/ fornisce programmi che devono essere disponibili anche se è montata solo la partizione contenente /. Questa situazione può verificarsi in caso si abbia necessità di riparare altre partizioni, ma non si abbia accesso alle directory condivise (ad esempio, si è in modalità singolo utente e quindi non si ha accesso alla rete). A differenza di /sbin, la directory /bin contiene diversi comandi utili, disponibili sia all'utente root che agli utenti normali.

/boot: File statici del bootloader

È una directory statica, non condivisibile, contenente le immagini kernel e ramdisk, così come il file di configurazione del bootloader, e le varie fasi del bootloader stesso. /boot inoltre memorizza i dati che vengono utilizzati prima che il kernel inizi l'esecuzione dei programmi userspace. Ciò può includere settori di master boot salvati e file di tipo "sector-map".

/dev: File dei dispositivi

I nodi dei dispositivi essenziali creati da udev durante il processo di avvio, così come l'hardware della macchina, vengono rilevati da "events". Questa directory mette in luce un aspetto importante del filesystem UNIX - tutto è un file o una directory. L'esplorazione di questa directory rivelerà molti file, ognuno dei quali rappresenta un componente hardware del sistema. La maggior parte dei dispositivi sono dispositivi "block" o "character", ma possono essere creati anche altri tipi di dispositivi. In generale, i "dispositivi a blocchi" sono dispositivi che memorizzano o detengono dati, mentre i "character devices" possono essere definiti come dispositivi che trasmettono o trasferiscono dati. Ad esempio, hard disk e unità ottiche sono classificati come dispositivi a blocchi, mentre le porte seriali, mouse e porte USB sono tutti dispositivi "character".

/etc: Configurazioni specifiche host

Le specifiche host, file di configurazione non condivisibili, troveranno posto nella directory /etc. Se è necessario più di un file di configurazione per una determinata applicazione, è consuetudine utilizzare una sottodirectory, in modo da mantenere l'area del file /etc/ il più pulita possibile. È buona norma effettuare dei backup di questa directory con una certa frequenza, dal momento che contiene tutti i file di configurazione del sistema.

/etc/conf.d

Alcuni script dei demoni avranno un corrispondente file di configurazione in questa directory che contiene alcuni utili valori di default. Quando viene avviato un demone, il primo luogo da dove attinge le impostazioni è dal suo file di configurazione all'interno di questa directory, e successivamente da /etc/rc.conf. L'approccio allo scripting di Arch è semplice e trasparente, e consente di centralizzare facilmente tutte le opzioni di configurazione dei demoni in /etc/rc.conf, semplicemente impostando un valore appropriato variabile o, suddividere la configurazione in più file, se si preferisce un approccio più decentrato a questo proposito.

/etc/rc.d

Tutti i demoni Arch risiedono qui. Script personalizzati possono eventualmente essere aggiunti e invocati qui, nella stringa DAEMONS in /etc/rc.conf.

/etc/X11

File di configurazione per il sistema X Window.

/etc/X11/xinit

File di configurazione xinit. "Xinit" è un metodo di configurazione per avviare una sessione X, progettato per essere utilizzato come parte di uno script.

/etc/X11/xinit/xinitrc

File xinitrc globale, utilizzato da tutte le sessioni di X iniziate da xinit (startx). Il suo utilizzo è deprecato a favore del file .xinitrc, presente nella directory home dell'utente.

/home: User directories

UNIX is a multi-user environment. Therefore, each user is also assigned a specific directory that is accessible only to them and to the root user. These are the user home directories, which can be found under '/home/$USER' (~/). Within their home directory, a user can write files, delete them, install programs, etc. Users' home directories contain their data and personal configuration files, the so-called 'dot files' (their name is preceded by a dot), which are 'hidden'. To view dotfiles, enable the appropriate option in your file manager or run ls with the -a switch. If there is a conflict between personal and system wide configuration files, the settings in the personal file will prevail. Dotfiles most likely to be altered by the end user include .xinitrc and .bashrc files. The configuration files for xinit and Bash respectively. They allow the user the ability to change the window manager to be started upon login and also aliases, user-specified commands and environment variables respectively. When a user is created, their dotfiles shall be taken from the /etc/skel directory where system sample files reside.

Directory /home can become quite large as it is typically used for storing downloads, compiling, installing and running programs, mail, collections of multimedia files etc.

/lib: Essential shared libraries and kernel modules

Contains kernel modules and essential shared library images (the C programming code library) needed to boot the system and run the commands under /bin/ and /sbin/. Libraries are collections of frequently used program routines and are readily identifiable through their filename extension of *.so. They are essential for basic system functionality. Kernel modules (drivers) are in the subdirectory /lib/modules/<kernel-version>.

/lost+found: Filesystem-specific recoverable data

UNIX-like operating systems must execute a proper shutdown sequence. At times, a system might crash or a power failure might take the machine down. Either way, at the next boot, a filesystem check using the fsck program shall be performed. Fsck will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in this directory. The files recovered are not likely to be complete or make much sense but there always is a chance that something worthwhile is recovered.

/media: Mount points for removable media

CDROMs, DVD's, and USB sticks shall have an appropriate mount point under /media/. The motivation for the creation of this directory has been that historically there have been a number of other different places used to mount removable media such as /cdrom, /mnt or /mnt/cdrom. Placing the mount points for all removable media directly in the root directory would potentially result in a large number of extra directories in /. Although the use of subdirectories in /mnt as a mount point has recently been common, it conflicts with a much older tradition of using /mnt directly as a temporary mount point. Therefore, Arch allocates /media as the mount point for removable media. On systems where more than one device exists for mounting a certain type of media, mount directories shall be created by appending a digit to the name of those available above starting with '0', but the unqualified name must also exist.

The "hal" (Hardware Abstraction Layer) daemon mounts removable media to /media as /media/<name_of_removable_filesystem>

/mnt: Temporary mount points

This is a generic mount point for temporary filesystems or devices. Mounting is the process of making a filesystem available to the system. After mounting, files will be accessible under the mount-point. Additional mount-points (subdirectories) may be created under /mnt/. There is no limitation to creating a mount-point anywhere on the system, but by convention and for practicality, littering a file system with mount-points should be avoided.

/opt: Problematic packages

Packages and large static files that do not fit cleanly into the above GNU filesystem layout can be placed in /opt. A package placing files in the /opt/ directory creates a directory bearing the same name as the package. This directory in turn holds files that otherwise would be scattered throughout the file system. For example, the acrobat package has Browser, Reader, and Resource directories sitting at the same level as the bin directory. This doesn't fit into a normal GNU filesystem layout, so Arch places all the files in a subdirectory of /opt.

/proc: Process information

Directory /proc is very special in that it is also a virtual filesystem. It is sometimes referred to as the process information pseudo-file system. It doesn't contain 'real' files, but rather, runtime system information (e.g. system memory, devices mounted, hardware configuration, etc). For this reason it can be regarded as a control and information center for the kernel. In fact, quite a lot of system utilities are simply calls to files in this directory. For example, 'lsmod' is the same as 'cat /proc/modules' while 'lspci' is a synonym for 'cat /proc/pci'. By altering files located in this directory, kernel parameters may be read/changed (sysctl) while the system is running.

The most distinctive facet about files in this directory is the fact that all of them have a file size of 0, with the exception of kcore, mounts and self.

/root: Administrator directory

Home directory of the System Administrator, 'root'. This may be somewhat confusing, ('/root under root') but historically, '/' was root's home directory (hence the name of the Administrator account). To keep things tidier, 'root' eventually got his own home directory. Why not in '/home'? Because '/home' is often located on a different partition or even on another system and would thus be inaccessible to 'root' when - for some reason - only '/' is mounted.

/sbin: System binaries

UNIX discriminates between 'normal' executables and those used for system maintenance and/or administrative tasks. The latter reside either here or - the less important ones - in /usr/sbin. Programs executed after /usr is known to be mounted (when there are no problems) are generally placed into /usr/sbin. This directory contains binaries that are essential to the working of the system. These include system administration as well as maintenance and hardware configuration programs. GRUB (the command), fdisk, init, route, ifconfig, etc., all reside here.

/srv: Service data

Site-specific data which is served by the system. The main purpose of specifying this is so that users may find the location of the data files for a particular service, and so that services which require a single tree for read-only data, writable data and scripts (such as CGI scripts) can be reasonably placed. Data of interest to a specific user shall be placed in that user's home directory.

/tmp: Temporary files

This directory contains files that are required temporarily. Many programs use this to create lock files and for temporary storage of data. Do not remove files from this directory unless you know exactly what you are doing! Many of these files are important for currently running programs and deleting them may result in a system crash. On most systems, this directory is cleared out at boot or at shutdown by the local system. The basis for this was historical precedent and common practice.

/usr: Shareable, read-only data

While root is the primary filesystem, /usr is the secondary hierarchy, for user data, containing the majority of (multi-)user utilities and applications. /usr is shareable, read-only data. This means that /usr shall be shareable between various hosts and must not be written to, except in the case of system administrator intervention (installation, update, upgrade). Any information that is host-specific or varies with time is stored elsewhere.

Aside from /home/, /usr/ usually contains by far the largest share of data on a system. Hence, this is one of the most important directories in the system as it contains all the user binaries, their documentation, libraries, header files, etc. X and its supporting libraries can be found here. User programs like telnet, ftp, etc., are also placed here. In the original UNIX implementations, /usr/ (for user), was where the home directories of the system's users were placed (that is to say, /usr/someone was then the directory now known as /home/someone). Over time, /usr/ has become where userspace programs and data (as opposed to 'kernelspace' programs and data) reside. The name has not changed, but its meaning has narrowed and lengthened from everything user related to user usable programs and data. As such, the backronym 'User System Resources' was created.

/usr/bin: Binaries

Non-essential command binaries (not needed in single user mode); for all users. This directory contains the vast majority of binaries (applications) on your system. Executables in this directory vary widely. For instance vi, gcc, and gnome-session reside here.

/usr/include: Header files

Header files needed for compiling userspace source code..

/usr/lib: Libraries

Libraries for the binaries in /usr/bin/ and /usr/sbin/.

/usr/sbin: System binaries

Non-essential system binaries of use to the system administrator. This is where the network daemons for the system reside, along with other binaries that (generally) only the system administrator has access to, but which are not required for system maintenance and repair. Normally, these directories are never part of normal user's $PATHs, only of root's (PATH is an environment variable that controls the sequence of locations that the system will attempt to look in for commands).

/usr/share: Architecture independent data

This directory contains 'shareable', architecture-independent files (docs, icons, fonts etc). Note, however, that '/usr/share' is generally not intended to be shared by different operating systems or by different releases of the same operating system. Any program or package which contains or requires data that don't need to be modified should store these data in '/usr/share/' (or '/usr/local/share/', if manually installed - see below). It is recommended that a subdirectory be used in /usr/share for this purpose.

/usr/src: Source code

The 'linux' sub-directory holds the Linux kernel sources, and header-files.

/usr/local: Local hierarchy

Optional tertiary hierarchy for local data. The original idea behind '/usr/local' was to have a separate ('local') '/usr/' directory on every machine besides '/usr/', which might be mounted read-only from somewhere else. It copies the structure of '/usr/'. These days, '/usr/local/' is widely regarded as a good place in which to keep self-compiled or third-party programs. This directory is empty by default in Arch Linux. It may be used for manually compiled software installations if desired. pacman installs to /usr/, therefore, manually compiled/installed software installed to /usr/local/ may peacefully co-exist with pacman-tracked system software.

/var: Variable files

Variable files, such as logs, spool files, and temporary e-mail files. On Arch, the ABS tree and pacman cache also reside here. Why not put the variable and transient data into /usr/? Because there might be circumstances when /usr/ is mounted as read-only, e.g. if it is on a CD or on another computer. '/var/' contains variable data, i.e. files and directories the system must be able to write to during operation, whereas /usr/ shall only contain static data. Some directories can be put onto separate partitions or systems, e.g. for easier backups, due to network topology or security concerns. Other directories have to be on the root partition, because they are vital for the boot process. 'Mountable' directories are: '/home', '/mnt', '/tmp', '/usr' and '/var'. Essential for booting are: '/bin', '/boot', '/dev', '/etc', '/lib', '/proc' and '/sbin'.

/var/abs

The ABS tree. A ports-like package build system hierarchy containing build scripts within subdirectories corresponding to all installable Arch software.

/var/cache/pacman/pkg

The pacman package cache.

/var/lib: State information

Persistent data modified by programs as they run (e.g. databases, packaging system metadata etc.).

/var/lock: Unsharable lock data

Files keeping track of resources currently in use.

/var/log: Log files

Log files.

/var/mail: User mail

Shareable directory for users' mailboxes.

/var/run: State information

Unshareable data about the running system since last boot (e.g. currently logged-in users and running daemons).

/var/spool: Queues

Spool for tasks waiting to be processed (e.g. print queues and unread mail).

/var/spool/mail

Deprecated location for users' mailboxes.

/var/tmp: Preservable temporary files

Temporary files to be preserved between reboots.