Transcript Chapter 3

Guide to Parallel Operating
Systems with Microsoft
Windows XP and Linux
Chapter 3
File Systems
Objectives
• Describe the characteristics of three Windows XP
file systems
• Describe the characteristics of four Fedora Core 4
file systems
• Create a file system in Windows XP and Fedora
Core 4
• Mount a file system in Windows XP and Fedora
Core 4
• Manage file systems in Windows XP and Fedora
Core 4
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
2
File Systems
• Structures for organizing, naming, and storing files
• Components: files, directories, access methods
• Preparing a PC to accept files
– Allocate storage areas on a disk
– Format storage area for a file system
• Develop file management skills in two OSs
– Windows XP
– Fedora Core 4
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
3
Windows XP File System
Characteristics
• Gain file system knowledge through implementation
• Three file system aspects to master
– Allocation of the storage areas on the hard drive
– Assignment of drive letters
• Used to access storage areas
– Characteristics of available file systems
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
4
Disk Partitions
• Scenario 1: PC, two hard drives, one CD-ROM drive
– Two hard drives assigned to first disk controller
– CD-ROM assigned to second disk controller
• Scenario 2: same devices using disk partitions
• Two storage types in Windows XP: basic, dynamic
• Basic storage allows allocation of three storage types
– Primary partitions: separate allocation units on disk
– Extended partitions: created from free drive space
– Logical drives: drives created in an extended partition
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
5
Disk Partitions (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
6
Disk Partitions (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
7
Disk Partitions (continued)
• Primary partition features
– Normally contains an OS, such as Windows XP
– Physical hard drive can have four primary partitions
• Limit drops to three if extended partitions are used
• Extended partition features
– One extended partition per physical hard drive
– Extended partition supports up to 24 logical drives
• Dynamic disk storage divides disk into volumes
– Volume: fixed amount of storage on a hard drive
– Multiple volumes may reside on a single disk
– A single volume can span multiple disks
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
8
Drive-Lettering Conventions
• Windows XP follows drive-lettering conventions
– Drive letters assigned to all hard drives, optical drives
– Example: first partition on first drive assigned letter C
• Creating partitions and logical drives for Figure 3-3
–
–
–
–
–
First primary partition on disk 0 assigned drive letter C
CD-ROM drive received drive letter D
Logical drives on disk 0 assigned drive letters E and F
Primary partition on disk 1 received drive letter G
Logical drives on disk 1 assigned letters H and I
• View assignments with Disk Management console
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
9
Drive-Lettering Conventions
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
10
FAT16 File System
• FAT (File Allocation Table): file system for early PCs
– Supported by Windows XP and Linux
• FAT16 disk hierarchy
– Sector: smallest unit of space, usually 512 bytes
– Cluster: group of sectors
• Size is related to the size of the disk partition
• Size range: 4 sectors to 64 sectors
• FAT16 permits partitions up to 2 GB of storage
• Two notes on filenames in Windows XP
– The length of a filename may be 256 characters
– The filenames are case insensitive
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
11
FAT16 File System (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
12
FAT32 File System
• Uses 32-bit cluster numbers (28 bits currently used)
• Continues use of subdirectories and long filename
• Theoretical size limits
– 268,435,438 cluster based on 28-bit cluster address
– Drive sizes of approximately 2 terabytes (trillion bytes)
• Actual size limit for partition is 32 BB
– Limit set by Microsoft for Windows XP
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
13
NT File System
• Default file system for Windows XP
• NTFS (New Technology File System) features
– Supports volumes as large as 2 terabytes
– Cluster sizes: 512 bytes to 64 KB (4 KB default)
– Master file table (MFT): used to manage NTFS volume
• Allocates space for each file record
• File attributes written to allocated space in MFT
• Binary search algorithm used to locate items
• Options unique to NTFS: journalizing, compression,
encryption, security, auditing, quotas
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
14
Journalizing—Ensuring that Data is
Written
• Maintains data integrity for the hard drive
• How NTFS provides a fail-safe file system
– Corrects itself against a hard drive sector corruption
– Protects against power loss during hard drive writes
• NTFS journalizing techniques based on transactions
– Write action is either accomplished or canceled
• Scenario 1: sector damaged during write operation
– Response: sector marked, data written to good sector
• Scenario 2: power is lost during write operation
– Response: transaction processed after OS restarts
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
15
Compression—Saving Space
• Compression software reduces file sizes
– Example: word-processing documents compress well
• Access compressed files with decompression
– Recompress files before rewriting to hard drive
• Performance considerations
– Decompression/recompression requires CPU cycles
• System performance may be adversely affected
– Reserve compression for little used files and folders
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
16
Encryption—Protecting Data
• Effects of applying NTFS encryption to a file
– Only the file creator can view file contents
– Non-authorized user will not see meaningful data
• Accessing application decodes encrypted file
• Administrator can decrypt file in emergency
• A file can be encrypted or compressed, but not both
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
17
Security—Restricting Access
• Windows XP controls access to files and folders
• Three elements required for file access
– User account
– User password
– Permissions
• User groups simplify organization of user accounts
– File or folder may have different user groups
• Each user group may have a unique permission set
– Example involving three user groups
• Groups: ACCTMANAGERS, PAYABLE, RECEIVABLE
• Each group is assigned variation on three permissions
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
18
Security—Restricting Access
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
19
Security—Restricting Access
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
20
Auditing—Tracking Access
• Auditing not “turned on” by default
– Significant processing resources required
• Enable auditing to track certain events
– Event causes XP to record an entry in security log
• Important information recorded for file access event
– Type of event
– The date and time that event occurred
– Which user triggered the event
• Security log may only be viewed by authorized user
– Example: administrator is an authorized user
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
21
Quotas—Limiting Storage
• Storage quotas set for individuals and storage areas
– Implemented in Windows XP when a PC is shared
– Administrator cannot limit space for a group
• Consequence of storing data beyond quota
– User receives message indicating hard drive is full
• Log file stores information regarding quotas
– Used to determine which users are at or near quota
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
22
Optical Media File Systems
• Optical disc: storage medium manipulated with light
• XP supports two file systems for optical media
– UDF (Universal Disk Format)
• Read-write interoperable among major OSs
• Compatible between rewritable and write-once media
• Implementations: DVDs, CD-Rs, and CD-RWs
– Compact Disc File System (CDFS)
• Alias for ISO 9660 (CD-ROM file system standard)
• Makes CD-ROMs readable by many different platforms
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
23
Fedora Core 4 File System
Characteristics
• File system knowledge areas to master
– Allocation of the partitions on the hard drive
• Each partition on a physical drive is named
– Creation of file systems on the partitions
• Partition is formatted for the type of file system
• File systems are mounted on mount points
– Creation and management of directories and files
– Characteristics of available file systems
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
24
Disk Partitions
• Sample physical device setup using ATA technology
– Attach up to four drives to PC
– Primary and secondary controllers manage drives
– Each controller supports two drives, master and slave
• Hard drive may have four primary partitions
–
–
–
–
–
First physical drive named hda1
Extended partitions named hda2, hda3, and hda4
First logical partition in hda2 is named hda5
Partitions on other hard drives named the same way
Second controller contains CD-ROM hard drive (hdc)
• Partition table is located in sector 0 of a drive
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
25
Disk Partitions (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
26
Drive Partition Naming Conventions
• Partition name: device name and partition number
• Physical drives allocated one or more partitions
– First installed IDE drive called hda, the second is hdb
– First SCSI drive is called sda, the second sdb, etc.
• OS usually installed on master hard drive, hda1
• fdisk command: partition table manipulator
– Shows the partition table with file systems
– Syntax: fdisk [ -l ] [ -v ] [ -s partition] [ device ]
• -v: prints version number of fdisk program
• -l: lists the partition tables for devices, then exits
• -s partition: size of partitions (except DOS) are output
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
27
Physical Drives in Fedora Core 4
• Partitions are formatted for particular file systems
– Examples: FATT16, FAT32, ext2, or ext3
• mkfs command
– Used to format and define hard drive partitions
– File system specific
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
28
File Systems in Fedora Core 4
• Extended 2 file system (ext2fs)
– Most widely used file system in Fedora Core 4
• Functionality similar to NTFS provided:
–
–
–
–
–
Compression: reduces file storage space
Encryption: protects file from intruders
Security: restricts access to authorized users
Auditing: tracks file access (actual or attempted)
Quotas: limits total size of files per user
• Some other file systems used in Fedora Core 4
– ext3fs: implements journalizing
– NTFS: read-only access is provided
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
29
File System Creation
• Formatting: prepares a storage area for use
– Creates root of directory structure and file system
• Tools for creating a storage area and a file system
– Windows XP: use the Disk Management console
– Linux: use mkfs program
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
30
Windows XP File System Creation
• Chief tool: Disk Management Console
• Two areas where storage may be created
– A primary partition
– A logical drive within an extended partition
• Storage area is defined in unallocated area on disk
• Using New Partition Wizard
– Right-click unallocated area, click New Partition
– After clicking Next, select the extended partition type
• Choices: primary or extended partition
– Go to the next screen and set storage amount in MB
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
31
Windows XP File System Creation
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
32
Windows XP File System Creation
(continued)
• Creating a logical drive in the new extended partition
–
–
–
–
Reopen the New Partition Wizard
Select New Logical Drive
Indicate the size of the logical drive
Choose from 3 options in Assign Drive Letter or Path
• Assign the following drive letter
• Mount in the following empty NTFS folder
• Do not assign a drive letter or drive path
– Format the partition
• Seven options are available
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
33
Windows XP File System Creation
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
34
Windows XP File System Creation
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
35
Fedora Core 4 File System Creation
• Used for storing system configurations and data
• Initial structure created: “/” directory and swap file
• Uses for the hidden swap file
– Holding parts of programs and data files
– OS moves data between swap file and memory
• Define file systems after “/” and swap file
– Create a new partition using the fdisk command
– Create the file system using the mkfs command
• Example: mkfs -t ext2 /dev/fd0
– If mount point needed, use mkdir to create a directory
• Example: mkdir /home/User01/mydirectory
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
36
Fedora Core 4 File System Creation
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
37
Mounting a File System
• Windows XP approach to mounting a file system
– Letters given to partitions, volumes, CD-ROM drives
– “Premounted” storage items available at any time
– Performance is traded off for user convenience
• Fedora Core 4 approach to mounting a file system
– Mount file systems as they are needed
– User convenience traded off for performance
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
38
Mounting a Windows XP File System
• Mounted drives add flexibility to storage management
• Premounted storage areas that are always available
– Partitions, logical drives, CD-ROM drives
• Removable drives are mounted by Windows XP
– Example: USB drives mounted when inserted into port
• Use Disk Management to create a mounted drive
– Start with the drive you want to mount; e.g., F drive
– Map mounted drive to empty folder on NTFS volume
– Assign drive path to mounted drive
• Example: C:\Mount Drive F
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
39
Mounting a Fedora Core 4 File System
• Mounting: makes a file system available for use
– After mounting, files are accessible at mount point
– Superuser access required to mount a file system
• Some partitions are mounted automatically
– Script in /etc/rc.d executes the mount -a command
– File systems in /etc/fstab (except noauto) are mounted
• Mounted partitions appear to be in local directory
• mount attaches file system to partition via mount point
– /mnt directory is a generic mount point
– Command syntax: mount -t type device mount-point
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
40
Mounting a Fedora Core 4 File System
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
41
Mounting a Fedora Core 4 File System
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
42
Managing File Systems
• Windows XP: use Local Disk Properties dialog box
• Approaches used in Fedora Core 4
– Use fsc command to check and repair file system
– Manage the swap space
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
43
Managing Windows XP File Systems
• Starting point: Local Disk Properties for drive
– Tools are grouped under six tabs
– Security tab visible if simple file sharing not enabled
• Disabling simple file sharing
–
–
–
–
Click Start, point to My Computer
Click Local Disk (C:)-> Tools menu-> Folder Options
Click the View tab, go to Advanced Settings section
Uncheck the Use simple file sharing
• Using tools in Sharing and Quota tabs
– Administrative rights required
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
44
Managing Windows XP File Systems
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
45
General Tab
• Provides useful information for managing disk space
–
–
–
–
–
–
–
–
Type: a local disk is a hard drive on the PC
File system: indicates the file system type on the drive
Used space: displays amount of used space on drive
Free space: displays amount of unused space on drive
Capacity: displays the total capacity of the disk drive
Disk Cleanup: removes temporary and Internet files
Compress drive to save disk space
Allow Indexing Service to index this disk for fast file
searching
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
46
Tools Tab
• Provides three disk-tuning tools
• Error-checking
– Scans drive for system errors and bad sectors
– Drive is not available during the scan
• Defragmentation
– Analyzes drives for fragmentation (scattered files)
– Disk Defragmenter: analyzes and reorganizes drives
• Backup
– Copies contents of files and folders
– Option not available on Windows XP Home edition
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
47
Tools Tab (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
48
Tools Tab (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
49
Hardware Tab
• Provides access to drive information and settings
• Three sources of information
– Name and Type: display model names and types
– Troubleshoot button: links you to Help and Support
– Properties: used to set drive removal policies and
write caching
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
50
Hardware Tab (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
51
Sharing Tab
• Shares the entire contents of a drive
• Hidden share C$ is displayed in dialog box (default)
• Creating additional shares (for administrators)
–
–
–
–
–
Click the New Share button
Type the share name in the Share name text box
Click the Permissions button
Check the appropriate Allow check boxes
Click OK twice
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
52
Sharing Tab (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
53
Security Tab
• Used to set the NTFS permissions
– NTFS permissions control access to data on drive
• Modifying NTFS group permissions (administrator)
– Set the Allow check boxes for each user group
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
54
Security Tab (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
55
Quota Tab
• Tracks/controls disk space usage for NTFS volumes
– Used by administrators to optimize use of disk space
• Options
–
–
–
–
–
–
–
Enable quota management
Deny disk space to users exceeding quota limit
Do not limit disk usage
Limit disk space to
Set warning level to
Log event when a user exceeds their quota limit
Log event when a user exceeds their warning level
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
56
Quota Tab (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
57
Managing Fedora Core 4 File Systems
• Use the fsck command
• Manage swap space
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
58
File System Checking and Repairing
• File corruption and OS errors
– Caused by power losses or non-graceful shutdowns
– File system buffer cache out of sync with disk
• Buffer cache: memory used for quick data access
• fsck command: checks for and repairs errors
– Syntactically similar to the mkfs command
– Format: fsck –t ; e.g., fsck -t ext3 /dev/hda2
– Exit code returned provides description of error
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
59
File System Checking and Repairing
(continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
60
Swap Space Management
• Paging supports multitasking
– Pages written to disk when physical memory is low
– Pages read back into physical memory when needed
• Swap space is used to implement paging
– Swap partition: guarantees contiguous disk blocks
– Swap file: blocks may fragment, are not easily scaled
• Use free command to determine swap space size
– Detailed report of memory usage
– All the numbers are reported in 1024-byte blocks
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
61
Swap Space Management (continued)
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
62
Summary
•
•
•
•
•
Three partition types: primary, extended, logical
Storage area allocated and formatted for file system
File systems supported by Windows XP: FAT, NTFS
File systems supported by Fedora: FAT, ext2, ext3
NTFS uses volumes; FAT, ext2, and ext3 use
partitions
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
63
Summary (continued)
• NTFS options: journalizing, compression, encryption,
security, auditing, and quotas
• Disk Management Console: Windows XP disk tool
• Windows XP premounts drives (except USB drives)
• Mount drives in Fedora Core 4 as needed
• File system management tools are available in
Windows XP and Fedora Core 4
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux
64