Site hosted by Build your free website today!

"I have traveled the length and breadth of this country and talked with the best people, and I can assure you that data processing is a fad that won’t last out the year.” – The editor in charge of business books for Prentice Hall, 1957

Operating Systems



When you complete this section you will be able to:

  1. Discuss the need to mount disks before they can be used.
  2. Format a disk using both DOS and Windows.
  3. Discuss disk partitioning.
  4. Perform disk maintenance using chkdsk, scandisk, disk cleanup, and defragmentation programs.


Theory - This file contains the background and theory you'll need to successfully complete the lab exercises for this lesson. You should read this first.

DOS Lab - This is the Disk Operating System (DOS) lab manual. It contains activities and exercises to help you understand the theory as it applies to DOS.

Windows 98 Lab - This is the Windows 98 lab manual. It contains activities and exercises to help you understand the theory as it applies to Windows 98.

Windows XP Lab - This is the Windows XP lab manual. It contains activities and exercises to help you understand the theory as it applies to Windows XP.

Linux Lab - This is the Linux lab manual. It contains activities and exercises to help you understand the theory as it applies to Linux.

Skill Check - This set of questions will quiz your understanding of the operating system theory and practice presented in this lesson.

Challenge - This set of advanced lab exercises is designed to help you apply your understanding to new challenges.


In this lesson you will learn how operating systems work with disk drives. Your hard drive (and floppy) is divided into many storage "areas" and the operating system must be able to keep track of those various areas.


Disk Drives

From the earliest days of computing it has been desirable to store information outside the computer. There are three reasons why this is so:

In this chapter, we’ll learn how to manipulate disk drives. Most of the examples in the lab manuals involve only a “floppy” disk (for convenience), but the concepts are valid for both “floppies” and hard drives.

Image - Hard DriveHard Drives

You will not likely ever see the hard drive - unless you get brave and add a new one to your computer. (For the record, it is not difficult to add a hard drive to your computer - be bold and try it if you need one.) These devices are about the size of a pack of cigarettes (I won’t be able to use that analogy much longer) and fit into a small bay inside your computer. In the illustration on the right you see a Western Digital Caviar 31600 hard drive - a 1.6 Gbyte drive (aren’t you glad I told you all that?). This drive, like any hard drive, will have only two cables attaching it to your computer system - one is a flat ribbon cable (carrying controlling signals and hauling data in and out) and the other is the power cable (hard drives seem to be happier when supplied with electricity for some reason).

Image - Inside A Hard DriveIf you could take the hard drive apart you’d find a stack of small disks mounted on a spindle. The disks are made of a metal and are hard (hence the name “hard disk” - duh). Various manufacturers will spin the disks at different speeds, but 5000 to 7000 rotations per minute seems to be rather common.

