Housekeeping

In its day to day use your PC creates files which it stores and often doesn't remove from the disk. These can if left unmanaged cause problems.

This section of the Primer looks at ways you can keep it in reasonable working order.

Defragmentation

It is wrong to assume that files are stored as a continuous length on a hard disk, this may be the case when the disk was new but, as files are removed or updated they may be split into several segments and distributed about the disk. The record of where these parts of a file are kept is stored in the File Allocation Table (FAT) and it is this which most boot sector viruses attempt to destroy.

The logic behind splitting files on the disk is that the heads, being parked at the outside of the disk have less distance to travel to pass over the relevant files, speeding up (decreasing) the time it takes to read a file.

Defragmentation is not something you will need to do on a frequent basis, I do my machines perhaps every couple of months, however Fileservers swapping a lot of files may benefit from a once a month defrag.

Here we see the way that a number of files, each represented by a different colour, may be distributed about a disk. The Grey areas are used by other files and the White areas are free space. As you can see there are small pockets of unused and because of their size, unusable space scattered around the disk, ‘Defragging’ the disk will locate all of this spare space in one place, making it available to be used.

A 'Fragmented' disk

 

How does fragmentation happen?

 

The image below shows three files located on a disk, with no wasted space between the files

 

Here the middle file has been deleted, freeing the space to be used again.

 

A new file, or part of a file has been written into the available space, however it was smaller than the gap, wasting a block at the end. This block is to small for use and is a 'fragment'

 

After defragmentation we see the files have been moved, freeing space at the end of the sequence. This defragmentation, used on a large hard disk, can often release 10% of the total disk space to be used again.

 

In this illustration we see the disk after defragmentation, which has the additional benefit of moving the sections of a file into one place, decreasing the time taken to access a file. You will never achieve complete defragmentation, but the process is still worthwhile.

A 'Defragmented' disk

Windows Defragmentation

Note the interface may vary depending on the version of windows running

The Defragmentation tool in Windows is accessed through the ‘START’ button on the menu bar, by following the path Programs/Accessories/System tools and clicking on the icon will present you with the screen Fig 11, this will allow you to chose the drive, either fixed or floppy, you wish to defragment.

 (1) Follow the route shown to the Defragmentation utilityand 'click' on it. The route is the same in both Win2000 and XP.

The path to Defragmentation in Windows 2000

Next 'Click' on the 'Analyze' button.

 

When the analysis is complete you will be presented with an image of how the files are distributed on the disk.

 

A dialogue box will appear, informing you if the system feels the drive needs defragmenting. In the illustrated case it does not, however you can continue with defragmentation if you wish by pressing the 'defragment' button

 

Depending on the size of the disc and the volume of files on it, defragmentation may take several hours.

Here we see a before and after, as you can see the fragmented files have disappeared.

.tmp files

As a consequence of using a PC running any of the flavours of MSWindows currently available, you will be constantly creating temporary files, and if running a web browser adding files to the cache.

Are usually created by windows as a by-product of switching between applications and are only usable by Windows itself, they are not usable, recoverable versions of any work you may have lost. Their location on your hard disk depends on a number of factors.

.tmp files are NOT automatically deleted by any process, and if not removed will eventually fill up your hard disk!.

Web Browsers

These create an enormous number of files in their CACHE directory. So why does this happen?. Caching is a method of speeding up the reloading of a previously visited site, or page. All the information from that page, both the HTML code and any images on that page, are kept in the cache and reloaded, instead of revisiting the site. The files are not automatically removed, so you can end up with a situation in which every image, on every page the browser has ever displayed is stored on the hard disk.

It is possible to select where the cache files are stored, and this should be in the TEMP directory, making them easier to locate and deal with.

Start by clicking on Tools then Internet Options

Click on the Settings button

A dialogue box will appear, this will allow you to change a number of settings.

The upper part of the box allows you to define when the browser will check to see if there is a later version of a page than that in the cache. The default is Automatically however if, like me you are always updating web pages, it should be set to Every visit to the page

The lower part of the box sets where the temp files are stored and the maximum amount of space they can use. As you can see the folder they're in is some way down the file system, to change the location to somewhere easier to find, click on the Move Folder button

 

Probably the most obvious place to put them is in the Windows (or Winnt)/temp folder on your C: drive, so click on that drive in the box.

Then click on the temp directory

 

The Temporary internet files directory has been redefined.

The only other option you can configure is the amount of space allowed for the cache, this is set by the OS and is best left alone.

Click OK to continue

Another dialogue box will appear, informing you that Windows needs to log you off to move the Temporary internet files to the new location. If you say No the changes will not come into effect.

Removing temp files

I recently went looking at the number of .tmp files on my PC.

Firstly in DOS, I opend a command window, typed cd \ to go up to the root of the C: drive, then typed dir *.tmp /s which looked through all the subdirectiories (/s). It came back with a list and total of all the .tmp files in my C: drive, some 457 files, using about 143MB of my disk space.

The same exercise in Windows gave a grand total of 26 files of an unknown size. bit of a difference there! and it strikes me that bloody dog's not earning his biscuits!. Its no wonder command line applications are still popular!

Read the section on DOS if you want to know more.

Removing Software and Applications

© Allen. C. Roffey 15:41 29/05/2005