DEFRAGMENTATION Presented to: Sir Ahmad Karim www.BZUPAGES.com Beenish Jahangir BsIT-07-04 www.BZUPAGES.com Fragmented files •When we open any data file of some drive, made changes in it and save it again •Its original location might not have room for the newer one •Operating system save it on some other part of that drive •This result in the storage of different part of that file at multiple location on the drive •The file is said to be fragmented •The number of times these files are opened make your work slower •When deleted, create small locations of available spaces •Newly created files will not nestle neatly into one contiguous space •Hence, your drive is fragmented www.BZUPAGES.com Windows Server 2003 provides two built-in programs to defragment your drives: • Disk Defragmenter, on the System Tools submenu of the Accessories menu. Selecting this menu option opens an MMC snap-in, dfrg.msc. • Defrag.exe, which works from the command line. Defragging • Defragmenting the files • A defragmenter works by gathering all the pieces of a file and writing them back to the drive in one contiguous location. • This program works by moving other fragmented files, makes room for each file placing them in a temporary location until it’s their turn to be defragmented. www.BZUPAGES.com Disk Defragmenter Snap-in •Launch the GUI version of the built-in defragger through Start menu<Accessories submenu<System Tools submenu<Disk Defragmenter. •One must have administrator rights to use this snap-in TIP Create a desktop shortcut to the Disk Defragmenter by; •Right-draging the program file •Choose Create Shortcut by right-clicking www.BZUPAGES.com Analyze the Drive The Disk Defragmenter window, It lists the local drives, along with information about the installed file www.BZUPAGES.com system, capacity, and disk space usage. Disk Defragmenter analyze the disk before running defragmentation procedure. You must analyze first, because •defragging is an intensive,lengthy procedure, •analysis could show there’s no need to defrag the drive. Starting an analysis Many shortages methods for launching the Analyze process: • Right-click a drive and choose Analyze from the shortcut menu. • Select a drive and click the Analyze button. • Select a drive and choose Analyze from the Action menu. CAUTION Open files cannot be analyzed (or defragged), close all applications and utilities before beginning this process. www.BZUPAGES.com As the Analyze function inspects the drive, watch the progress in the Analysis Display bar. The display is color-coded: • Blue = contiguous files • Red = fragged files • White = free space • Green = system files (cannot be moved). •Pause button to halt the process to retrieve a file or perform some other task on the computer. •Resume continue the analysis again. •Stop button to halt the entire process. www.BZUPAGES.com When the analysis is complete, a message box displays to advise you whether your drive needs to be defragmented. TIP You can use the buttons on the Analysis Report window to print the report, or save it as a text file, if you have some reason to require a permanent record. www.BZUPAGES.com View Report For detailed information about the state of the drive, which files and folders are fragmented, the number of fragmented segments that exist for each www.BZUPAGES.com •If you scroll through the list, you can see the files you use frequently are highly fragmented. •The more fragmented files you open, and the greater the number of fragments, the slower your system performs. •After viewing the report, defrag the drive even though Disk Defragmenter doesn’t find it necessary. •Run the Analyze procedure regularly; the frequency depends on the activity level of the computer. • For instance, file servers that are accessed by a large number of users should be analyzed at least weekly. www.BZUPAGES.com Kiran Shakoor BsIT-07-05 www.BZUPAGES.com Defragment the Drive You can defrag a drive immediately after running the Analyze procedure (a Defragment button appears on both the Analysis Complete message box and the Analysis Report window), or wait until later. Open files cannot be defragged, so be sure to close all applications. www.BZUPAGES.com If you’re defragging a file server, perform the task during nonbusiness hours. Start the defragmentation procedure by selecting the appropriate drive and using one of these methods Click the Defragment button. Choose Defragment from the Action menu. Right-click the drive’s listing and choose Defragment from the shortcut menu. www.BZUPAGES.com Before the defragging starts, the drive is re analyzed (even if you just finished running the Analyze procedure); then the defragmentation procedure begins. The Analyze display bar shows the graphical representation of your drive as analyzed, and the Defragmentation www.BZUPAGES.com Display bar shows the condition of your drive as defragging proceeds. You can track the progress in the Defragmentation display bar, but it’s probably better to find something else to do, because this process takes quite a bit of time. When defragmentation is complete, a message announces that fact. Use the View Report button in the message box to see a detailed report on the drive’s new fragmentation state www.BZUPAGES.com Limitations of the Disk Defragmenter The Disk Defragmenter application that is included with Windows Server 2003 has some serious limitations. Microsoft programmers didn’t write this software; it’s obtained from Executive Software, who provided a limited version of its full retail product. www.BZUPAGES.com Here are the limitations: You cannot schedule the Disk Defragmenter. You can only defrag local volumes; this version has no capacity for remote procedures. You can defrag only one volume at a time. www.BZUPAGES.com Uzma Noreen BsIT-07-08 www.BZUPAGES.com Defrag.exe A command-line program that you can use instead of the snap-in. This executable calls the same code the snap-in calls (the Executive Software Disk Defragmenter). Advantages The biggest benefit is that you can schedule it, using the Windows Server 2003 Task Scheduler, which isn’t possible with the snap-in. The other advantage, which is probably only considered an advantage to command-line junkies, is that it has the speed and efficiency of a command-line application. www.BZUPAGES.com The syntax for defrag.exe is defrag volume: {/a] [/f] [/v] where: Volume, is the drive letter of the volume you want to defrag. /a only runs the analyze process. /f forces defragmentation of the volume even if an analysis shows it doesn’t need to be defragmented. /v displays verbose output while the program is running. www.BZUPAGES.com If you enter defrag volume letter: at the command line, without any switches, the program performs an analysis, then defrags the drive. In fact, the program always performs an analysis first, even if you specify the /f switch. If you don’t opt to display verbose output, the program displays a summary of the analysis, and then you see a blinking cursor. When defragging is complete, you’re returned to the command prompt. www.BZUPAGES.com If you choose the /v switch, the program displays information about the defragmentation state of the folders and files from the analysis process (the Analysis Report), and then displays the same report, hopefully with better statistics (called the Defragmentation Report), after the defragging process. www.BZUPAGES.com The two reports are difficult to compare in the command window, because you have to keep scrolling up to see the analysis numbers, to compare them to the defragged numbers that are displayed further down. so it is easier to redirect the output of the reports, and then open the resulting data file in a word processor so to manipulate the display for easier interpretation. www.BZUPAGES.com To redirect an onscreen report, add the following to the end of the command: > filename.ext (use the filename and extension you prefer) Press CTRL-C to stop the program. Unlike the built-in Disk Defragmenter, you can’t pause defrag.exe. www.BZUPAGES.com Nazish Yaqoub BsIT-07-11 www.BZUPAGES.com Troubleshooting Troubleshooting is a form of problem solving most often applied to repair of failed products or processes. It is a logical, systematic search for the source of a problem so that it can be solved, and so the product or process can be made operational again. www.BZUPAGES.com TROUBLESHOOTING DEFRAGMENTATION After the defragging process is complete, your drive is still somewhat fragmented. There are a number of scenarios that can cause this, and some of them can be corrected. www.BZUPAGES.com The disk defragged is hard-coded to omit certain system files. Microsoft and Executive Software have documented the following omitted files: Bootsect.dos Safeboot.fs Safeboot.csv Safeboot.rsv www.BZUPAGES.com Hiberfil.sys Memory.dmp (if it exists) Paging file www.BZUPAGES.com Memory.dmp is a file that exists if you’ve configured your system to write the file when the system encounters a STOP error (Blue Screen of Death). The file is on the exclusion list in Window Server 2003 because the disk locations where this file is stored are loaded by the kernel when the system boots, and stored in memory. www.BZUPAGES.com Razina Ameen BsIT-07-25 www.BZUPAGES.com Defragmenting the System Paging File The system paging file (sometimes called the swap file) is always held open for exclusive use by the operating system, and therefore cannot be defragmented. However, if the paging file becomes fragmented, performance suffers quite noticeably. www.BZUPAGES.com You can remedy the problem if you have a second drive or partition on your computer. Here’s how 1) Open the System applet in Control Panel, or right-click My Computer and choose Properties from the shortcut menu. 2) In the System Properties dialog, move to the Advanced tab and click the Settings button in the Performance section of the dialog. 3) In the Performance Options dialog, move to the Advanced tab. www.BZUPAGES.com 4) Click the Change button in the Virtual Memory section of the dialog to open the Virtual Memory dialog shown in Figure www.BZUPAGES.com 5) Select another drive and configure a paging file with the same size specifications as the original paging file. 6) Select the original drive and then select No Paging File. 7) Reboot to force the system to use the new paging file www.BZUPAGES.com 8) Run Disk Defragmenter on the drive that paging file. originally held the You’re not defragging the paging file, of course, because it’s no longer there. Defragging the drive should create enough contiguous space to hold the paging file when you return it www.BZUPAGES.com 9) Move the paging file back to its original drive, using these same steps. After you reboot, the paging file is created anew, as a contiguous file, on the original derive www.BZUPAGES.com Ayesha Yasin BsIT-07-31 www.BZUPAGES.com Why won’t some files defrag? If you defrag a drive and the report that displays afterwards shows that many files are still fragmented, you may not have had enough free space on the disk to permit the software to temporarily “park” file fragments." The most common cause for files not getting defragged is that there is not enough space on the hard disk to do so” www.BZUPAGES.com As drives get crowded and free space shrinks, it’s not uncommon to have to run the defragmentation utility several times in a row in order to get a drive defragged enough to improve productivity. Each time the process runs, Disk Defragmenter does as much as possible, given the constraints of inadequate disk space. www.BZUPAGES.com Space neeeded: The defragger requires at least 15 percent of your disk to be free, but 25 percent is a better. www.BZUPAGES.com Solution The optimal solution is to move a substantial number of files off the drive, by copying the files to another drive or another computer on the network. That solution works best after you’ve defragged the drive once or twice in a single session. Look at the report and note the names of the files that have been successfully defragged. Copy those files to another drive or computer to give Disk Defragmenter chunks of contiguous space to work with. www.BZUPAGES.com During the defragging process, the software also tries to put all the free space in contiguous blocks, which enhances the probability that the files you removed can be put into contiguous locations when you copy them back. www.BZUPAGES.com Tayyaba Jahangir BsIT-07-33 www.BZUPAGES.com Disk Space Reserved in NTFS NTFS has a Master File Table (MFT) that must be located at the beginning of the volume The MFT holds information about the location of files (or multiple locations of files for those files that are fragmented). Windows reserves space at the beginning of the volume for the MFT. www.BZUPAGES.com One-eighth of a drive is set aside for the MFT zone. so when viewing the used/free statistics for an NTFS volume in Windows Deduct about 12 percent from the free space figure. Each record in the MFT is usually fixed at 1K, and the first 16 records contain information about the volume. These volume-specific records are called the metadata files. www.BZUPAGES.com www.BZUPAGES.com www.BZUPAGES.com Optimize Disk Defragmenter Performance Defrag after uninstalling an application. Defrag every time deleting a large number of files (or a smaller number of very large files). Defrag before installing an application, especially before installing any back office type of application (such as Exchange Server, Oracle, or SQL Server) on a server. Defrag after updating the operating system (for example, install a service pack, or reinstall OS files to repair a damaged system). www.BZUPAGES.com THANKS!!! www.BZUPAGES.com