2.2. Inodes sysv [493]). As their name implies, (Make web site)

March 20th, 2008

2.2. Inodes sysv [493]). As their name implies, their purpose is to link files in a symbolic way, which means that they are files whose content is the path to a different file. They may not point to an existing file. They are very frequently called soft links, and such files are identified by the letter l. 4. Named pipes: in case you were wondering, yes, these are very similar to pipes used in shell commands, but with the difference that these actually have names. However they are very rare and it’s not likely that you will see one during your journey into the file tree. Such files are identified by the letter p. See Section 4, Anonymous Pipes and Named Pipes [413]. 5. Sockets: this is the file type for all network connections, but only a few of them have names. What’s more, there are different types of sockets and only one can be linked, but this is way beyond the scope of this book. Such files are identified by the letter s. Here is a sample of each file: $ ls -l /dev/null /dev/sda /etc/rc.d/rc3.d/S20random /proc/554/maps /tmp/ssh-queen/ssh-510-agent crw-rw-rw-1 root root 1, 3 May 5 1998 /dev/null brw-rw—-1 root disk 8, 0 May 5 1998 /dev/sda lrwxrwxrwx 1 root root 16 Dec 9 19:12 /etc/rc.d/rc3.d/ S20random -> ../init.d/random* pr–r–r–1 queen queen 0 Dec 10 20:23 /proc/554/maps| srwx——1 queen queen 0 Dec 10 20:08 /tmp/ssh-queen/ ssh-510-agent= $ 2.2. Inodes Inodes are, along with the Everything Is a File paradigm, a fundamental part of any UNIX file system. The word inode is short for Information NODE . Inodes are stored on disk in an inode table. They exist for all types of files which may be stored on a file system, including directories, named pipes, character-mode files and so on. Which leads to this other famous sentence: The inode is the file . Inodes are how UNIX identifies a file in a unique way. No, you didn’t misread that: in UNIX, you do not identify a file by its name, but by 1 its inode number. The reason for this is that the same file may have several names, Important: note that inode numbers are unique per file system, which means that an inode with the same number can exist on another file system. This leads to the difference between on-disk inodes and in- memory inodes. While two on-disk inodes may have the same number if they are on two different file

Multiple domain web hosting - 2. Everything is a File server, a journalized

March 20th, 2008

