* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Presentation
Library (computing) wikipedia , lookup
MTS system architecture wikipedia , lookup
Plan 9 from Bell Labs wikipedia , lookup
Commodore DOS wikipedia , lookup
Windows NT startup process wikipedia , lookup
Burroughs MCP wikipedia , lookup
Spring (operating system) wikipedia , lookup
Computer file wikipedia , lookup
3 File Systems Guide to Operating Systems Second Edition Chapter 3 1 3 Objectives After reading this chapter and completing the exercises you will be able to: • Understand the basic functions common to all file systems • Explain the design of the Windows 95 (FAT16) and Windows 95, Windows 98, and Windows Me (FAT32) file systems Chapter 3 2 3 Objectives After reading this chapter and completing the exercises you will be able to: • Describe the Windows NT, Windows 2000, and Windows XP file system (NTFS) • Describe the design of the UNIX file system • Describe the basics of the Macintosh file system Chapter 3 3 3 Understanding File System Functions • A file system is a design for storing and managing files on storage media • The file systems used by personal computer operating systems perform the following general functions: – Enable files to be organized through directories and folders – Partition and format disks to store and retrieve information – Establish file-naming conventions – Provide utilities for functions such as file compression and disk defragmentation – Provide for file and data integrity – Provide storage media management functions – Enable error recovery or prevention Chapter 3 4 3 Understanding File System Functions • The overall purpose of a file system is to create a structure for filing data • A file is a set of data that is grouped in some logical manner, assigned a name, and stored on the disk • The data contained in files can be text, images, music and sounds, video, or Web pages for the Internet • But no matter what kind of data is stored in the file system, it must be converted into digital format—a series of 1s and 0s, or electrical signal “ons” and “offs” —that the computer understands Chapter 3 5 3 Understanding File System Functions • There must be a way to write digital information onto disk, track it, update it when necessary, and call it back when the user, or a program under the user’s control, wants it • To achieve all this, the operating system typically groups disk sectors in some logical way, creates a record of this structure, and builds a directory to track the type of data stored in each file Chapter 3 6 3 A File System Chapter 3 7 3 Understanding File System Functions • In addition to the names of files and where to find them on the disk, directories also store the following information: – Date and time the directory or file was created (a timestamp for that directory or file) – Date and time the directory or file was last modified (another form of timestamp) – Directory or file size – Directory of file attributes, such as security information, or if the directory or file was backed up Chapter 3 8 3 Understanding File System Functions • Figure 3-2 illustrates some of the information that is stored for a file in Windows XP, which can be displayed using Windows Explorer or My Computer Chapter 3 9 3 Designing a Directory Structure • For users, one of the most important features of a file system is the ability to store information according to a pattern of organization that is enabled by the use of directories • In the early Windows systems and UNIX systems, files are organized by directories, while in later Windows versions and the Mac OS, these are called folders Chapter 3 10 3 Designing a Directory Structure • Directories and folders can be organized in a hierarchy that is similar to a tree structure • Some personal computer users keep most of their files in the computer’s primary level or root directory, or they load all application software into a single directory Chapter 3 11 3 Designing a Directory Structure • When you design a directory structure consider directories for the following: – Operating system files – Software applications – Work files, such as word processing, graphics, spreadsheets, and database files – Public files that you share over the network – Utilities files – Temporary files Chapter 3 12 3 Designing a Directory Structure • The folder structure from the root might be as follows: – Winnt for the system files – Program Files for general software and utilities – Documents and Settings for work files such as spreadsheets and Word documents – Shared for spreadsheets that are shared over the network – Forms for specific types of forms used by the legal forms software – Inetpub for Web pages • Each major folder has subfolders to keep grouped files or applications software separate Chapter 3 13 3 Sample Folder Structure for a Windows-based System Chapter 3 14 3 Designing a Directory Structure • For UNIX systems, such as Red Hat Linux, a typical directory (or folder) structure is as follows: – bin for user programs and utilities (binary files) – lib for libraries – usr for user files and programs – var for files in which content often varies or that are used only temporarily – tmp for files used only temporarily – dev for devices – mnt for floppy drives, CD-ROM drives, and other removable media that can be mounted – Etc for system and configuration files – sbin for user programs and utilities (system binary files) – home for users’ home directories (or folders) – proc for system resource tracking Chapter 3 15 3 Designing a Directory Structure • In the Mac OS, the default folder structure from the root includes: – Applications for software applications – System Folder for system files – Library for library files (such as fonts) – Users for user accounts – Documents for documents Chapter 3 16 3 Disk Storage • When a hard disk is delivered from the manufacturer, it is low-level formatted • A low-level format is a software process that marks the location of disk tracks and sectors • Every disk is divided into tracks, which are like several circles around a disk • Each track is divided into sections of equal size called sectors • Figure 3-4 illustrates a hard disk divided into tracks and sectors Chapter 3 17 3 Disk Tracks and Sectors Chapter 3 18 3 Block Allocation • The operating systems discussed in this book use a method called block allocation to keep track of where specific files are stored on the disk • With block allocation the disk is divided into logical blocks (in MS-DOS and Windows these are called clusters), which are in turn mapped to sectors, heads, and tracks on the disk • The data regarding block allocation is stored on the disk itself, using two techniques Chapter 3 19 3 Block Allocation • One technique uses a fixed portion of the disk to store this data, such as the FAT (file allocation table) file system used by MS-DOS and supported by all versions of Windows • The other technique uses various locations on the disk to store a special type of file that is used for directory and file allocation information, such as the New Technology File System (NTFS) and the UNIX file systems Chapter 3 20 3 Partitions • Before a file system can be placed on a hard disk, the disk must be partitioned and formatted • Partitioning is the process of blocking a group of tracks and sectors to be used by a particular file system, such as FAT or NTFS • After a disk is partitioned, it must be high-level formatted (usually referred to as just formatted) so that the partition contains the disk divisions and patterns needed by a particular operating system to store files Chapter 3 21 3 Partitions • Figure 3-5 illustrates a Windows 2000 system that has multiple partitions (FAT, NTFS, and compact disk file system (CDFS)) used for segmenting data on two hard disks and a CD-ROM drive Chapter 3 22 3 Partitions • Partitioning can typically be done only on hard disks or large removable disks • Floppy disks and other low-capacity media do not support partitioning because there simply isn’t enough room on these low-capacity disks to make partitioning practical • On systems in the IBM/Intel PC hardware architecture, typically there is room to store information for up to four partitions on each disk Chapter 3 23 3 Partitions • This area is known as the partition table in MSDOS, Mac OS, and Windows, and the disk label in UNIX • In addition to the disk label and partition table, there is another piece of disk reserved, known as the boot block in UNIX, or the Master Boot Record (MBR) in MS-DOS and Windows • This area hold a tiny program used to begin booting an operating system from a disk Chapter 3 24 3 The Basic MS-DOS File System • The first Microsoft file system, called the file allocation table (FAT) file system started with MS-DOS in the early eighties, and later versions of FAT are in many ways similar to the earliest version • FAT uses a file allocation table to store directory information about files, such as filenames, file attributes, and file location • MS-DOS versions prior to 4.0 use the FAT12 file system in which the maximum size of a file system is 32 MB Chapter 3 25 3 The Basic MS-DOS File System • Beginning with MS-DOS 4.0, the FAT16 file system is used, in which the maximum size of a volume is 4 GB, and the maximum size for a file is 2 GB • Another important characteristic of FAT is its use of “8.3” filenames, which can be up to eight characters long, followed by a period and an extension of three characters, such as Filename.ext Chapter 3 26 3 Partitioning • The FAT file system supports two partitions per hard drive, a primary partition and a secondary partition • The secondary partition may then be divided further into a maximum of three logical drives • Each of these four possible logical drives can hold an individual MS-DOS file system • Although 26 drive definitions are technically possible, MS-DOS reserves drive A: and B: for floppy drives, practically limiting the number of hard drives (including logical drives) to 24 Chapter 3 27 3 Partitioning Chapter 3 • Each MS-DOS file system is assigned a letter followed by a colon: A:, B:, C:, and so on through Z: • Typically, C: is reserved for the first hard disk or removable disk file system (and is normally the system that contains the boot partition) 28 3 Partitioning • If you start a computer in MS-DOS, you can use the fdisk utility to look at the contents of the partition record • When the fdisk command is issued, a menu appears, as shown in Figure 3-7 • You can choose option 4 from the menu in Figure 3-7 to see what partitions are on the disk • This will give you a short overview, as shown in Figure 3-8 Chapter 3 29 3 Partitioning Chapter 3 30 3 Partitioning • In the leftmost column, you see the partition number and, if applicable, the drive letter associated with the partition • In the Status column, you see that one partition is marked A, which stands for active • When the computer is started, the BIOS looks at the partition record, find the active partition (the partition currently used to store data, and from which the computer boots), and looks at the file system inside that partition to start the operating system Chapter 3 31 3 Partitioning • The Volume Label column shows the name of the file system in the partition • The Mbytes column represents the size of the partition in megabytes • Finally, the Usage column indicates how much of the total available disk space is consumed by the file system • You can use the other functions of the fdisk program to delete or add partitions to the drives in your system • To remove a partition, select option 3 from the fdisk menu, which presents you with another menu for selecting which partition you wish to remove Chapter 3 32 3 Partitioning • With a new system called large block allocation (LBA), it is now possible to make file systems much larger than 512 MB under MS-DOS • LBA translates larger logical blocks to smaller ones for support of larger physical disks • However, the disk controller and disk must support LBA, and they must be configured for LBA • The trick to LBA is that MS-DOS is told that the sector size of the hard disk is greater than 512 bytes per sector, which results in the ability to have much larger file systems Chapter 3 33 3 Formatting • In MS-DOS (and in many Windows versions), the file system is placed on the partition using the format command • This command writes all of the file system structure to the disk • In the case of a floppy disk, it uses the first sector of the disk as the boot block • As with many system-level commands, format includes several additional switches that modify precise program operation Chapter 3 34 3 format Command Switches Chapter 3 35 3 Formatting • Command lines frequently use switches (extra code) to change the way a particular command operates • The boot block is placed in the first sector on the disk • Next comes the root directory, where the system stores file information, such as name, start cluster, file size, file modification date and time, and file attributes (file characteristics such a Hidden, Read-only, Archive, and so on) Chapter 3 36 3 Formatting • The root directory on every partition is a fixed size that can contain a maximum of 512 entries in FAT16 (and unlimited entries in FAT32) • When a file is stored to disk, its data is written in the clusters on the disk • The filename is stored in the directory, along with the number of the first cluster in which the data is stored Chapter 3 37 3 Formatting • When the operating system fills the first cluster, data is written to the next free cluster on the disk • When a file is completely written to the disk, the FAT entry for the final cluster is filled with all 1s, which means end of file • At this time, the directory entry for the file is updated with the total file size • This is commonly referred to as the “linkedlist” method Chapter 3 38 3 Formatting • Clusters are of a fixed length, and if a file does not exactly match the space available in the clusters it uses, you can end up with some unused space at the end of a cluster • Unusable spots are marked in the FAT as bad clusters, and these areas are never used for file storage • Formatting a disk removes all data that was on the disk because you lost the directory and FAT data needed to get to the data Chapter 3 39 3 Formatting • On disks that have never been formatted, the format command writes new sector and track markers on the disk • The format process on a hard disk is the same as on a floppy disk, with two exceptions • The first is related to the size of each entry in the FAT table, which is 16 bits long on any disk larger than 16 MB • The second difference is in the cluster size Chapter 3 40 3 Hard Disk Cluster Reference Chapter 3 41 3 Formatting • The FAT tables and root directory are found at the beginning of each partition, and they are always at the same location • Each item in a directory consists of 32 bytes Chapter 3 42 3 Formatting • In each entry, information about the file is stored, including the filename, the file change date and the file size and the file attributes • Apart from the filename, each directory entry also contains some status bits that identify the type of filename contained in each entry • The status bits in use are Volume, Directory, System, Hidden, Read-only, and Archive • The Volume bit indicates a file system volume label, or a nickname for the file system Chapter 3 43 3 Formatting • The attrib command can be used to look at or set these attributes • Typing attrib in a directory shows all of the attribute settings for all the files, whereas typing attrib followed by a filename shows only attributes specific to that file Chapter 3 44 3 The Windows 95/98/Me FAT File Systems • There are two versions of FAT that can be used with Windows 95, 98, and Me, depending on the version of Windows you are running, and the size of the disk you are using: – FAT16, similar to the system used in MS-DOS/Win 3.x – FAT32, a new system introduced in Windows 95, release 2 (OSR2) Chapter 3 45 3 Windows 95/98/Me FAT16 • In Windows 95, there is support for long filenames (LFNs) • A filename in the Windows 95 file system: – Can contain as many as 255 characters – Is not case sensitive – Cannot include spaces and characters such as “/\[ ] :;=, (this applies to both 8.3 filenames and LFNs) • Since LFN characters are stored in Unicode, a coding system that allows for representation of any character in any language, it is possible to use any character known to Windows in a filename Chapter 3 46 3 Windows 95/98/Me FAT16 • The advantage of LFNs and Unicode is that LFNs can be read by Mac OS and UNIX systems • Normally, letters and digits are represented by ASCII (American Standard Code for Information Interchange) values • The problem with this standard is that it uses an entire byte to represent each character, which limits the number of characters that can be represented to 255 Chapter 3 47 3 Windows 95/98/Me FAT16 • This is not enough to handle all the characters needed to represent world languages, including several different alphabets (Greek, Russian, Japanese, and Hindi, for example) • ASCII deals with this problem by employing different character sets, depending on the characters you’re trying to represent • Unicode is a 16-bit code that allots two bytes for each character, which allows 65,536 characters to be defined Chapter 3 48 3 Windows 95/98/Me FAT16 • Two advantages of FAT16 are that, like FAT12, it is a simple file system supported by many small computer operating systems, and it has a low operating system overhead • The disadvantages are that FAT16 become corrupted over time as files are spread among disjointed allocation units (clusters) and pointers to each unit are lost, and FAT16 does not offer many file or directory security or auditing options Chapter 3 49 3 FAT32 • To accommodate the increasing capacities of hard disks, and avoid the problem of cluster size, the second release of Windows 95 (OSR2) introduced an improved FAT file system called FAT32 • FAT32 shares characteristics of FAT16 for Windows 95 • FAT32 allows partitions of up to 2 TB (theoretically); blocks can be allocated with clusters as small as 8 KB, and the maximum file size is raised to 4 GB Chapter 3 50 3 FAT32 • FAT32 works by using many bits per FAT allocation unit, and is therefore incompatible with other operating systems such as MS-DOS and Windows NT • However, it is compatible with Windows 2000 and XP • You can choose the FAT32 file system when the Windows 95/98 fdisk utility is run, but unfortunately, the utility does not simply ask if you wish to use FAT32 Chapter 3 51 3 FAT32 • DO NOT use FAT32 if you plan to access your hard disk from MS-DOS or Windows NT because it is not compatible with these systems Chapter 3 52 3 Windows 95/98/Me File System Utilities • The fdisk and format utilities in Windows 95, 98, and Me work identically to those in MS-DOS • There are now also graphical equivalents of these tools that you can launch from the Windows user environment, such as the Windows 95 format tool shown in Figure 3-11 Chapter 3 53 3 Windows 95/98/Me File System Utilities • Sometimes disk performance is affected by corrupted files, or when the file allocation table loses pointers to certain files • You can correct these problems in Windows 95 and maintain the integrity of the data by periodically running the “Checkdisk” utility, called chkdsk, by clicking Start, clicking Run, entering chkdsk, and clicking OK Chapter 3 54 3 Windows 95/98/Me File System Utilities • When you run chkdsk in Windows 98 and Windows Me, the utility does not perform a true disk check, but instead reports information about the volume serial number, total disk space, free disk space, distribution of allocation units, and lower memory allocation (under 640 KB) • ScanDisk is another checking utility, but it is a little more advanced • It has a nicer, menu-driven user interface, and it can do a surface scan to determine whether you have media problems on a disk Chapter 3 55 3 Windows 95/98/Me File System Utilities • ScanDisk can also copy to another disk the files it is about to manipulate, a useful precautionary step to avoid inadvertently losing files or data Chapter 3 56 3 Windows 95/98/Me File System Utilities • Windows 95, 98, and Me also have a built-in disk defragmenting tool • When one of these operating systems writes a file to disk, it looks for the first place in the first empty FAT location and uses the cluster indicated there • To start the disk defragmenter, click Start, point to Programs, point to Accessories, point to System Tools, and click Disk Defragmenter Chapter 3 57 3 Windows 95/98/Me File System Utilities • The Disk Defragmenter can also be automatically started using the Scheduled Tasks tool • In general, it is wise to defragment disks once a month for medium-use systems, and once a week for high-use systems • It is VERY IMPORTANT that no other programs are running while the Disk Defragmenter program is running Chapter 3 58 3 Windows 98 Disk Defragmenter Chapter 3 59 3 The Windows NT/2000/ XP/.NET File Systems • Windows NT supports two types of file systems: the extended FAT16 system used by Windows 95, and the NTFS up through version 4 (for Windows NT 4.0) Chapter 3 60 3 Extended FAT16 • The extended FAT16 file system under Windows NT/2000/XP/.NET has the same functionality as the FAT16 system under Windows 95, and it is possible to have multiple operating systems on one disk (called dual-boot or multiboot systems) with the FAT16 file system • POSIX stands for Portable Operating System Interface, a set of standards designed to guarantee portability of applications among different operating systems Chapter 3 61 3 FAT32 • Windows 2000, XP, and .NET Server all support FAT32, which is the same file system that is used in Windows 95 OSR2, Windows 98, and Windows Me • Sometimes users choose to employ FAT16 or FAT32 because they are familiar with these file systems, or they have dual-boot systems, such as a system with Windows XP and Windows 98 Chapter 3 62 3 FAT32 • Any Windows NT, 2000, XP, or .NET Server system can be converted from FAT16 or FAT32 to NTFS, either during installation or at a later date • Converting from FAT16 or FAT32 to NTFS can take many hours on a volume that is over 1 GB, and the conversion process may appear hung, even though it is not Chapter 3 63 3 NTFS • Four important advantages of NTFS compared to FAT16 and FAT32 are: – Ability to compress file and directory contents on the fly – Better recoverability and stability – Less disk fragmentation – Local file and folder-level security Chapter 3 64 3 NTFS • The basic features initially incorporated into NTFS 4 include: – Long filenames (LFN) – Built-in security features – Better file compression than FAT – Ability to use larger disks and files – File activity tracking for better recovery and stability than FAT – POSIX support – Volume striping and volume extensions – Less disk fragmentation than FAT Chapter 3 65 3 NTFS • NTFS enables the use of LFNs that are compatible with LFN FAT filenames • If an LFN is used in NTFS, that file can be copied to a FAT16 or FAT32 volume, and the filename remains intact • As a full-featured network file system, NTFS is equipped with security features that meet the U.S. government’s C2 security specifications • C2 security refers to high-level, “top secret” standards for data protection, system auditing, and system access, which are required by some government agencies Chapter 3 66 3 NTFS • NTFS can be scaled to accommodate very large files, particularly for database applications • A Microsoft SQL Server database file might be 20 GB or larger • Another NTFS feature is its ability to keep a log of file system activity • NTFS supports POSIX standards to enable portability of applications from one computer system to another Chapter 3 67 3 NTFS • Windows 2000 follows the POSIX 1 standard, which includes case-sensitive filenames and use of multiple filenames • An important volume-handling feature of NTFS is the ability to create extensions on an existing volume, such as when new disk storage is added • Last, NTFS is less prone to file corruption than FAT, in part because it has a “hot fix” capability, which means that if a bad disk area is detected, NTFS automatically copies the information from the bad area to another disk area that is not damaged Chapter 3 68 3 NTFS • In addition to the NTFS 4 features already described, NTFS 5 adds several new features: – Ability to encrypt files – No system reboot required after creating an extended volume – Ability to reduce drive designations – Indexing for fast access – Ability to retain shortcuts and other file information when files and folders are placed on other volumes – Ability to establish disk quotas Chapter 3 69 3 NTFS • With NTFS 5, files can be encrypted so that their contents are available only to those granted access • Also, volume extensions can be set up without the need to reboot the system (in NTFS 4 you must reboot after adding an extension onto an existing volume • A new technique called Distributed Link Tracking is available in NTFS 5 so that shortcuts you have created are not lost when you move files to another volume Chapter 3 70 3 NTFS • The way NTFS keeps track of files and clusters is a little different from the FAT file system • Rather than using a structure of FAT tables and directories, NTFS uses a Master File Table (MFT) • Like the FAT tables and directories, this table is located at the beginning of the partition • When a file is made in NTFS, a record for that file is added to the MFT Chapter 3 71 3 NTFS • The MFT record reflects the sequence of clusters that a file uses • It is also possible to have multiple filenames that refer to the same file, a technique known as hard linking • Table 3-5 provides a comparison of the most frequently used Microsoft file systems— FAT16, FAT32, and NTFS Chapter 3 72 3 FAT16, FAT32, and NTFS Compared Chapter 3 73 3 NTFS Utilities • Windows NT, 2000, XP, and .NET Server all come with the chkdsk utility, which is much more robust than in other Windows operating systems • Because chkdsk is more robust, these operating systems do not come with ScanDisk • Windows NT does not come with a disk defragmenter tool, so this must be purchased from a third-party vendor Chapter 3 74 3 Chkdsk Switch Options Chapter 3 75 3 NTFS Utilities • Windows 2000, XP, and .NET Server all have Disk Defragmenter, which is initiated by clicking Start, pointing to Programs, pointing to Accessories, and clicking Disk Defragmenter Chapter 3 76 3 NTFS Utilities • Care should be taken to use only utilities designed to work with NTFS; serious damage can occur if other utilities are used • When you upgrade Windows NT Server 4.0 to Windows 2000 or Windows .NET, the current NTFS disk partitions are automatically converted to basic disks, which use traditional NTFS disk management techniques, with a limited number of volumes on one disk Chapter 3 77 3 CDFS and UDF • The Universal Disk Format (UDF) file system is also used on CD-ROM and large capacity Digital Video Disk-Read Only Memory (DVD-ROM) media, which are used for huge file storage to accommodate movies and games Chapter 3 78 3 The UNIX File System • The UNIX file system works a little differently from anything discussed up to this point • “UNIX file system” is really a misnomer • In Linux, the extended file system (ext or ext fs) is native and installed by default • Ext provides an advantage over all other file systems that can be used with Linux because it enables the use of the full range of built-in Linux commands, file manipulation, and security Chapter 3 79 3 File Systems Supported by UNIX Chapter 3 80 3 File Systems Supported by UNIX Chapter 3 81 3 The UNIX File System • The main difference between native UNIX file systems, such as ext3 and ufs, and those covered earlier in the chapter, lies in the way information is physically stored on the disk • The ufs UNIX file system (and also ext/ext2/ext3) uses the concept of information nodes, or inodes Chapter 3 82 3 The UNIX File System • Each inode can store some information about a file on the file system • The information stored on an inode identifies: the inode number, the owner of the file, the group in which the file is placed, the size of the file, the date the file was created, the date the file was last modified and read, the number of links to this inode, and information regarding the location of the blocks in the file system in which the file is stored Chapter 3 83 3 The UNIX File System • Blocks are typically 4096 or 8192 bytes in size, but the file system is capable of dividing these blocks, if required • Groups of blocks for cylinder groups and large files are allocated cylinder groups at the same time • A block can be divided by two repeatedly until the smallest fractional block size is reached, which is typically equal to the size of a single sector on the disk Chapter 3 84 3 The UNIX File System • The superblock contains information about the layout of blocks, sectors, and cylinder groups on the file system • This information is the key to finding anything on the file system, and it should never change • A UNIX system can have many file systems • Unlike the MS-DOS/Windows environment, where each file system must have a letter of the alphabet assigned to it to enable access, UNIX mounts file systems as a sub-file system of the root file system Chapter 3 85 3 Multiple Directory Entries Pointing to the Same Inode Chapter 3 86 3 The UNIX File System • In UNIX, all file systems are referred to by a path • Then, using the mount command, the UNIX operating system is told to map the root inode of another file system onto the empty directory • The mount command has several options: typical it without parameters results in a display of the disks that are currently mounted • As we already mentioned, a directory is nothing more than a special file Chapter 3 87 3 UNIX File System Path Entries Chapter 3 88 3 UNIX Drive Mount Path Chapter 3 89 3 The UNIX File System • There are several other special files in the UNIX file system • Disks themselves, are, for example, referenced by a special inode called a device • There are two types of devices, raw devices and block devices • A raw device has no logical division in blocks, whereas a block device does Chapter 3 90 3 The UNIX File System • Every device the UNIX computer uses must be represented by a device inode, whether it is a disk, a serial port, or an Ethernet card • There is another special feature of the UNIX file system we should mention here, the symbolic link • If you want to link a directory entry to a file that is on a different partition, you must use a feature known as a symbolic link Chapter 3 91 3 The UNIX File System • This is a special file, which has a flag set in the inode to identify it as a symbolic link • As with all other operating systems discussed so far, you first have to partition a disk to use the UNIX file system • The command used to partition the disk differs slightly from one version of UNIX to another • In most UNIX systems, either fdisk or format does the job Chapter 3 92 3 The UNIX File System • Once a partition is made, it is time to create the file system • To do this, you must know the device name of the partition on which you wish to create a file system • This name can be obtained from the print partition table command in fdisk or format • UNIX is very picky when it comes to file system consistency Chapter 3 93 3 The UNIX File System • If it finds problems on the file system in the inodes, superblock, or directory structures, it will shut down • Typically, ufs file systems can be up to 4 GB in size, but by using larger block sizes, the systems can be made much larger • Depending on the implementation of UNIX being used, and the exact ufs version in use, it is possible to create file systems in excess of 32 exabytes Chapter 3 94 3 UNIX File System Commands Chapter 3 95 3 UNIX File System Commands Chapter 3 96 3 The Macintosh File System • The original Macintosh Filing System (MFS) of 1984 was limited to keeping track of 128 documents, applications, or folders • As larger disks became available, the need for directories and subdirectories became obvious, and Apple responded with the Hierarchical Filing System (HFS) in 1986 • Like FAT16, HFS divides a volume (the Mac term for a disk or disk partition) into, at most, 216 (65,536) units Chapter 3 97 3 The Macintosh File System • On PC systems, these units are called clusters or allocation units • On the Mac, they are called allocation blocks, but the principle is the same Chapter 3 98 3 The Macintosh File System • The first two sectors of a Mac-formatted disk are the boot sectors, or boot blocks in Macintosh terminology • The boot blocks identify the filing system, the names of important system files, and other important information • The boot blocks are followed by the volume information block, which points to other important areas of information, such as the location of the system files, and the catalog and extents trees Chapter 3 99 3 The Macintosh File System • The catalog b-tree is the list of all files on the volume • The extents b-tree keeps track of the location of the file fragments, or extents • In terms of filename length, the Mac OS has always supported what might be called “medium” filenames of up to 31 characters in length • UNIX and Windows operating systems use filename extensions such as .txt and .gif to identify file types Chapter 3 100 3 The Macintosh File System • The Mac uses invisible type codes and creator codes • As an example, files created with Apple’s SimpleText text editor have a type code of TEXT, and a creator code of ttxt • The type and creator codes facilitate the Mac’s use of icons • One way in which Macintosh files are unique is that Mac files an contain two parts, or forks: the data fork and the resource fork Chapter 3 101 3 The Macintosh File System • The data fork contains frequently changing information (such as word processing data), while the resource fork contains information that is fixed (such as a program’s icons, menu resources, and splash screens) • Apple’s free ResEdit utility can edit file resources • Using ResEdit, a programmer can modify a program’s version number, splash screens, default memory allocation, icons, menu items, window resources, dialog text, and many other properties Chapter 3 102 3 The Macintosh File System • The fact that Mac files have invisible type and creator codes and two forks can create problems when storing files on non-Macintosh servers, or transferring files over the Internet Chapter 3 103 3 The Macintosh File System • The need to store Mac files on non-Mac computers has led to several Mac file formats for bulletin board services, online services, and the Internet • One of these formats is MacBinary, which joins the two forks into one, and safely stores the type and creator codes and finder flags • Like uuencode, BinHex transforms all files into seven-bit files using the ASCII character set Chapter 3 104 3 The Macintosh File System • Like MacBinary, BinHex preserves the two forks, the type and creator codes, and the finder flags • BinHex files can be identified by the .hqx filename extension • Apple’s equivalent of the UNIX link and Windows shortcut is the alias, introduced in System 7.0 in 1991 • Files, folders, applications, and disks can be aliased Chapter 3 105 3 The Macintosh File System • The Mac OS ships with two basic disk utilities: Disk First Aid and Drive Setup • Drive Setup, a replacement for the older Apple HD Setup, formats and partitions Apple IDE and SCSI hard drives • Drive Setup checks the hard drive for a ROM that is present in drives shipped with Apple computers • Most versions of the Mac OS include a basic find file utility Chapter 3 106 3 The Macintosh File System • Mac OS 8.5 takes this one step further with the Sherlock program • Sherlock can search disks for filenames and text within files Chapter 3 107 3 Summary • For the user, files are the “bread and butter” of an operating system • Besides containing the operating system kernel, files hold documents and programs on which users rely • The file systems used by early Microsoft operating systems include FAT12 and FAT16 • In these file systems, the file allocation table (FAT) file system creates a file allocation table to store information about files Chapter 3 108 3 Summary • The fdisk and format utilities are used with all versions of FAT file systems to partition and format disks, while the chkdsk and ScanDisk utilities give information about files and disks, and check for disk and file integrity • The FAT32 file system was introduced in the second release of Windows 95, and is also used in Windows 98 and Windows Me Chapter 3 109 3 Summary • The native file system for Windows NT, 2000, XP, and .NET is called NTFS, but FAT32 is also supported by Windows 2000 and XP, while FAT16 is supported by Windows NT, 2000, and XP • NTFS is a more stable and secure file system than FAT, and in general, can handle larger disk and file sizes • UNIX file systems use information nodes (inodes) to organize information about files Chapter 3 110 3 Summary • A UNIX system can have many file systems mounted as subdirectories of the root • The Macintosh OS uses the Hierarchical Filing System (HFS) • Like FAT, HFS divides a disk or disk partitions (called a volume) into allocation units called allocation blocks • Unlike FAT, HFS has always allowed the use of relatively long filenames Chapter 3 111