The Fedora Core Linux File System Basics

 < Day Day Up > 

The Fedora Core Linux file system, like all Unix file systems, is used for storing not only data, but also metadata information about the files, such as who the file owner is, what permissions are associated with the file, and other file attributes.

The Fedora Core Linux file system is much more complex than most people care to know about. Its features are patterned after features found on commercial Unix systems, as well as those included in research or experimental file systems. In this section of the chapter, you learn what the Fedora Core Linux file system is, how it is structured, and how you work with it in the management of the Fedora Core Linux system both as a user and a system administrator.

Fortunately, the native Linux file system is robust and works well with the default settings. Fedora Core has conveniently provided an easy-to-use setup tool for use during the installation, but here, you also learn how to manage file system settings manually.

Providing a great deal of flexibility, the file system support allows Linux users to access files on file systems used by other operating systems, many of which are obscure. A sampling of the Fedora Core kernel modules for supported file systems is as follows:

bfs SCO Unixware Boot file system

coda Carnegie Mellon University network file system

cramfs Compressed ROM file system

ext3 Linux Extended File System 3 (adds journaling to ext2)

fat Microsoft File Allocation Table file system: FAT 12 and FAT 16

freevxfs Free version of the Veritas VxFS file system used by SCO: Unixware, Sun Solaris, HP-UX

hfs Macintosh: Hierarchical file system

jfs IBM's journaled file system

minix Minix file system

msdos Microsoft File Allocation Table -16

ncfps Novell Corporation protocol file system

nfs Network file system

ntfs Windows NT, Windows 2000, Windows XP

reiserfs Reiser file system

romfs ROM file system

smbfs File system based on the use of the Shared Message Block protocol used by Microsoft and Samba

sysv System V Coherent file system: Xenix, System V, Coherent

udf Universal Disk Format (DVD-ROM file system)

ufs Unix file system used on BSD, Sun, and Mac OS X

umsdos MS-DOS file system with Linux permissions

vfat Microsoft File Allocation Table file system known as FAT32

Support for ext3, ext2, NFS, and iso9660 file systems is compiled into the Linux kernel; all others are available as modules.

There is not an exact correlation between the file system source code and the modules compiled for the default kernel. The kernel documentation for the file systems can be found at /usr/src/linux-2.6/Documentation/file systems/. The usage of some of these file system modules is mentioned in the man page for mount.

Physical Structure of the File System on the Disk

If you were to visualize the file system on the physical disk, it would resemble a series of boxes known as blocks. The first block on the disk is a special block that contains the boot sector; subsequent blocks contain the operating system, applications, and your data.

Each individual block is made up of smaller groups of data:

  • A superblock (called by that name because it contains redundant information about the overall file system).

  • Redundant file system descriptors All the redundant information is useful for reliability and recovery from disasters and errors.

  • A bitmap of the block.

  • A bitmap of the inode table.

  • Information from the inode table.

  • The data blocks.

Inodes and File Attributes

The informationthat constitutes a file in the ext2/etx3 file system begins with the inode.

The inode contains the following description of the file: the file type, its access rights, its owners, several different time stamps, the file size, and pointers to data blocks that hold the file information. When you want to access a file, the kernel uses those pointers to calculate where the data resides physically on the disk.

File attributes are also stored in the inode. The chattr command enables the root operator to manipulate some special attributes of files on an ext2/3 file system. One of the most interesting uses of the chattr command is to make a file immutable, meaning that it cannot be deleted, renamed, written to, or modified by anyone, even root (at least until the immutable attribute is un-set). To make a file immutable (the word means unalterable; not capable of change)

 # chattr +i filename 

and to change it back

 # chattr -i filename 

Another interesting flag is the s flag, which tells the system to zero out all the blocks used for that file when the file is deleted.

To observe the existing attributes of a file, use

 # lsattr filename 

The chattr utility is part of the e2fsprogs package.

A file's attributes include its access permissions. The traditional Unix systems of permissions is controlled with chmod. Posix Access Control Lists extend this functionality.

ACL supports permissions for users and groups beyond the traditional owner/group/world scheme. They enable finer-grained control of permissions for files.

To learn more about Access Control Lists, visit the Posix ACLs for Linux website: http://acl.bestbits.at/.


How big are these blocks? The default size is 1,024 bytes, but the size can be made smaller or larger when the file system is first created. The optimum size is determined by the application of the particular machine. If you typically use very large files, a larger block size can speed up disk I/O operations at the expense of slower I/O for smaller files; the reverse is also true. For an individual system, it might require monitoring over time and benchmarking before an optimal value is determined. For most users, the defaults have been found satisfactory.

File System Partitions