2. Everything is a File server, a journalized file system such as ext3 is preferred. reiserfs, perhaps because of its genesis, is more suited to a database server. JFS is preferred in cases were file system throughput is the main issue. XFS is interesting if you need any of its advanced features. For normal use, these four file systems give approximately the same results and all of them have different options to tune the file system for a particular use. Please refer to the file system’s documentation for more information. 2. Everything is a File We introduced the file ownership and permissions access concepts, but really un derstanding the UNIXfile system (and this also applies to Linux’s file systems) requires that we redefine the concept of What is a file . Here, everything really means everything. A hard disk, a partition on a hard disk, a parallel port, a connection to a web site, an Ethernet card: all these are files. Even directories are files. Linux recognizes many types of files in addition to the standard files and directories. Note that by file type here, we do not mean the type of content of a file: for GNU/Linux and any UNIX system, a file, whether it be a PNG image, a binary file or whatever, is just a stream of bytes. Differentiating files according to their contents is left to applications. 2.1. The Different File Types When you issue ls -l, the character before the access rights identifies the file type. We have already seen two types of files: regular files (-) and directories (d). You can also find other types if you wander through the file tree and list the contents of directories: 1. Character mode files: they are either special system files (such as /dev/null, which we have already discussed), or peripherals (serial or parallel ports), which share the trait that their contents (if they have any) are not buffered (meaning they are not kept in memory). Such files are identified by the letter c. 2. Block mode files: these files are peripherals, and unlike character files, their contents are buffered. For example, some files in this category are: hard disks, partitions on a hard disk, floppy drives, CD-ROM drives and other storage devices. Files like /dev/hda, /dev/sda5 are examples of block-mode files. Such files are identified by the letter b. 3. Symbolic links: these files are very common and heavily used in the Mandriva Linux system start-up procedure (see Chapter 37, The Start-Up Files: init

1.2. Differences Between File Systems 1.2. Differences Between (Multiple domain web hosting)

March 19th, 2008

1.2. Differences Between File Systems 1.2. Differences Between File Systems Table 30.1. File System Characteristics Tools to restore Yes (complex) Yes (com-No No No erased files plex) XFSJFSReiserFS Ext3Ext2 GoodMediumGoodVery Good Excellent Stability Very fast Very fast Very fast Fast Long, even very long Reboot time after crash Very good Very good MediumaVery good Generally speak- ing, good, but high risk of partial or total data loss Status of the data in case of a crash Yes No No Yes Yes ACL support a It is possible to improve results on crash recovery by journaling the data and not just the metadata, adding the option data=journal to /etc/fstab. The maximum size of a file depends on many parameters (i.e. the block size for ext2/ext3), and is likely to evolve depending on the kernel version and architecture. In kernel 2.6.X the block device limit can be extended using a kernel compiled with Large Block Device support enabled (CONFIG_LBD=y). For more information, consult Adding Support for Arbitrary File Sizes to the Single UNIX Specification [http:// www.unix.org/version2/whatsnew/lfs.html], Large File Support in Linux [http: //www.suse.com/~aj/linux_lfs.html], and Large Block Devices [http://www. gelato.unsw.edu.au/IA64wiki/LargeBlockDevices]. With this and a file system which supports it you can reach up to many TB without special file-system tricks as is done by JFS for the file-system size. 1.3. And Performance Wise? It is always very difficult to compare performance between file systems. All tests have their limitations and the results must be interpreted with caution, comparisons done a couple of months or weeks ago are already too old. Let’s not forget that today’s hardware (specially concerning hard drive capacities and hard disk controller performance) has greatly leveraged the differences between the different file systems. Each system offers advantages and disadvantages. In fact, it all depends on how you use your machine. A simple desktop machine will be happy with ext2. For a

1.1. Different Usable File Systems note daily events. (Web site counters)

March 18th, 2008

1.1. Different Usable File Systems note daily events. The result: an always coherent file system. And if problems occur, the verification is very rapid and the eventual repairs, very limited. Therefore the time spent in verifying a file system is proportional to its actual use and not related to its size. So ext3 offers journaling file system technology while keeping ext2’s structure, ensuring excellent compatibility. This makes it very easy to switch from ext2 to ext3 and back again. As with ext2, it needs to be unmounted to be resized. 1.1.3. ReiserFS Unlike ext3, reiserfs was written from scratch. It is a journalized file system like ext3, but its internal structure is radically different because it uses binary-tree concepts inspired by database software and also has a variable block size, making it optimal for use with several (thousands or hundreds of thousands of) small files. It also performs well with big files, making it suitable for various uses. It can be resized on the fly , without unmounting the file system. 1.1.4. JFS JFS is the journalized file system designed and used by IBM. Proprietary and closed at first, IBM decided to open it to access to the free software movement. Its internal structure is similar to that of reiserfs. It can not be resized on GNU/Linux. 1.1.5. XFS XFS is the journalized file system designed by SGI and also used with the Irix operating system. Proprietary and closed at first, SGI decided to open it to access by the free software movement. Its internal structure has lots of different features, such as support for real-time bandwidth, extents, and clustered file systems (but not in the free version). With GNU/Linux it can be resized for a bigger size only. You can’t reduce it. Resizing can only be made with a mounted filesystem.

Chapter 30. The Linux File System Your GNU/Linux

March 18th, 2008

Chapter 30. The Linux File System Your GNU/Linux system is contained on your hard disk within a file system. In this chapter we will discuss the various aspects of file systems available on GNU/Linux, as well as the possibilities they offer. 1. Comparing a Few File Systems During installation, you can choose different file systems for your partitions, so they will be formatted using different algorithms. Unless you are a specialist, choosing a file system is not obvious. We will take a quick look at a few current file systems, all of which are available with Mandriva Linux. 1.1. Different Usable File Systems 1.1.1. Ext2 The Second Extended File System (its abbreviated form is ext2FS or simply ext2) has been GNU/Linux’s default file system for many years. It replaced the Extended File System (that’s where the Second comes from). ext2 corrects certain problems and limitations of its predecessor. ext2 respects the usual standards for UNIX-type file systems. Since its inception, it was destined to evolve while still offering great robustness and good performance. Caution: It needs to be unmounted to be resized. 1.1.2. Ext3 As its name suggests, the Third Extended File System is ext2’s successor. It is compatible with the latter but enhanced by incorporating journaling. One of the major flaws of traditional file systems like ext2 is their low tolerance to abrupt system breakdowns (power failure or crashing software). Generally speaking, once the system is restarted, these types of events involve a very long examination of the file system’s structure and attempts to correct errors, which sometimes results in an extended corruption. This corruption could cause partial or total loss of saved data. Journaling answers this problem. To simplify, let’s say that what we are doing is storing the actions (such as the saving of a file) before really performing them. We could compare this functionality to that of a boat captain who uses a log book to

Php web hosting - 406

March 17th, 2008

406

5. /etc: Configuration Files crontab: the (Web domain) configuration

March 16th, 2008

5. /etc: Configuration Files crontab: the configuration file for cron, the program responsible for periodic execution of commands. Certain sub-directories exist for programs which require a large number of configuration files. This applies to the X Window System, for example, which stores all of its configuration files in the /etc/X11 directory.

4. /var: Data Modifiable During (Web server hosting) Use 4. /var:

March 15th, 2008

4. /var: Data Modifiable During Use 4. /var: Data Modifiable During Use The /var directory contains all operative data for programs running on the system. Unlike the working data in /tmp, this data must be kept intact in the event of a reboot. There are many sub-directories, and some are very useful: /var/log: contains the system’s log files which you may read to troubleshoot your system (/var/log/messagesand /var/log/kernel/errors to only name those two). /var/run: used to keep track of all processes utilized by the system since it was booted, enabling you to act on them in the event of a system runlevel change (see Chapter 37, The Start-Up Files: init sysv [493]). /var/spool: contains the system’s working files waiting for some kind of action or processing. For example, /var/spool/cups contains the print server’s working files, while /var/spool/mail contains the mail server’s working files (for example, all mail arriving and leaving your system). 5. /etc: Configuration Files /etcis one of UNIX systems’ most essential directories because it contains all the host-specific configuration files. Never delete it to save space! Likewise, if you want to extend your tree structure over several partitions, remember that /etc must not be put on a separate partition: it is needed for system initialization and must be on the root partition at boot time. Here are some important files: passwdand shadow: these are text files which contain all system users and their encrypted passwords. You will only see shadow if shadow passwords are used, which happens to be the default installation option for security reasons. inittab: this is the configuration file for init which plays a fundamental role in starting up the system. Please refer to Section 5.3.1, Booting Into a Different Run Level [364]. services: this file contains a list of existing network services. profile: this is the shell system-wide configuration file. Its settings can be overridden by shell-specific configuration files. For example, .bashrc for the bash shell.

3. /usr: The Big One /var: location (Web hosting india)

March 15th, 2008

3. /usr: The Big One /var: location for data which may be modified in real time by programs (such as mail servers, audit programs, print servers, etc.). Variable. Its various subdirectories may be shareable or unshareable. 3. /usr: The Big One The /usr directory is the main application-storage directory. The binary files in this directory are not required for system start-up or maintenance, so the /usr hierarchy may be, and often is, located on a separate file system. Because of its (usually) large size, /usr has its own hierarchy of sub-directories. We will mention just a few: /usr/X11R6: the entire X Window System hierarchy. All binaries and libraries required for the operation of X (including the X servers) must be located here. The /usr/X11R6/lib/X11 directory contains all aspects of X’s configuration which do not vary from one computer to another. Specific configurations for each computer should go in /etc/X11. /usr/bin: contains the majority of the system’s binaries. Any binary program which isn’t necessary for the maintenance of the system and isn’t a system administration program must be located in this directory. The only exceptions are programs you compile and install yourself, which must be located in /usr/local. /usr/lib: contains all the necessary libraries to run programs located in /usr/binand /usr/sbin. There is also a /usr/lib/X11symbolic link pointing to /usr/X11R6/lib/X11, the directory which contains the X Window System 1 libraries (but only if X is installed). /usr/local: this is where you must install any applications you compile from source. The installation program should create the necessary hierarchy. /usr/share: this directory contains all read-only, architecture-independent data required by applications in /usr. Among other things, you will find zone and location information (zoneinfo and locale). Let’s also mention the /usr/share/doc and /usr/share/man directories, which respectively contain application documentation and the system’s manual pages. Please note that Mandriva Linux now uses Xorg instead of X Window System as the default X Window system.

Web site directory - 2. The root Directory: / /dev: system

March 14th, 2008

2. The root Directory: / /dev: system device files (dev for DEVices). Some files contained by /dev are mandatory, such as /dev/null, /dev/zero, and /dev/tty. Static, unshareable. /etc: contains all configuration files specific to the computer. This directory cannot contain binary files. Static, unshareable. /home: where all the personal directories of the system’s users are located. This directory may or may not be shared (some large networks make it shareable via NFS). Your favorite application’s (like e-mail readers or browsers) configuration files are located in this directory and start with a period ( . ). For instance, the Mozilla configuration files lie in the .mozilla directory. Variable, shareable. /lib: it contains libraries which are essential to the system; it also stores kernel modules in the /lib/modules/KERNEL_VERSION sub-directory. It contains all libraries required by the binaries in the /binand /sbin directories. The optional ld* execution time linker/loader as well as the dynamically-linked C library libc.so must also reside in this directory. Static, unshareable. /mnt: directory containing the mount points for temporarily-mounted file systems such as /mnt/cdrom, /mnt/floppy, etc. The /mnt directory is also used to mount temporary directories (a USB card will be mounted in /mnt/removable, for instance). Variable, unshareable. /opt: contains packages not essential for system operation. It is reserved for add-on packages; packages such as Adobe Acrobat Reader are often installed into /opt. The FHS recommends that static files (binaries, libraries, manual pages, etc.) installed in the /opt structure be placed in /opt/package_nameand the specific configuration files in /etc/opt. /root: home directory for root. Variable, unshareable. /sbin: contains system binaries essential for system start-up. Most of these files can only be executed by root. A normal user may run them, but they might not do anything. Static, unshareable. /tmp: directory intended to contain temporary files which certain programs may create. Variable, unshareable. /usr: explained in more detail in Section 3, /usr: The Big One [403]. Static, shareable.