Idefrag Quick Start Guide
Idefrag Quick Start Guide
Introduction
This guide provides a brief overview of iDefrag but does not cover every feature of iDefrag. The help within iDefrag provides a more comprehensive reference guide.
If, having read this guide and looked in the help, you still cant gure out how to use the product to achieve a particular goal, please contact our support team who will be happy to assist.
Contents
Before you start ........................................................................................4 Authorization ..........................................................................................5 Main Display ...........................................................................................6 Algorithms................................................................................................9 How can I tell if my disk needs defragmenting? ...................................10 What next?.............................................................................................10 ermal Monitoring ..............................................................................10 e Info Panel ........................................................................................11 Troubleshooting......................................................................................12 Appendix - Filesystems and Disks.........................................................13
Figure 1
Authorization
Mac OS X has built-in security features to prevent applications (and other users) from accessing the disk directly. As a result, iDefrag sometimes needs to ask you for permission when you select a disk. When this happens, youll see a gold colored padlock like that in Figure 1, above. Click on the lock button and then enter your OS X username and password when prompted. It is not asking you for the username and password that you might have been given when you purchased iDefrag.
Whenever you see a gold padlock, your computer is asking for your permission to perform some operation. You should read the window being displayed on the screen carefully to understand which program is asking for permission and why, and only enter your OS X administrator log-in details if you are sure you know what will happen.
Main Display
In Figure 2, opposite, you can see the major features of iDefrags main window: 1. Using this pop-up list, you can choose which of iDefrags algorithms you want to run. Algorithms are discussed below. 2. When youre ready, click the Go button to start defragmenting. You may be able to make out a small gray circle containing a white left-pointing arrow at the bottom corner of the Go button. This is the restart badge, and indicates that iDefrag will need to restart your computer to defragment this disk; some disks can be defragmented without a restart, and in that case the badge will not appear. 3. Each square in this area of the window represents a single block in your le-system. The colors indicate what kind (or class) of le is using the block for example, green is used to represent Applications. Note that iDefrag shades adjacent runs of blocks of the same color in an alternating light/dark pattern, so you can see the ends of your les or fragments. Anything thats red is fragmented. If the default colors are not to your taste, you can change them from the Key panel Your custom colors will be saved in iDefrags preferences for future sessions. Just like the default set, each color you set will be drawn in a darker and a lighter version so that you can see individual fragments on your disk. 4. This part of the window shows a representation of the entire disk. The white parts show what is free space. In this particular example, you can see that there are a lot of fragmented les (theyre red) and theres not much free space (white). 5. At the bottom youll see some tabs that you can select that will show you more information about the volume. Youll nd more information about the other tabs in the Help. 6. On the left, youll see a list of volumes that you can choose from. iDefrag will only list volumes that it supports: the Mac lesystem format (HFS+); not Windows formats such as FAT or NTFS. Many external drives come pre-formatted with FAT If you purchase an external disk, it will probably have been formatted for use with a PC. In order to provide the best performance, and to allow the use of all of the features of Mac OS X, we recommend re-formatting external disks before use with the Mac OS Extended (journaled) option in Disk Utility.
5
Figure 2 iDefrags main window
What does the Class Set pop-up do? Advanced users can create new categories (or classes) of le and can specify what iDefrag is supposed to do with them, by de ning their own classes in a class set le. You can nd the details in the iDefrag Help.
Algorithms
iDefrag comes with a number of di erent algorithms and one of the rst things that most people ask is which one should be used. In this version of iDefrag, the available algorithms are:
Full Defrag
If you dont want to think about which algorithm to choose, choose the Full Defrag algorithm (which is actually a combination of the Metadata and Optimize algorithms). The Full Defrag algorithm is the most comprehensive of all the algorithms and will be the right thing for most people. After running this algorithm to completion, all your les should be defragmented and in an optimum position on your disk.
Compact
This algorithm compacts your free space but wont defragment les. It is much faster than the Full Defrag algorithm. Use this algorithm if youre having trouble with the Boot Camp assistant or if you dont have the time to run the full defrag option. Even though it doesnt defragment les, it can still be quite e ective because it can re-enable OS Xs built-in defragmentation (which will stop working when your free space is too fragmented).
Quick (on-line)
This algorithm is useful if iDefrag is unable to get exclusive access to the volume that you want to defragment and you dont have the time to reboot. This algorithm will only work on les that are not currently in use (which rules out all system les).
Figure 3
What next?
When youre ready to start defragmenting, click the Go button and iDefrag will start. The process can take a long time although it depends on the algorithm. The Full Defrag algorithm can take many hours and we advise you to leave it running over night. You can choose what iDefrag does when it has nished, e.g. turn your machine o select Preferences from the iDefrag menu. For the o -line algorithms, you will not be able to access the volume that iDefrag is working on, but you can continue to work with any other volumes that you might have mounted; your options are obviously limited if iDefrag is running from a boot disk. You can pause defragmentation at any time, but this will not give you access to your volumeit prevents iDefrag from using any processor resources, which might be useful if you want to dedicate your machines processor to some other task for a while.
Thermal Monitoring
During operation, iDefrag will monitor the temperature of most disks (it will warn you if it cant) and pause if the temperature exceeds thresholds de ned in the Preferences. By default, iDefrag is set to stop at 55C which is appropriate for many disks, but some disks operate at a higher temperatures. If you nd iDefrag is frequently stopping, its worth checking to see what temperature your disk operates at and you can usually nd this information by searching the Internet for the model number of your disk. The model number of your disk can be found by using the System Pro ler application that comes with OS X.
10
Figure 4
11
Troubleshooting
If you are having problems with iDefrag, check the help within iDefrag, particularly the Troubleshooting sections. A copy of this help can also be found here: http://www.coriolis-systems.com/help/iDefrag-2/ Also, check the frequently asked questions page for iDefrag: http://www.coriolis-systems.com/iDefrag-faq.php If you still cannot nd an answer to your question you can contact our support team: [email protected] If you want to report a bug, request a feature or suggest an improvement in iDefrag you can do so via the menu option within iDefrag or you can do it on-line here: http://www.coriolis-systems.com/bugreport/
12
13
A typical drive has multiple platters mounted on a central spindle, and multiple heads attached to the head armature
Spindle/hub
Spindle Head Head armature rotates, moving heads across the disk surface
Head armature
Figure 5
Inside a typical hard disk you will nd a set of platters mounted on a rotating spindle, each with one or more disk heads oating just above the surface.
14
Cylinder
Sector Track
Head
To identify a particular piece of data on the disk surface, it is necessary to specify which cylinder, head and sector you wish to access.
Once the head has been moved to the correct cylinder, the disk must wait for the sector to pass under the head due to the rotation of the spindle.
Figure 6
In terms of the mechanics of the disk drive, selecting a head is done electronically, and takes essentially no time at all. The time spent waiting for a particular sector to pass under the disk head obviously depends on the rate of rotation of the drive and the size of the sectors; this is one reason why hard disks that spin at a higher rate are preferable, though the high rate of rotation also means that individual bits of data pass under the head faster, resulting in a higher rate of data transfer. Changing cylinder is comparatively expensive, taking of the order of several milliseconds on a typical modern drive. Moving the heads a single cylinders width in or out is relatively quick as the positioning mechanisms typically used in modern drives are accurate enough to move one cylinder in either direction reliably. For longer movements, however, the mechanism may not be su ciently accurate to guarantee that it will move the heads to the correct location; as a result, each track contains information allowing the drive to identify the track over which the head is currently located. If the drive does not move to the correct track the rst time, it may need to move again, typically by successively smaller distances, until it nds the right location. The most expensive movements are normally full-stroke movements, where the disk heads are moved from the innermost cylinder to the outermost cylinder or vice-versa. Figure 6 shows the process of locating a given sector on the disk using cylinder, head and sector numbers. Older disks, with the exception of SCSI disks, typically expect the host computer to provide them with co-ordinates for data in this form, which is also referred to as CHS or Cylinder Head Sector. Unfortunately this scheme has a number of downsides, notably that di erent disks will have different numbers of cylinders and heads, and may even choose to have di erent numbers of sectors on each of their tracks; the arrangement of cylinders, heads and sectors for a given disk is referred to as its geometry. Using real CHS values also prevents the disk from easily re-assigning sectors where it discovers that the magnetic media is damaged, and instead the computers software must deal with this problem itself.
15
Finally, as disks grew in size, it became apparent that the elds reserved for cylinder, head and sector numbers, both in software and in hardware, were too small to cope. As a result, IDE disks started to lie to the host computer about their geometry, both for compatibility with the PC BIOS and so that they could start to manage bad sectors automatically themselves. Modern disks are not generally used with CHS values; instead, sectors are given a number starting from zero or one. This is often referred to as a Linear Block Address or LBA. When accessed in this way, the disk manufacturer is free to choose the locations of each sector on the physical media in any way they please so as to optimize the performance of their drive mechanism; normally the assignment of blocks is done in such a way as to guarantee good performance if the blocks are accessed in LBA order.
16
lesystem driver The computer program that implements the abstract design, thereby allowing your Mac to read a disk formatted according to the lesystem speci cations. volume The contents of a particular disk, formatted according to the lesystem speci cations.
In addition, rather than the whole disk being used to hold a single volume, disks can be divided into pieces called partitions, each of which might contain a separate volume.
17
0
File List
1
Alloc Table
9 10 11 12 13 14 15
0
File List
1
Alloc Table
4
File A
8
File B
9 10 11 12 13 14 15
File C
0
File List
1
Alloc Table
4
File A
9 10 11 12 13 14 15
File C
Figure 7
To help us understand what the lesystem does, lets take a look at an idealised lesystem, which well call SimpleFS. SimpleFS version 1 supports storage of les in contiguous chunks on disk. Well imagine that we have a very small disk with sixteen blocks total. Well allocate one block to hold a list of the les on the disk, and in case we want to cope with bigger disks in future, well allocate another to hold information on which blocks are allocated, as shown in Figure 7 (a). Well skirt over exactly how this information is stored in these reserved blocks, as it doesnt matter for the purposes of our explanation. So, lets save a le to our disk; our le is 3,000 bytes in length, so it takes up 3,000 512 = 5.9 blocks. SimpleFS only lets us allocate entire blocks, so well use 6 blocks to store this le call it File A. Well also save File B, 1,300 bytes long (3 blocks), and File C, 1,000 bytes long (2 blocks). The result is shown in Figure 7 (b). Easy so far, right? Next, lets delete File B from our disk. The result is shown in Figure 7 (c). Imagine we now wish to save a new le, File D, and that this new le is 2,400 bytes in length (5 blocks). We have seven blocks free, but the largest contiguous space is only four blocks long! Thats no good we cant save our new le even though we have 50% of the usable blocks marked as not allocated! Lets imagine for a moment that we can somehow upgrade our disk to a new SimpleFS 2.0 that allows us to use all of these blocks to store our data. We still want to save File D, which takes up ve blocks, so we store the rst three in blocks 7, 8 and 9, and the remainder in blocks 12 and 13. Figure 8 (a) shows the result. This is great! We can use every block on the disk if we want.
18
0
File List
1
Alloc Table
4
File A
8
File D
(Part 1)
9 10 11 12 13 14 15
File C File D
(Part 2)
Fil
Fil
Fil
Fil
eD
eD
eD
eD
File List
c Table Allo
File D File D
File List
c Table Allo
File A
File A
A
e
Fil
Fi l
Fi l
On-disk layout of the blocks, assuming a very simple mapping of linear block address to physical disk blocks.
Fil
Figure 8
Unfortunately, we have created a problem for ourselves. Lets assume that the disk weve formatted for use with SimpleFS is very old and slow. For sake of argument, lets give it a single platter with only a single side, so we have one head, and lets give it four cylinders, with each track holding four sectors. For the next part, you can follow what is going on by starting at the black spot in the right hand part of Figure 8 (b) and tracing the line as it goes clockwise around the disk. Assume we want to read File D from the disk, we rst have to go and nd it in the le list, which means reading block 0. The le list tells us where File D is on the disk, so the next sector we want to read is block 7, which on our disk is on track 1; were currently on track 0, so we move the head out out one track. But we arent in the right place to read block 7, so we have to wait for the disk to revolve until the head is over block 7 so we can read it. Having read block 7, we now need block 8; this is on track 2, and our disk head is over track 1, so we move the head outwards again. Yet again, we arent in the right place to read block 8 (weve missed the beginning of it), so we need to wait for the disk to rotate again. (If youre following along at this point, switch to the grey line.)
19
We can now read blocks 8 and 9 one after the other, without moving the disk head. The next block, though, is block 12, and thats on the outer track, track 3, so we yet again need to move the head out one track, and since yet again we arent in the right place yet, we need to wait for the disk to rotate. Finally, we read blocks 12 and 13 one after the other, and were done. During this process, the disk has revolved three and a half times, and weve had to move the head three times, not counting any initial movement to get to the starting point on track 0. Lets say this disk is very slow indeed, and takes half a second to move the head, and rotates at 20rpm. Weve spent a total of 3 0.5 + 3.5 20 60 = 12 seconds reading this le. Now lets consider what might happen if we swapped the positions of the end of File D with File C. Well, this one simple change will put the nal blocks of File D on the same track as the previous two blocks, so we could read 8, 9, 10 and 11 one after another, without moving the disk head and without waiting for the disk to rotate. We save one head movement and one and a half rotations! In that case, we would only spend 2 0.5 + 2 20 60 = 7 seconds. Thats a 42% time saving, just for moving the blocks of File D so that theyre next to one another on the disk! When a le is split into more than one piece like File D was here, it is said that that le has become fragmented, and the pieces are typically referred to as fragments. On the Mac lesystem, HFS+, you may also see them referred to as extents, which is a reference to the way the lesystem maintains the information about the fragments of a le. As you can hopefully see from this (heavily simpli ed) example, allowing the lesystem to fragment les is a trade-o . Without it, you might not be able to use all of the space on your disk, but on the other hand, a fragmented le might take a lot longer to read or write than it would if the le was in a single piece. Clearly, therefore, what you dont want is for a le to be fragmented when it didnt have to be.
20