You will also notice a small arm that can move back and forth across the disk’s surface. Actually, the arm must float on a very thin layer of air - it if actually touches the disk it will scrape grooves in it (now you know why it's called a "crash". The arm floats only about the diameter of a human hair away from the disk.

Image - A Platter StackA typical hard drive will stack several disks (called “platters”) on top of each other and have arms that move in and out between the platters - reading both the top and bottom of each platter. In the illustration on the left you can see a stack of four platters with the read/write heads on an arm on the right side. As the disk spins the read/write heads will slip in and out of the stack and access data on both the top and bottom of each platter at the same time.

Image - SectorsEach platter is divided into a series of concentric tracks and sectors. Of course, the division is not physical (you can’t see the division - even with a really good microscope) - it’s a trick built into the software. You can imagine that to the operating system one side of a disk looks like the illustration on the right. The concentric circles are called “tracks” and the tracks are divided into sectors. The tracks are numbered, with Track “0” being the closest to the hub. When several disks are stacked, the tracks are called “cylinders”, since the track on the top disk is exactly aligned with the track on the next disk, and so forth.

Of course, this simple illustration cannot capture the true number of cylinders and sectors on even a small hard drive. There are typically anywhere from 50 to 75 sectors per cylinder and up to 5000 cylinders in the disk pack.

You may wonder why I’m spending so much time on this topic (boring as it may be to you). As we work with operating systems you’ll see the terms “track,” “cylinder,” and “sector” used frequently - now you know what they mean. Besides, you may someday want to take a computer repair class and these terms will come back to haunt you.

Floppy Drives

Image - A Floppy DiskAll personal computers contain one or more floppy disk drives. You are familiar with “floppy” disks - they look like small, plastic squares about 3.5” along each edge (like the drawing to the left).

If you were to take one of these plastic containers apart you’d find a thin film of magnetic material inside. That film is magnetic tape, like you find in a VCR or Audio Cassette.

When you insert the disk into your computer the disk drive will start spinning the magnetic film within the plastic case. At the same time, the small aluminum cover will slide over so the “read/write” head can access the magnetic medium.

The floppy disk is divided into tracks and sectors, just like its big brother (the hard disk). However, there aren’t nearly as many because the disk is physically smaller. On a 1.44 Mbyte floppy there are 80 tracks, 18 sectors per track, and the disk is recorded on both sides. Each sector can contain 512 bytes of data giving a total of about 1.44 Mbytes.

Mounting Disks

Before you can work with a disk it must be made accessible to the operating system. A disk must be “mounted” so the operating system can use it - rather like plugging in the toaster before you can use it to scorch bread. This concept is usually a bit confusing to DOS and Windows users since those operating systems automatically mount the disk as soon as you attempt to access it. With Linux, though, the user must explicitly mount the disk drive before using it. You will have a chance to work with various mounting options in our lab manuals for this chapter.

Formatting Disks

Before you can start using a disk you must format it. Formatting a disk is nothing more than making it ready to hold files. Consider a new file cabinet. When you put labels on the outside of each drawer describing what’s in the drawer and then add some dividers, file holders, and other such materials to each drawer you are “formatting” that cabinet so it can hold files. It still doesn’t have any information stored inside, but it’s ready.

Formatting a hard drive or floppy disk is the same idea. You wipe all existing information off the disk and empty all sectors so you can put new information on the disk.

Note: this is a great time for this warning. Formatting a disk will permanently delete all the information from that disk. Do not format a hard drive unless you are absolutely certain that is what you want to do. Now, repeat after me: “I will not format a hard drive until I know that is what I want to do.” Good. With that done, let’s see how to format a disk. For the examples in the lab manuals we will format a floppy disk in the a: drive, so you should have a blank disk ready to use.

Partitioning Disks

When you purchase a new hard drive you have an option to partition that drive into smaller drives. What is partitioning? Think of it as erecting walls (partitions) on the disk so you have, in effect, chopped one large disk into several smaller ones.

When you finish partitioning your disk you end up with numerous smaller disks. For example, if you bought a new 10 Gbyte disk, you could partition that into 5 disks of 2 Gbytes each. If you did that, My Computer would report you have disk drives C:, D:, E:, F:, and G: - each only 2 Gbytes big. (Of course, your CD-ROM would now be disk drive H:, and your Zip disk would be I:, and so forth. I don’t know what happens when you run out of letters!)

Why would you want to partition your disk? If you are using Windows 98 (or later) there is no good reason (well, maybe there is one - it's explained in the next paragraph). However, Windows 95 (and earlier) can only access hard disks that are 2 Gbytes or smaller (back when Windows 95 was created having a disk larger than 1 Gbyte was unthinkable - 2 Gbytes seemed a safe limit). If you are using Windows 95 and buy a new disk drive that’s larger than 2 Gbytes you’ll need to partition it in order to use it - or upgrade to Windows 98.

There is one other reason to partition your hard drive. If you want to use two (or more) operating systems on your computer (this is usually called a “dual-boot” system) you have to give each of them their own disk drive (operating systems hate to share). By partitioning your disk drive you can put Linux in one partition and Windows in another and each operating system thinks it’s all alone on the hard drive (stupid OS, aren’t they?).

To partition your hard drive you would use an old program called fdisk. This program exists in DOS, Linux, and Windows (it’s one of the few “universal” programs). However, if you ever fdisk your hard drive it will totally wipe out all existing files, folders, and anything else you may have wanted to keep. Don’t use fdisk until you have backed up all your data and are ready for the “Big Wipe.” (That’s why we won’t do a lab for fdisk in this class - we have enough trouble with our computers without folks re-partitioning them!)


In a word: do them.

Backing up your computer’s disk involves sending the information from that disk to a magnetic tape, CD, Zip Disk, or some other medium so it can be used to re-construct the hard disk in case of emergency. Unfortunately, most users only learn the value of a backup after their hard drive “crashes” and they lose everything they have done for the past year or two. You must get into the habit of backing up often and regularly.

You may also want to consider storing your backup tapes or disks away from the computer (what is commonly called “off site”). If you have a fire in the building your backups will do no good if they are melted. All large businesses take backup tapes or disks to a different building for storage - that should tell you something.

Types Of Backups

There are, generally, three types of backups available: Full, Differential, and Incremental.

A full backup is a complete “dump” of your hard drive. Every file, every program, every setting is all sent to the backup medium. In an emergency, you could reconstruct your computer exactly as it was by simply restoring the backed-up copy to a new computer.

A differential backup is one that will check the hard drive for files that have been added or changed since the last full backup and store only those files on the backup medium. In an emergency you would have to restore the full backup first, then the last differential backup.

An incremental backup is one that will check the hard drive for files that have been added or changed since the last backup of any sort (differential or incremental) and store only those files on the backup medium. In an emergency you would have to restore the full backup first, then the last differential backup, then all incremental backups in the same order as they were stored.

For example, consider the following:

Day One Day Two Day Three Day Four Day Five
Initial State        
Horses.txt   Modified   Modified
Goats.txt Modified     Modified
Dogs.txt     Modified  
    Chickens.txt Modified  

If this table represents the activity on your computer, we can determine what would be backed up on any given day using either differential or incremental backups.

Differential Backups

On day one (the initial state) you would do a full backup and all five files would be saved to tape. Then, if you did a differential backup every day, here’s what would be saved.

You’ll note that every file that had changed since the full backup on day one is saved every day - however only the most recent version is saved. Thus, even though Goats.txt was changed two times during this period it is saved only once - but the saved copy is always the most recent.

If you had to restore the disk as it appeared on Day Five, you would restore the full backup done on Day One, then the differential backup done on day five.

The problem with differentials is that as time wears on the differential backup becomes larger and larger - and takes more time to create. In a very active file system the differential may take as long to create as a full backup after only a few days.

The advantage of a differential is that if you have to restore a system you only have to restore two backups - the original full backup and the last differential.

Incremental Backups

On day one (the initial state) you would do a full backup and all five files would be saved to tape. Then, if you did an incremental backup every day, here’s what would be saved.

You’ll note that on any given day only those files that have changed or been added on that day are backed up. An incremental back up stores only those files that were changed or added since the last incremental backup.

If you had to restore the disk as it appeared on Day Five, you would restore the full backup done on Day One, then each incremental backup in the same order in which they were made. So, you would restore the Day Two backup, then the Day Three backup, then the Day Four backup, and finally the Day Five backup.

There are two problems with incremental backups. First, they require a lot of storage media. If you are backing up to tape, you’ll need a new tape for the full backup and every incremental. In the above schedule, you would need six tapes total. The other problem is that a total restore takes a lot of time since you have to restore every tape in order.

The advantage to an incremental backup is that it takes very little time to do the daily backups. Only the files changed since the last backup are stored and that is, usually, a rather small number of files.

Backup Schedule

Whether you choose to use differential or incremental backups, you must schedule your backups and don’t fail to keep the schedule. Typically, a company will do a full backup, then schedule partial backups (differential or incremental) between the full backups. A busy office may complete a full backup every week (perhaps on a Sunday when the computers are not being used), and then use incremental backups every day (at 1 A.M., again, when the computers are not busy). If an office is not very busy they may schedule a full backup only once a month with incremental backups every week.

Finally, the backup media must be rotated. Most experts agree that you should keep at least two to three full backup cycles available “just in case”.  After two or three cycles, though, start re-using the media in order to save money.


This is just a quick note about the backup system I use. I have a read/write CD-ROM on my computer that I use to hold my backup files.

I have about 2.5 Gbytes of “stuff” on my computer. However, programs or other files I’ve installed from CDs occupy most of my hard drive. I decided that in the event of a disaster I could re-load all those programs from their original CDs so there is no reason to backup those files.

What I do want (and need) to backup are files I’ve created. I have a lot of Word documents and Web pages that I would not want to lose in the event of a disaster.

So, I made an intentional decision to keep any file I create in the My Documents folder. Then, when I want to do a backup I can simply copy My Documents to a blank CD. I have four CDs I use and I rotate them so that the oldest copy of My Documents is constantly being replaced by the latest.

This schedule is not exactly a full, differential, or incremental schedule. Call it the Self-schedule (copyright not pending). In a disaster, I will have to re-load all my programs from their original CDs onto a new hard drive. I’ll lose my personal settings for those programs, but that’s the way the mop flops. Then, I can copy all the files in “My Documents” from the last CD I made back onto the new hard drive. It isn’t a perfect backup schedule, but it works for the system I have available.

Whatever you do, remember the first words in this section about backups: do them.


In this lesson you've learned about disk drives and how they work. The important points to keep in mind are:

Good luck with your study of disks. Have fun with the labs - that's where you'll really learn how about disk drives!

DOS Laboratory

Mounting Disks

With DOS, you access the disk drive by entering the drive’s identification. For example, in Figure 1, I want to change from accessing the hard drive (the "C:" drive) to the floppy (the "A:" drive), so I entered a: (the colon is required).

Image - Changing A Drive

Figure 1 - Changing Disk Drives With DOS

When I finished the change, my screen looked like this:

Image - The A Drive

Figure 2 - Using the A: Disk Drive In DOS

The last line in Figure 2 indicates that I am now accessing the disk in drive a:. Now, any file commands I issue will effect files on drive a:, not on any other drive.

Formatting Disks

To format a disk with DOS, place a floppy in drive A: then enter this command:

format a:

The operating system will then format the disk. Format has a number of options you may want to use:

In the next sequence of figures you’ll see the DOS screens as I formatted a disk, then used some of the options to format it again.

Image - Formatting A Floppy Disk

Figure 3 - Formatting A Disk Under DOS

In Figure 3 I entered the command format a:. DOS then prompts me to insert a new diskette and then waits until I press enter to actually start the format process.

As DOS actually formats the disk it will display a “percent completed” line so I know how much of the process has been done. The number on that line (“21” in Figure 3) will change as the disk is formatted.

Image - Entering A Volume Label

Figure 4 - Entering Volume Label

Once the format is finished DOS waits for me to specify a volume label. That label is nothing more than the disk’s “name.” If you do not want to name your disk you can just leave the label blank. Notice in Figure 5 I requested a volume label of “disk01”. (Part of the format message scrolled off the top of the screen. This is normal in DOS.)

Image - The Format Report

Figure 5 - Format Done

When DOS finishes formatting a disk it displays certain information about the disk for you. You’ll note that in Figure 5 my disk has 1.45 Mbytes (that’s 1,457,664 bytes) of total disk space, but 27,648 Kbytes are in bad sectors and not usable, leaving about 1.43 Mbytes available on the disk. Format also reports that it has divided the disk into 2,793 “allocation units” of 512 bytes each. Finally, the disk has been assigned a serial number of 112F-0FE6.

Of all that information, very little is of much value except the “bytes available” on the disk. This number tells you how much space you have on the disk for storing files.

An “allocation unit” is sometimes called a “cluster.” In this chapter I will not work with this concept, but we will cover it so thoroughly in the chapter about File Systems that you will be sick of it. Have patience…

You may be wondering about the “bad sectors.” Most disks are manufactured to fairly exacting standards, but over time they will wear out and some spots on the disk may no longer be reliable. There is a way to check for bad sectors (using “chkdsk,” covered later) and then mark them in such a way that no program will try to use them. If you only have a few bad sectors that is not a problem - but if you get a lot of bad sectors you may want to consider the possibility of just pitching the disk and getting another (they are plenty cheap). On my disk, the “bad sector” space is only about 2% of the total disk space - I can live with that much loss!

The other item that may interest you is the serial number. DOS generates a random number and uses that as the serial number for the disk. This is not of much value today, but back several years ago programmers could use that serial number. They could insert a known serial number on a disk, and then when the user inserted that disk into the computer, the program would check the serial number of that disk to make sure it wasn’t a pirated copy. Of course, any 5-year old kid could change the disk’s serial number to match whatever the program was looking for - but honest folks like you and me had no idea how to make a disk with a bad serial number work. This meant you could not back up your programs - and that is not an acceptable option to most people. Anyway, that protection scheme never became very popular - but DOS still assigns a serial number to every disk. Whatever.

Image - Using The /V Switch

Figure 6 - The /V Switch

You can change the volume label (the disk’s “name”) while the disk is formatting if you enter this command:

format a: /v:mydisk

The screen in Figure 6 is the result of this command. DOS will first check the disk to verify its format, and then rename the volume to whatever you specified in your command line.

Image - Creating A Boot Disk

Figure 7- Creating a Bootable Disk

If you want to create a bootable DOS disk (“bootable” means it will start your computer), you would enter this command:

format a: /s

This adds the “system” files to your disk and makes it bootable. Figure 7 looks a lot like the other format screens, but you’ll note that the command I’ve used includes the /s option. Then after the disk is formatted you’ll see a line that states, “system transferred.” This means all the DOS system files have been put on the floppy so it can now boot the computer.

You can also create a bootable disk by using the command sys a:. This command will not format the disk in drive a:, but will make the disk bootable and copy all the system files the disk needs to actually start DOS.

To use your bootable disk, leave it in the disk drive then restart your computer. The computer will start DOS from the floppy instead of Windows from the hard drive. This leads to all sorts of interesting security hacks - but that is a tale for another day.

Checking Disks

With DOS, you would check your disk with the command chkdsk a:. (Note: if you wanted to check your C: drive, you could use chkdsk c:).

Image - Checking A Disk

Figure 8 - Using Chkdsk

In  Figure 8 you’ll notice that chkdsk has looked at the disk and returned some statistics. You’ll also see a note at the bottom of the screen about scandisk. This is a Windows program that you will not find in a true DOS system - we’ll look at scandisk when we do the Windows lab.


DOS does not have any backup procedure built-in. In order to back up your hard drive, you would have to manually copy all the files to some backup medium. This is not too practical, but DOS machines are usually only used for simple manufacturing applications and the files on those machines do not often change; so perhaps backing up is not so essential. After a catastrophe, the program could just be loaded from the original disks or tapes.

Windows XP Laboratory

Mounting Disks

With Windows, there is no "mount" command - all you need to do is double-click on a disk’s icon in My Computer and start working. The Windows OS will automatically access the disk drive and make its files available to you. In fact, if Windows detects that you have inserted a disk in the drive (especially CDs), it will offer to "autoplay" the disk so you won't even have to click on My Computer to get it going.

Formatting Disks

To format a disk with Windows:

  1. Insert a floppy disk in the A: drive
  2. Double-click My Computer
  3. Right-click on the A: drive icon
  4. Select “format” from the drop-down menu.

Figure 1 - Windows Format Dialog Box

Once you select “format” on the disk popup menu, the dialog box shown in Figure 1 appears.

The “Capacity” drop-down menu box allows you to format your disk for less than 1.44 Mbytes (though I’m not sure why you would). There are many formats available for your disk, but if you choose anything other than 1.44 Mbyte you may have trouble later using the disk. Of course, if you have an old disk drive that needs a different format than 1.44 Mbyte you can use that format - or just get a new disk drive.

Windows XP permits you to select the disk's file system: FAT or NTFS for a hard drive and FAT for a floppy. FAT is the old, DOS standard file system while NTFS is the newer system used by Windows NT and Windows XP. In general, you get much better security and compression with NTFS than FAT, but some programs that access the disk drive directly may not work with NTFS.

You may have an opportunity to select something other than the default allocation unit size, but the default is usually a good option.

If you want, you may enter a volume label (or "name") for your disk. While this is not generally very helpful, it takes only a moment to specify a name and may come in handy at some point. Remember, a label can be only 11 characters and cannot contain a space.

Under “Format Options” you can select a Quick Format, Enable Compression, and create a MS-DOS Startup Disk. The Quick Format will format the disk, but not check every sector. It takes only a couple of seconds and is generally a good choice. If you do not select a "Quick" format, then Windows will perform aFull Format that will check and format every sector and will take a minute or two on your computer (for a floppy - as long as hours for a hard drive). If you create an NTFS file system, then you will be able to make the disk compressible - but this is only possible for hard drives. If you opt to create a startup disk, Windows will copy enough DOS to the floppy to make it bootable so you can use it in an emergency.

Once you click to start the format process, you'll see a warning screen like in Figure 2 below. Click OK to continue the process.

Figure 2 - Format Warning

As Windows formats the disk you’ll see a progress bar expand across the bottom of the screen, as illustrated in Figure 3 below.

Figure 3 - Format Progress Bar

Checking Disks

Disk Cleanup

As you use your disk it will eventually collect “junk” files that could be safely deleted from your hard drive. While these files are not hurting your drive - they do take up valuable space. To clean these files from your drive:

  1. Double-click My Computer
  2. Right-click on the C: drive icon (or any other hard drive you have installed)
  3. Select “properties” from the drop-down menu

Figure 4 - Starting Disk Cleanup

When the properties for the C: drive are displayed, notice a button for "disk cleanup" near the center of the screen. Click on that button to erase unneeded files from your disk (you’ll have an opportunity to select which files to delete before any are actually removed).

Figure 5 - Calculating Space Saved By Cleanup

When Windows first starts the disk cleanup program it will calculate the amount of disk you can save when the program is finished. Figure 5 shows the progress bar you'll see as Disk Cleanup makes that calculation.

Figure 6 - Disk Cleanup Report Screen

After selecting “Disk Cleanup,” the screen in Figure 6 is displayed. You can see what types of files will be deleted and how much disk space you can save. In Figure 6 you can see that my computer had about 8.5 Mbytes of Temporary Internet Files, 400 Mbytes in the recycle bin, and a few Offline Web Pages.

If you wanted, you could highlight any of these file types and then click on “View Files” to see the actual files Windows will delete.

If you do not want Windows to delete some of these files, you can un-check that type. For example, I could have un-checked the “Recycle Bin” to keep those files in there.

When you are ready, click on the “OK” button to make these files disappear. (Good riddance, I say.)


Windows has a "super-charged" form of the DOS chkdsk available: scandisk. You can start scandisk by right-clicking on a disk icon in My Computer, selecting properties from the popup menu, then selecting the “Tools” tab at the top of the properties dialog box (see Figure 7).

Figure 7 - Disk Tools

To start scandisk, select “Error-Checking” from the tools menu.

Figure 8 - Scandisk Dialog Box

On the screen displayed in Figure 8 you can select the scandisk options you wish.

You’ll see that I’ve checked the “Automatically fix file system errors” box. If you do not check this box then scandisk will constantly stop to ask, “Do you want me to fix this?” I usually like to have the computer automatically fix errors then I can just relax and let it work. A scan of my C: drive only takes a minute or two, though, so I don’t get too comfortable.

The other option ("Scan for and attempt recovery of bad sectors") is a thorough check of all sectors on the hard drive. This scan could take a long time (hours), so don't start it unless you think your hard drive is in really bad shape.

Figure 9 - Scandisk In Progress

As Scandisk works, it displays the message box illustrated in Figure 9. Since I requested that it automatically fix errors, there is not much to see during its execution (or afterward).

Figure 10 - Scandisk To Be Scheduled

You may see this message if you attempt to scan the main hard drive (the "C:" drive). This message means that Scandisk could not do its job since some files are in use by the system. However, it's easy to schedule scandisk to run the next time the computer is booted by clicking on the "Yes" button.


One last bit of disk maintenance you should routinely perform is to defragment your disk. To start defragmentation, click on “Defragment Now” at the center of the disk tools dialog box (see Figure 7). When you first start Defragementation, you will see a screen similar to Figure 11, below.

Figure 11 - Defragment Progress Report

Choose the drive you want to defragment at the top of the screen and click on the "Analyze" button. You will get a brief report like this:

Figure 12 - Defragment Initial Report

If Windows recommends defragmenting the drive, you can look at the report to see how badly the drive is fragmented. Figure 13 shows the report generated for this document.

Figure 13 - Defragment Detailed Report

Once your disk has finished defragmenting, you’ll see the result as illustrated in Figure 14. Notice that the drive started with a number of file fragments (top row of colors) and ended with a large non-fragmented section (bottom row of colors). While this particular disk was not as dramatic as others you will encounter, at least you can see that defragmentation had some effect.

Figure 14 - Defragment Completed

You may wonder why you need to defragment your disk.

Files on your disk drive must be "chopped up" so they will fit into the "allocation units" available. Remember when you formatted the floppy? DOS reported that each allocation unit had 512 bytes. This means if you wanted to store a file that was 500 bytes big it would fit in one unit - but a file that is 600 bytes big must use two units. Storing files is about like storing the Christmas “stuff” I own. It wouldn’t all fit into one box, so I split it up and put it into several boxes and have those scattered all over town.

The operating system handles all the details of splitting a file into the various allocation units, but you need to know that it’s happening.

Table 1 graphically shows how a disk gets fragmented. Over time, you will have created and deleted a lot of files on your computer. As you delete files some allocation units will be emptied and new files can be put in those spots. However, suppose you have two allocation units empty in one place, but the next empty units weren’t available for some distance. If you had a large file to store, Windows would fill the two available units, then put the rest of the file in another empty spot on the disk.

Disk One Disk Two
1.1 By a small sample 1.1 An angry father is most
1.2 we may judge of 2.1 Any fine morning a
1.3 the whole piece. 2.2 power saw can fell a
2.1 Every evil to which 3.1 The foremost power
2.2 we do not succumb 1.2 cruel toward himself.
2.3 is a benefactor. 3.2 among kings is to
3.1 It is vanity to desire 2.3 tree that took a thousand
3.2 a long life and to take  
3.3 no heed of a good 2.4 years to grow.
3.4 life. 3.3 endure hatred!

Table 1- Disk Fragmentation

Table 1 shows two disks with 10 allocation units each. In disk one, you can see that three files have been saved. File one is divided into 3 allocation units (numbered 1.1, 1.2, and 1.3). That file, when re-assembled, says, “by a small sample we may judge of the whole piece.” You should be able to read the second and third file on that disk with little trouble.

Disk two, though, has been fragmented due to several months of normal use. You’ll note that file 1 is no longer in continuous allocation units, but has been scattered across the disk. You can follow the trail of file 1 (1.1 and 1.2) to read, “An angry father is most cruel toward himself.” Files two and three are also interwoven on the disk. You can also see that there is one empty allocation unit that will be filled as soon as the user tries to save a new file.

The defragmentation program will move all your files around and put them into consecutive allocation units. This tends to speed up disk access since the disk drive doesn’t have to look around for pieces of any given file.

Generally, I would recommend you defragment your hard drive about once every month. But be prepared; it will take an hour or two to finish that job - especially if your disk is badly fragmented.


Windows XP has a backup program built in. Unfortunately, most home computers (and a large number of office computers) do not have any sort of backup medium available (do you have a tape drive on your home computer?) - therefore, the Windows backup program is of limited value. If you do have a backup medium available, you may be able to use Windows backup to keep a copy of your files away from disaster.

To backup the files on your hard drive, click the "Backup" button and follow the Wizard.

Figure 15 - Backup Wizard Startup Screen

Figure 15 shows the first of several screens on the Backup Wizard.

Figure 16 - Backup or Restore Selection

Select whether you want to backup your files or restore from a backup you made earlier.

Figure 17 - Chosing What To Backup

You can backup only your own files or everyone's.

Figure 18 - Chosing A Backup Location

You must choose a destination for your backup. In general, Windows expects traditional backup media (like tapes) so your choices on this screen will be limited.

Figure 19 - Backup Choices

This screen summarizes your backup options and offers to start the process.

Figure 20 - Advanced Option: The Type of Backup

One of the "Advanced" options is to chose the type of backup. These are covered in the "Theory" part of this lesson.

Figure 21 - Specifying Other Backup Options

You can choose to verify your backups after they are copied. While this is very safe, it's also time consuming.

Figure 22 - Choosing to Append or Create a New Backup

You can choose to have your backups appended to existing files or delete those files and start "from scratch."

Figure 23 - Specifying the Backup Time

Finally, choose the time for your backup.

Other Properties

In addition to those device properties illustrated above, Windows XP provides two other tabs in the properties window.

Hardware displays certain information about the various disk drives, their properties, and the drivers used. Additionally, there is quick access to the device troubleshooting wizard in case you need that.

Figure 24 - Hardware Properties

If you are the system administrator for your computer, you may also be able to specify quotas for your various users. This way, no user can take up too much disk space and slow down your computer.

Figure 25 - Specifying Disk Quotas

Linux Laboratory

Mounting Disks

With Linux, a disk must be “mounted” before you can use it. This is a holdover from earlier computer days and at first seems awkward, but there is a wonderful benefit to manually mounting a disk - the user can specify the disk’s type. For example, it’s possible to mount (and use) a Linux-formatted disk (of course); but it’s also possible to mount all of these types of disks:

You’ll never be able to read a Linux-formatted disk with Windows - but you can use your Windows disk with a Linux OS. You can also use a Windows NT disk, DOS disk, OS/2, Novell, or SUN disks - try doing that with Windows!

Once a new disk is mounted, you access it just like you would access any file on the hard drive. This is a bit different from the way Windows works and may seem a bit odd, but it makes wonderful sense. If you mount a floppy disk it becomes part of your computer’s file system. You don’t need to change to the “A:” drive (in fact, there is no “A:” drive in Linux) - the files on the floppy are listed just like they were part of your hard drive’s files.

With Linux, you can have a floppy mounted, a CD ROM, and some file system from across a network - they would all be integrated into your own computer’s file system. Since you don’t have to think about what type of format the disk is using it makes disks much easier to use with Linux than any other operating system.

To find out how many drives (or "partitions" - which I discuss below) are mounted to your Linux system, enter the command mount by itself. Linux will return a list of all the mounted file systems. When I checked my computer, I got this list:

[selfg@localhost selfg]$ mount
/dev/hda5 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
/dev/hda7 on /home/winshare type vfat (rw) [selfg@localhost selfg]$

Figure 1 - File Systems Mounted on my computer

In Figure 1 you’ll note that my computer has several file systems mounted. For example, you’ll see /dev/hda7 is mounted on /home/winshare as an older Windows file system (vfat - like what was used for DOS) (look at the last line). You can access that partition for both read and write access (rw) just like it was part of the file system on your own hard drive. To work with files in that partition, I would change to that directory (using the cd command) and copy, move, delete, or do whatever to the files. I use that directory as an intermediary between Linux and Windows on my computer. I can save documents to the "Winshare" folder in Windows and then access those same files with Linux.

Perhaps I should mention what it means to mount a disk “on /home/winshare.” When you mount a disk (or any external file system - like one on a network), you must specify what directory have the contents of the disk. In the previous paragraph, I could access “hda7” (which is the winshare partition) by first going to the “/home” directory then looking for a directory named “winshare.”

Formatting Disks

On a Linux system, disks are not "formatted" like they are with Windows. To make a disk ready to store files, you need to create a file system on the disk. There are a couple of different commands you can use for that task, but one of the easiest to use is mke2fs (that stands for Make Ext2 File System).

Since the mke2fs program is usually only used by a system administrator, it is not in a directory you would normally use. Therefore, in order to execute the program you must instruct Linux where to find the program. You'll note in Figure 2 that I typed in the mke2fs command - but also had to specify where Linux could find that command:

[selfg@localhost selfg]$ /sbin/mke2fs /dev/fd0
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
184 inodes, 1440 blocks
72 blocks (5.00%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
184 inodes per group
Writing inode tables: 0/1 done                            
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override. [selfg@localhost selfg]$

Figure 2 - Making A File System (Formatting)

The command line entered in Figure 2 will execute the mke2fs program to create a Linux file system on a disk (that is like a Windows format command). You may have noticed that the command ended with /dev/fd0. That instructs Linux which disk should get the new file system (/dev/fd0 is the address for the floppy disk).

As the file system is prepared, you will notice several lines on the screen indicating the progress of the command. As long as there are no errors in that group of lines you can assume the file system was properly created.

Checking Disks

With Linux, you can do several checks on your disk.

First, using the command df you can check to see what partitions have been mounted on the system. Figure 3 shows the result of the df command when I ran it on my computer.

[selfg@localhost selfg]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda5 12092000 4662928 6814824 41% /
/dev/hda7 12899832 1808992 11090840 15% /home/winshare
[selfg@localhost selfg]$

Figure 3 - Using The df Command

This command shows that there are only two file systems mounted on my computer. The first one, for example, is /dev/hda5 (my "main" hard drive). I've used about 4.7 Gbytes of space and have about 6.8 Gbytes still available (that's about about 41% used). This file system is mounted as the root directory (that is what the "/" means at the end of the line).

This information is not of much value to you, but if you were the system administrator you would have to know what file systems, disks, or partitions were mounted. This way, you could monitor how much disk space was being used by the various users on the system.

The other command you may find helpful in Linux is du. This command will show you the disk usage for your hard drive. You’ll note in Figure 4 that the CIS140 directory on my hard disk is divided into numerous sub-directories. For each directory, you can see how much disk space it is using in Kbytes (for example, “./cis140/physics” is using 16 Kbytes of space).

[selfg@localhost cis140]$ du
4 ./physics/gravity
4 ./physics/mechanics
4 ./physics/optics
16 ./physics
4 ./chemistry/acid-base
4 ./chemistry/organic
4 ./chemistry/periodic-table
4 ./chemistry/radio
4 ./chemistry/structure
24 ./chemistry
20 ./biology/botany
16 ./biology/human/genetics
24 ./biology/human/psychology
40 ./biology/human/systems
84 ./biology/human
16 ./biology/zoology
124 ./biology
176 .
[selfg@localhost cis140]$

Figure 4 - The du Command

So, does Linux have a command similar to the DOS command chkdsk? Yes - fsck (for “file system check”). However, fsck is reserved for the system administrator and you will likely not have access to it. You should know, though, that the system administrator could run fsck daily (at some odd hour, like 1am) to clean up the disk. Linux also automatically runs fsck anytime the computer is re-started.

Frankly, the way Linux manages files is so different from Windows that you won’t ever see problems with disks that you see in Windows (Linux is called more "stable" than Windows). Some system administrators have reported that they’ve run a Linux system continuously for years (literally: years) with no problems. A program like fsck is not as essential to Linux as scandisk is to Windows. We’ll discuss at least one reason why Linux is more stable than DOS when we discuss file systems.


This may sound like a bailout, but backing up under Linux is a system administrator’s job. Typically, the system administrator will set up an automatic schedule of some sort and let Linux do its own backup during the night. The system administrator will only have to change the tapes every day. If you are every put in charge of a Linux system you will have to learn what type of backup device is attached to the computer (tape or disk) and what specific programs are used to control that device. Whatever you do, just make sure backups are done routinely. We won’t cover a specific Linux backup procedure in this class (collective sigh of relief).