Choosing a File System


It's always good to remember that in Unix/Linux, a file system is not just the hierarchy of files and directories accessible through the shell or a GUI file manager.

File systems include the disk format type and the metadata surrounding files and directories. Because everything in Linux is a file with properties, permissions, and other attributes, everything attached to the system (printers, mice, keyboards, files on network servers, remote machines, FTP servers, and so on) is part of the file system.

When we talk of choosing a file system, though, we're talking about disk formats. The Linux kernel and SUSE Linux can work with many file systems. Table 18.1 shows the variety.

Table 18.1. Linux Compatibility with Various File Systems

Name

Description

Run Linux Natively

Read from Linux

Copy/Move Files

ReiserFS

Default SUSE Linux file system. Journaled.

Y

Y

Y

ext2

Extended file system. Default for many older Linux systems.

Y

Y

Y

ext3

ext2 with journal.

Y

Y

Y

JFS

IBM Journaled file system.

Y

Y

Y

XFS

Journaled file system originally for SGI IRIX, ported to Linux.

Y

Y

Y

Minix

The file system Linus Torvalds ported to the x86 platform.

N

Y

Y

NFS

Network file system.

N

Y

Y

FAT12

DOS floppy disk format.

N

Y

Y

FAT16

MS-DOS File Allocation Table.

N

Y

Y

FAT32/vfat

Windows 9x file system.

N

Y

Y

NTFS

Windows NT/2000/XP.

N

Y

NTFS > Linux only.

HFS

Macintosh Hierarchical file system.

N

Y

Y

ISO9660

CD-ROM file system.

N

Y

Y

UDF

Universal Disk Format for DVD-ROM

N

Y

Y


Understanding the Physical Structure of a Disk

All these file systems organize data on a disk in largely the same manner.

The differences between them, especially among the Unix/Linux file systems, are usually related to the speed of retrieval. Disks are organized (or formatted) in blocks. The first block of any disk is the boot sector, which contains a very short program (a few hundred bytes), which will load and start running the operating system.

In the case of a dual-boot system, a bootloading program, such as lilo or grub, will be stored there. All other blocks (sometimes called clusters or sectors) contain the operating system, all your application files, and all your data files that constitute your life.

In Unix and Linux, each block is 1024 bytes by default. A block contains several smaller bits of data:

  • A superblock, with redundant information about the complete file system.

  • More redundant file system descriptors, useful for reliability and disaster recovery. Also explains why it's really hard to recover when you remove/delete a file in Unix/Linux. All the redundancy disappears, too.

  • A bitmap of the block.

  • A bitmap of the inode table (see the paragraph following this list for more on inodes).

  • Information from the inode table.

  • The data itself.

An inode contains all the information needed to identify a file its attributes and permissions, its location(s)on the disk, its owner, timestamps except the filename itself (which belongs to the directory).

There is one inode for every file. The inode table performs the same function as the DOS File Allocation Table (FAT). It keeps track of where files are located on the disk for easy retrieval.

Working with ReiserFS

ReiserFS version 3 is the default file system for SUSE Linux. Created from the ground up by Hans Reiser, it is safer and faster than the old default ext2 file system.

It is a journaling file system, meaning it has a file (a journal) that records changes to the file system. Should you have a system crash, a power surge, or some other mishap leading to an unexpected (that is, involuntary) shutdown, recovery will be less traumatic. ReiserFS was the first journaling file system included into the Linux kernel, and it has been supported since kernel version 2.4.1 in January 2001.

If you've ever had Microsoft Windows crash or freeze up, you'll know the pain and agony associated with a nonjournaling file system.

Following the unexpected shutdown, Windows runs its ScanDisk program over your entire hard drive, checking for both bad disk sectors and reestablishing where every file snippet is physically located on the disk. Because broken links might occur, you may have orphaned clusters, a common problem that will result in a loss of data.

Although Linux is a much safer OS with far fewer software-related crashes, Linux users have not been entirely exempt from the involuntary shutdown. When this happens under the ext2 file system, the fsck program also scans the entire file system to make sure no data is lost in the crash. It could also take its time in processing the drive before you can log in.

The journal file makes it tremendously faster and easier to confirm that the disk is not damaged and that data is not lost. The journal knows what changes (saving new data, creating new files, deleting files, updating, and so on) were made to the disk since the last normal shutdown and tells the disk scanner where they are physically located on the disk. The scanner confirms that the location is not damaged and proceeds. This process does not guarantee that no data will be lost in this situation (the journal does not know what you typed since the last save before the crash), but it is in much better shape.

ReiserFS also manages blocks much differently than the Extended Filesystem (ext2, ext3), allowing many small files to share a block. This speeds retrieval and should display small files faster.

Its chief weakness is a problem only for people converting an existing ext2 or ext3 file system to ReiserFS. You must back up all your data and reformat the drive before installing ReiserFS. If you are installing SUSE Linux for the first time on your computer, this is nothing to worry about.

Note

The next generation of the ReiserFS, Reiser4, was released in early 2005. The file system, with financial help from the Defense Advanced Research Projects Agency (DARPA), has some advanced security features. These are outlined on the Namesys website: http://www.namesys.com/v4/v4.html#enh_security.

You can expect SUSE Linux to integrate Reiser4 in an upcoming release.


The Extended File System (ext2, ext3)

The ext2 file system was the standard and default throughout the early years of Linux kernel development. Hardly anyone used anything else until very recently. When ReiserFS first produced a journaling file system, Red Hat and others worked to bring journaling to this file system and ext3 was added to the kernel as of v2.4.16 in November 2001.

Ext3 and ext2 are nearly identical except for the journal file. If you are installing SUSE Linux over an existing ext2 file system, you might want to use ext3 instead of ReiserFS. The chief advantage of the ext3 file system is that it will automatically recognize files on ext2, and reformatting is not required.

JFS and XFS

IBM's original Journaling File System (JFS) and the XFS file system from SGI (formerly Silicon Graphics, Inc.) are file systems that were designed for other Unix versions now ported to Linux. JFS was the file system of choice for AIX users. SGI created XFS to be the basis for its IRIX systems.

JFS introduced journaling to Linux, and has its own version of fsck to handle problem boots. XFS claims superior performance than either JFS or ReiserFS. Perhaps one of these will work for you.

Don't fret endlessly over what file system to choose. All the file systems discussed here are excellent. It is a one-time decision, though. There is some pain involved with changing file systems after installation, especially when moving from ext2 or ext3 to ReiserFS. If you are connected to an existing AIX or IRIX network or you are transitioning from one of these enterprise Unixes, stick with the file system you have.

Otherwise, selecting the default ReiserFS is probably your best choice.



SUSE Linux 10 Unleashed
SUSE Linux 10.0 Unleashed
ISBN: 0672327260
EAN: 2147483647
Year: 2003
Pages: 332

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