File system partitions are ways to organize blocks of data on the physical drive media and are parts of the overall file system on your computer. No single universal partition format exists. In addition to the commonly used DOS partition format (used by Linux as well), Fedora Core also provides support for the following partition types:

  • Acorn

  • Alpha OS (compiled into the kernel)

  • Amiga

  • Atari

  • Macintosh (compiled into the kernel)

  • BSD (compiled into the kernel)

  • Minix (compiled into the kernel)

  • SunOS/Solaris (compiled into the kernel)

  • Unixware slices (compiled into the kernel)

  • SGI (compiled into the kernel)

  • Windows Logical Disk Manager

  • DEC Ultrix (now owned by Hewlett Packard)

NOTE

Other modules and support are likely available if you care to search the Internet for them; try searching on the keyword file systems on http://freshmeat.net/ and http://www.google.com/linux/. As is always the case with open-source operating systems, any skilled and enterprising soul can write his own file system modules.


Network and Disk File Systems

We can separate file systems into two broad categories: those that can be used over a network and local disk file systems. You are provided with all the applications necessary to work with both categories of file systems when using Fedora Core Linux.

Network file systems are physically stored somewhere other than your local computer but appear as if they are mounted on your local computer.

NOTE

Mounting is the Unix method of attaching a file system (also referred to as a volume) to the file system tree at a mount point. Using the mount command is covered later in this chapter.


Some common network file system types are

  • NFS The Network File System was developed by Sun and is in common use. It has no built-in security because it was originally designed to run over friendly networks. Although considered problematic by some, it is easy to implement. It is typically used between Unix peers. Fedora Core supports client and server installations of this file system.

  • Coda Similar to NFS, Coda offers support for disconnected operation and security caching (keeping a local copy of files in case the network connection is lost). Fedora Core only provides kernel compatibility with Coda; the actual client and server code is available from http://www.coda.cs.cmu.edu/.

  • InterMezzo Similar in features to Coda, InterMezzo is a GPL project. The server daemon can be obtained from http://www.inter-mezzo.org/.

  • NCP Used to mount Novelle Netware volumes, its use is more fully described in the Linux Network Administrators Guide at http://www.tldp.org/LDP/nag2/x-087-2-ipx.ncpfs.client.html.

  • SMB The network-focused Server Message Block protocol was developed by Microsoft. The Linux implementation is known as Samba and is one of the most advanced open-source projects available. It is typically used between Linux and Microsoft Windows peers. Netatalk is the Macintosh equivalent protocol.

Disk file systems are found on a physical device; they are the hard drive in your desktop or laptop computer. Some common disk file system types are

  • FAT is a disk-oriented, table-based (a linked list) file system used by Microsoft. It has been regularly extended to add functionality. Microsoft's Enterprise-level file system is known as NTFS. (You learn more about this system in "DOS File Systems," later in this chapter.)

  • ext2, ext3, and reiserfs are inode-based. (You learn about reiserfs in "The Reiser File System (reiserfs)," later in this chapter.)

The JFS (Journaled File System from IBM) and XFS (from Silicon Graphics) file systems are available for use with Fedora Core Linux, but primarily as migration aids for those migrating existing file systems to Linux.

A journaling file system adds a journal, or hidden file, to the data on the drive. Because of the way data is written to a disk, the kernel might be holding some of the data while it is deciding where to place it. If your computer were to suffer a failure, that cached data would be lost. A journaling file system keeps that data in a special place until the kernel decides to formally write it to the disk. If a system failure occurs, a special application (fsck) knows that the data was never formally written and will make certain that it is written in the correct place. This ensures that no data is lost. Journaling file systems are actually much more complex than this, but the mechanics of them are beyond the scope of this chapter. Journaling file systems such as ext3, reiserfs, JFS, and XFS are major improvements over older, non-journaling file systems.

Viewing Your System's File Systems

Your installation of Fedora Core Linux might have its own unique set of usable virtual file system modules. You can view the file systems that your system can access right now (and verify your kernel's support for these file systems) by using the following command:

 # cat /proc/file systems 

Your output will vary, depending on your system's hardware and kernel settings. The test system we used for this chapter presented this output:

 nodev  rootfs nodev  bdev nodev  proc nodev  sockfs nodev  tmpfs nodev  shm nodev  pipefs        ext2 nodev  ramfs        iso9660 nodev  devpts        ext3 nodev  usbdevfs nodev  usbfs        ReiserFS        vfat nodev  nfs nodev  autofs nodev  binfmt_misc 

The entries not preceded by nodev are not of interest to us because they do not tell us any information about the file system. On this machine, the ext2, ext3, vfat, reiserfs, and iso9660 file systems are supported. Modules for other file systems could be loaded if needed.

     < Day Day Up > 


    Red Hat Fedora 4 Unleashed
    Red Hat Fedora 4 Unleashed
    ISBN: 0672327929
    EAN: 2147483647
    Year: 2006
    Pages: 361

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net