File and Disk Maintenance 1 File Systems A file system defines the structure and the rules used to read, write, and maintain information stored on a disk. Which system used is determined by; Hardware Software Security needs Need for a dual-booting system 2 FAT??? file allocation table – where the OS records how the disk space is used 3 File Systems FAT 16 – oldest, created for DOS, supported by most OSs’, cannot be installed on partitions larger than 2 GB, or on hard drives larger than 4GB. FAT 32 – supports disks from 512 to 2TB, compatible with Windows 98 and up NTFS – (new technology file system) – better file security (Encrypting File System), disk compression, logging features, reliability and stability. NTFS volumes can not be accessed by DOS, or Windows 95 or Windows 98. 4 File Systems The operating system keeps track of data (documents, pictures, etc.) by placing it into a file. To store and retrieve files: Disk divided into tracks Tracks are divided into sectors Sectors grouped into clusters Number of sectors in a cluster is determined by Size of the hard drive File allocation system – FAT, FAT32, NTFS, e 5 When you format a disk the operating systems creates concentric recording bands, called tracks, around the circumference of the disk. Then, the formatting program (in our case Windows XP) subdivides each track into equal parts, called sectors. Although not all of them are shown in the following diagram, there are 80 concentric tracks on a 3 ½ inch high density diskette and each track is divided into 18 sectors. Each sector in turn contains 512 bytes. So let’s see . . . . . 80 tracks X 18 sectors X 2 sides X 512 bytes = 1,474,560 bytes = 1.4 MB 6 Tracks Sectors within a Track Cluster 7 A hard disk has extremely smooth metal or glass plates called “platters” (vs. the floppy mylar disk of a floppy disk). Each platter is divided into tracks and sectors by the format operation, like a floppy disk, however the number of tracks and sectors is different. The number of tracks on a hard disk depends on the disk size and the manufacturer. 8 Clusters? A cluster, also known as an allocation unit, consists of one or more sectors of storage space, and represents the minimum amount of space that an operating system allocates when saving the contents of a file to a disk. The number of sectors per cluster is dependent on Type of disk (floppy disk, hard disk) Version of operating systems Size of disk Every sector contains 512 bytes. (NTFS does allow you to change this number.) The number of clusters per disk is determined by the filing system (FAT 16, FAT 32 or NTFS). 9 DRIVE SIZE FAT 16 Cluster Size FAT 32 Cluster Size NTFS Cluster Size 260 to 511 MB 8 KB (16 sectors) Not Supported 512 bytes (1 sector) 512 to 1023 MB 16 KB (32 sectors) 4 KB (8 sectors) 1KB (2 sectors) 1024 MB to 2 GB 32 KB (64 sectors) 4 KB (8 sectors) 2 KB (4 sectors) 2 to 4 GB 64 KB (128 sectors) 4 KB (8 sectors) 4 KB (8 sectors) 4 to 8 GB Not Supported 4 KB (8 sectors) 8 KB (16 sectors) 8 to 16 GB Not Supported 8 KB (16 sectors) 16 KB (32 sectors) 16 to 32 GB Not Supported 16 KB (32 sectors) 32 KB ( 64 sectors) >32 GB (up to 2 TB) Not Supported 32 KB (64 sectors) 64 KB (128 sectors) 10 Example - File size = 2KB Hard drive = 2GB FAT 16 – the file will use 1 cluster which is 64 sectors, so 64 X 512 bytes per sector = 32KB – 2KB = 30KB slack space FAT 32 – the file will use 1 clusters which is 8 sectors, so 8 X 512 bytes per sector = 4KB – 2KB = 2KB slack space NTFS – the file will use 1 cluster which is 4 sectors, so 4 X 512 bytes per sector = 2KB – 2KB = 0 slack space 11 So, what does this all mean to us, as Windows XP users? The bigger your disk – the bigger your clusters (because there is a maximum number of clusters per disk). One way to help alleviate the problem of slack space is to partition the hard drive into smaller “drives”. Reducing the drive size will reduce the cluster size. 12 So what can cause problems with a Disk? Physical hard drive problems: • Wear and tear on hard disk - Minimize with Power Management and/or Hibernation • Head crash - Minimize by placing system where it will not get knocked around. Software-related problems: • Viruses -Minimize by using virus protection software Some error causing conditions to data that may be repairable: Power surges Power outages Locked system 13 Cleaning Up Your Disk Computer performance depends a great deal on the hard drive. Need disk space for: New files Temporary files Documents waiting to be printed Cache files Cache – storage area for often used information that can be accessed quickly Recycle 14 Cleaning Up Your Disk Disk cleanup is a utility that helps maintain the hard disk. Intended for hard drives. Will remove the following; Internet cache files Downloaded program files Offline web pages Offline lines, & temporary offline files Temporary files Files in the recycle bin Windows components that you no longer use Installed programs that you no longer use Catalog files for the Content Indexer 15 Check Disk The Check Disk utility is a disk analysis and repair utility that examines disks for errors and, where possible, repairs errors. Checks the logical structure Checks the physical integrity of the disk’s surface, if it finds a bad sector it will attempt to move the data to another location. Take care of Lost Clusters 16 What are lost clusters? Lost Clusters: Have no directory entry in directory table • Do not belong to any file • Take up disk space • Unavailable for new data • Cannot be retrieved/deleted • • Reasons for Lost Clusters • Not exiting program properly • Power surge/failure 17 Lost Clusters Example 18 Check Disk can fix lost clusters Can fix lost clusters automatically or Save them to disk as files Side note: You can check if you have lost clusters by clicking on a file and comparing the file size in explorer window to status bar files size. 19 Check Disk continued CAN check/repair local hard drives, floppy disks, and removable drives CANNOT find/fix errors on CD- ROMs or network drives 20 Check Disk, continued Should be used on a regular basis The first time you use it you should back up your disk before running check disk. Close all open programs when using this program, including screen saver If disk is formatted as NTFS, Windows XP Professional will automatically (without running Check Disk): Log all file transactions Replace bad clusters Store copies of key information for all files on NTFS volume 21 Contiguous and Noncontiguous Files Windows XP Professional keeps track of data by placing it into a file. To store and retrieve files: Disk divided into sectors Sectors grouped into clusters Number of sectors in a cluster is determined by Size of the hard drive File allocation system – FAT, FAT32, NTFS, etc. 22 Contiguous and Noncontiguous Files When a file is deleted: Only entries in FAT deleted Space file occupied becomes available 23 Contiguous and Noncontiguous Files Files are: Contiguous – written to adjacent clusters on a disk Noncontiguous (fragmented) – written to a disk in nonadjacent clusters. So a Fragmented Disk has noncontiguous files. It takes longer to read a Fragmented Disk because the head must move around so much going to the various locations of the file clusters. 24 25 26 27 Defragmentation Rearranges the files on a disk so that all parts of each files are store in consecutive clusters. It also records the clusters for one file right after the clusters for another file, and in the process, removes free space between files that would result in more fragmentation. At the end of defragmentation all the unused space is near the inner edge of the disk. 28 Defragmentation, continued Prior to running Disk Defragmenter: Run Check Disk and Disk Cleanup Close All open programs Allow ample time, can take hours – depends on how fragmented your disk is. Back up disk 29