[go: up one dir, main page]

0% found this document useful (0 votes)
66 views69 pages

Hard Drives

Hard drives are the primary storage system for computers, storing the operating system and files. They use magnetic disks called platters to physically store data in sectors as binary 1s and 0s. Parallel ATA (IDE) was the standard interface connecting hard drives internally, but it has been replaced by Serial ATA (SATA) in newer systems. Formatting prepares a hard drive for use by marking sectors and can erase existing data, so backups are needed before formatting.

Uploaded by

prerana shete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views69 pages

Hard Drives

Hard drives are the primary storage system for computers, storing the operating system and files. They use magnetic disks called platters to physically store data in sectors as binary 1s and 0s. Parallel ATA (IDE) was the standard interface connecting hard drives internally, but it has been replaced by Serial ATA (SATA) in newer systems. Formatting prepares a hard drive for use by marking sectors and can erase existing data, so backups are needed before formatting.

Uploaded by

prerana shete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

5.

Hard Drives

5.1 Hard Drive Technology

❏ Every computer must have a hard disk drive (commonly called a hard drive,
hard disk, or abbreviated HDD).
❏ Your operating system is stored on the hard drive. Of course any other file can be
saved there too.
❏ It is the main location where people save data. Having adequate hard disk
storage for your needs is important.

What’s a HDD?
❏ A Hard Disk Drive (HDD for short) is a type of storage commonly used as the
primary storage system for both laptop and desktop computers.
❏ It functions like any other type of digital storage device by writing bits of data and
then recalling them later.
❏ It stands to mention that an HDD is what’s referred to as “non-volatile”, which
simply means that it can save data without a source of power.
❏ This feature, coupled with their large storage capacity and their relatively low cost
are the reasons why HDDs are used so frequently in home computers.
❏ While HDDs have come a long way from when they were first invented, the basic
way that they operate has stayed the same.

How does a HDD physically store info?


Inside the casing there are a series of disk-like objects referred to as “platters”.
❏ The CPU and motherboard use software to tell the “Read/Write Head” where
to move on the platter and where it then provides an electrical charge to a
“sector” on the platter.
❏ Each sector is an isolated part of the disk containing thousands of subdivisions
all capable of accepting a magnetic charge.
❏ Newer HDDs have a sector size of 4096 bytes or 32768 bits; Each bit’s magnetic
charge translates to a binary 1 or 0 of data.
❏ Repeat this stage and eventually you have a string of bits which when read back
can give the CPU instructions, whether it be updating your operating system, or
opening your saved document in Microsoft Word.
❏ As HDDs have been developed, one key factor that has changed is the
orientation of the sectors on the platter.
❏ Hard Drives were first designed for “Longitudinal Recording” – meaning the
longer side of the platter is oriented horizontally – and since then have utilized a
different method called “Perpendicular Recording” where the sectors are stacked
on end.
❏ This change was made as hard drive manufacturers were hitting a limit on how
small they could make each sector due to the “Superparamagnetic Effect.”
❏ Essentially, the superparamagnetic effect means that hard drive sectors smaller
than a certain size will flip magnetic charge randomly based on temperature.
❏ This phenomenon would result in inaccurate data storage, especially given the
heat that an operating hard drive emits.
❏ One downside to Perpendicular Recording is increased sensitivity to magnetic
fields and read error, creating a necessity for more accurate Read/Write arms.
Capacity:
Capacity is the maximum amount of data a drive or disk (for example, a DVD disk) can
store. Typical hard disk storage capacities today are either in gigabytes or terabytes.
These sizes store enormous amounts of data. This is very useful when saving music
and video, especially video files, which can get very large.

RPM:
RPM (Revolutions Per Minute) - Within a hard disk case are round platters (the actual
disks) that are attached to a spindle that spins. The disks are written to or read from
while spinning. One revolution is how many times the platters make a complete rotation.
Disks in a HDD literally rotate thousands of times per minute. The greater the RPM, the
faster data is read or written. 7200 RPM is typically what you will see in home computer
hard drives.

Form Factor:
The form factor of a hard drive is the actual physical size of the case the platters are in.
The main sizes are 3.5in and 2.5in.

Cache Memory:
A small amount of memory, usually 8, 16, or 32MB, is set aside for the most frequently
accessed files. When one of these files is selected, it is retrieved from the cache. This
reduces access time since the system does not have to search the drive for the data.

5.2 IDE Technology

Parallel ATA (PATA), originally AT Attachment, also known as ATA or IDE is the
standard interface for IBM computers.
It was first developed by Western Digital and Compaq in 1986 for compatible hard
drives and CD or DVD drives.
The connection is used for storage devices such as hard disk drives, floppy disk
drives, and optical disc drives in computers.

The standard is maintained by the X3/INCITS committee.


It uses the underlying AT Attachment (ATA) and AT Attachment Packet Interface
(ATAPI) standards.
The Parallel ATA standard is the result of a long history of incremental technical
development, which began with the original AT Attachment interface, developed for use
in early PC AT equipment.
The ATA interface itself evolved in several stages from Western Digital's original
Integrated Drive Electronics (IDE) interface.
As a result, many near-synonyms for ATA/ATAPI and its previous incarnations are still in
common informal use, in particular Extended IDE (EIDE) and Ultra ATA (UATA).
After the introduction of Serial ATA (SATA) in 2003, the original ATA was renamed to
Parallel ATA, or PATA for short.
Parallel ATA cables have a maximum allowable length of 18 in (457 mm).
Because of this limit, the technology normally appears as an internal computer storage
interface.
For many years, ATA provided the most common and the least expensive interface for
this application.
It has largely been replaced by SATA in newer systems.

Two ATA motherboard sockets on the left, with an ATA connector on the right.

History
The first version of what is now called the ATA/ATAPI interface was developed by
Western Digital under the name Integrated Drive Electronics (IDE).
Together with Control Data Corporation (the hard drive manufacturer) and Compaq
Computer (the initial customer), they developed the connector, the signaling protocols
and so on, with the goal of remaining software compatible with the existing ST-506 hard
drive interface.
The first such drives appeared internally in Compaq PCs in 1986.and were first
separately offered by Conner Peripherals as the CP342 in June 1987.
The term Integrated Drive Electronics refers not just to the connector and interface
definition, but also to the fact that the drive controller is integrated into the drive,
as opposed to a separate controller on or connected to the motherboard.
The interface cards used to connect a parallel ATA drive to, for example, a PCI slot are
not drive controllers: they are merely bridges between the host bus and the ATA
interface.
All of these low-level details of the mechanical operation of the drive were now
handled by the controller on the drive itself.
This also eliminated the need to design a single controller that could handle many
different types of drives, since the controller could be unique for the drive.
The host need only to ask for a particular sector, or block, to be read or written, and
either accept the data from the drive or send the data to it.
The interface used by these drives was standardized in 1994 as ANSI standard
X3.221-1994, AT Attachment Interface for Disk Drives. After later versions of the
standard were developed, this became known as "ATA-1".

Parallel ATA interface


Parallel ATA cables transfer data 16 bits at a time.
The traditional cable uses 40-pin female connectors attached to a 40- or 80-conductor
ribbon cable.
Each cable has two or three connectors, one of which plugs into a host adapter
interfacing with the rest of the computer system.
The remaining connector(s) plug into storage devices, most commonly hard disk drives
or optical drives.
Each connector has 39 physical pins arranged into two rows, with a gap or key at pin
20.
5.3 Formatting Hard Drive

Disk formatting is a process to configure the data-storage devices such as


hard-drive, floppy disk and flash drive when we are going to use them for the very first
time or we can say initial usage.
Disk formatting is usually required when new operating system is going to be used
by the user.
It is also done when there is space issue and we require additional space for the
storage of more data in the drives.
When we format the disk then the existing files within the disk are also erased.
We can perform disk formatting on both magnetic platter hard-drives and
solid-state drives.
Disk formatting repair the bad sectors within the drive.
Disk formatting has also the capability to erase the bad applications and various
sophisticated viruses.
As we know that disk formatting deletes data and removes all the programs installed
with in the drive. So it can be done with caution.
We must have the backup of all the data and applications which we require.
No-doubt disk formatting requires time.
But the frequent formatting of the disk decreases the life of the hard-drive.
1. Low-level Formatting :
❏ Low level formatting is a type of physical formatting.
❏ It is the process of marking cylinders and tracks of the blank
hard-disk. After this there is the division of tracks into sectors with the
sector markers. Now-a-days low-level formatting is performed by the
hard-disk manufacturers themselves.
❏ We have data in our hard-disks and when we perform low-level formatting
in the presence of data in the hard-disk all the data has been erased and
it is impossible to recover that data.
❏ Some users make such a format that they can avoid their privacy
leakage. Otherwise low-level will cause damage to hard-disks that
shorten the service-life.
❏ Therefore, this formatting is not suggested to users.

2. Partitioning :
Partitioning means divisions.
Partitioning is the process of dividing the hard-disk into one or more regions.
The regions are called partitions.
It can be performed by the users and it will affect the disk performance.
3. High-level Formatting :
❏ High-level formatting is the process of writing.
❏ Writing on a file system, cluster size, partition label, and so on for a
newly created partition or volume.
❏ It is done to erase the hard-disk and again installing the operating
system on the disk-drive.
Figure – Steps of High-level Formatting
Firstly High-level formatting clears the data on hard-disk, then it will
generate boot information, then it will initialize FAT. After this it will go to
label logical bad sectors when partition has existed.
Formatting done by the user is the high-level formatting.
Generally, It does not harm the hard-disk.It can be done easily with the
Administrator, Windows snap-in Disk Management tool, diskpart, etc.
We can use such a format to fix some problems like errors in the file system,
corrupted hard-drive and develop bad sectors.
Example :-
How to Format a Disk or Drive in Windows 10
Format is the process of preparing a data storage device such as a hard disk
drive, solid-state drive, or USB flash drive for initial use to accept Windows files.

You can select to use a FAT, FAT32, exFAT, NTFS, or ReFS file system when
formatting.

You can also select to do a quick or full format.

● Full format - Files are erased (not overwritten) from the volume
that you are formatting and the drive is scanned for bad sectors.
The scan for bad sectors is the reason why the Full format takes
twice as long as the Quick format.
● Quick format - Files are erased (not overwritten) from the volume
that you are formatting, but does not scan the disk for bad sectors.
Only use this option if your hard disk has been previously formatted
and you are sure that your hard disk is not damaged.

This tutorial will show you different ways on how to format a disk or drive in
Windows 10.

When you format a disk or drive, it will erase all data on the disk or drive.

Contents

● Option One: Format Disk or Drive in This PC


● Option Two: Format Disk or Drive in Disk Management
● Option Three: Format Disk or Drive in Command Prompt
OPTION ONE
Format Disk or Drive in This PC

1 Open This PC in File Explorer (Win+E), and do either step 2 or step 3


below.

2 Right click or press and hold on the drive (ex: "D") you want to format,
click/tap on Format, and go to step 4 below. (see screenshot below)

3 Select the drive (ex: "D") you want to format, click/tap on the "Drive
Tools" Manage tab, click/tap on the Format button in the ribbon, and go
to step 4 below. (see screenshot below)
4 Select the supported File system (FAT, FAT32, exFAT, NTFS, or
ReFS) you want to use for this drive. (see screenshot below)
5 Select the supported Allocation unit size (aka: "cluster size") you want
to use for this drive. Usually it is best to use the default allocation size.
(see screenshot below)

6 Type a Volume label you want for the drive. (see screenshot below)
7 Check or uncheck the Quick Format box depending on if you want to do
a Quick or Full format of this drive. (see screenshot below)
8 Click/tap on Start, when ready to format this drive. (see screenshot
below)

9 Click/tap on OK to confirm. (see screenshot below)

10 When format is complete, click/tap on OK. You can now also close the
Format dialog. (see screenshot below)
OPTION TWO
Format Disk or Drive in Disk Management

You must be signed in as an administrator to use this option.

1 Right click on the Start button to open the Win+X menu, and click/tap
on Disk Management (diskmgmt.msc).

2 Right click or press and hold on the disk or partition/volume (ex: "D")
you want to format, and click/tap on Format. (see screenshot below)
3 Type a Volume label you want for the drive. (see screenshot below)

4 Select the supported File system (FAT, FAT32, exFAT, NTFS, or


ReFS) you want to use for this drive. (see screenshot below)
5 Select the supported Allocation unit size (aka: "cluster size") you want
to use for this drive. Usually it is best to use the default allocation size.
(see screenshot below)

6 Check or uncheck the Perform a quick format box depending on if you


want to do a Quick or Full format of this drive. (see screenshot below)
7 Check or uncheck (default) the Enable file and folder compression
box for what you want on this drive. (see screenshot below)

8 Click/tap on OK, when ready to format this disk or partition/volume.


(see screenshot below)
9 Click/tap on OK to confirm. (see screenshot below)

10 When formatting is complete, you can Disk Management if you like.


(see screenshot below)
OPTION THREE
Format Disk or Drive in Command Prompt

You must be signed in as an administrator to use this option.

1 Open an elevated command prompt or command prompt at boot.

2 Type the commands below one at a time into the command prompt, and
press Enter after each command. Make note of the volume number (ex:
"4") of the drive letter (ex: "D") you want to format. (see screenshot
below)

diskpart

AND

list volume
3 Type the command below into the command prompt, and press Enter. (see
screenshot above)

select volume <number>

Substitute <number> in the command above with the actual volume


number (ex: "4") you want to format from step 2 above.

For example: select volume 4

4 Type the command below you want to use into the elevated PowerShell,
and press Enter. (see screenshot below)

(Quick format)
format fs=<FileSystemType> label="<FriendlyNamel>" quick

OR
(Full format)
format fs=<FileSystemType> label="<FriendlyName>"

Substitute <FileSystemType> in the command above with the


supported FAT, FAT32, exFAT, NTFS, or ReFS) file system you
want to use for this drive.

Substitute <FriendlyName> in the command above with the actual


volume label (ex: "Local Disk") you want for this drive.

For example: format fs=ntfs label="Local Disk" quick


5 If you would like to assign a specific drive letter you want to this drive,
type the command below into the elevated command prompt, and press
Enter.

Windows will automatically assign an available drive letter by default to a


drive when it gets formatted.

assign letter=<new drive letter>

Substitute <new drive letter> in the command above with the


actual new drive letter (ex: "G") you want to assign to the drive.

For example: assign letter=G

If the new drive letter you assign is not available, you will get an
error message indicating so in the command prompt. You will just
need to repeat this step to assign an available drive letter.

6 When finished, you can close the elevated command prompt.


5.4 IDE Drives (Enhanced IDE)

Enhanced integrated drive electronics (EIDE) is the hard drive interface


that succeeded integrated device electronics (IDE), also known as ATA or
ATA-1.
The interface acts as an intermediary between the computer and a
mass storage device.
EIDE provides much faster transfer rates than IDE.
The term was coined by Western Digital in 1994 to refer to a set of
extensions for the ATA-1 attachment standard.
EIDE is sometimes called fast ATA or fast IDE or ATA-2.
EIDE has since been replaced by other standards that offer faster transfer
rates.

EIDE also provides faster access to the hard drive, support for Direct
Memory Access (DMA), and support for additional drives, including
CD-ROM and tape devices through the AT Attachment Packet Interface.

When updating your computer with a larger hard drive (or other drives), an
EIDE "controller" can be added to your computer in one of its card slot.

To access larger than 528 Mbyte drives, EIDE (or the basic input/output
system that comes with it) uses a 28-bit Logical Block Address (LBA) to
specify the actual cylinder, head, and sector location of data on the disk.

The 28 bits of the LBA provide enough information to specify unique sectors
for a device up to 8.4 GB in size.
5.5 SCSI Technology

❏ The basic interface for connecting peripheral devices to a PC is a small


computer system interface.
❏ It can typically respond to up to 16 external devices using a
single route, along with a host adapter.
❏ It is used to boost performance, deliver fast data transfer delivery
and provide wider expansion for machines like CD-ROM drivers,
scanners, DVD drives and CD writers.
❏ It is most commonly used for RAID, servers, highly efficient desktop
computers, and storage area networks.
❏ It has control, which is responsible for transmitting data across the
Small Computer System Interface bus and the computers.
❏ It can be fixed on a motherboard, or one client adapter is installed
through an extension on the computer's motherboard.
❏ The controller also incorporates a simple SCSI input/output
system, which is a small chip that provides access and control
equipment with the necessary software. The SCSI ID is its number.
Highly Compatible
SCSI is highly compatible. All Macintosh® computers come with a SCSI port, and you
can order many PCs with a SCSI port. If your computer has a SCSI port, you can get
another device with the same type of SCSI, plug it in, and the new device should work.
SCSI also makes it easy to expand. If you want to add an additional hard drive to your
computer, just connect via the SCSI port. If you want to add another CD-ROM tower or
a printer, just daisychain the additional devices up to seven or more.

5.6 Comparing SCSI and EIDE

Topic ATA/EIDE SCSI

Cost Overall, IDE is a much Compared with IDE, SCSI is

cheaper solution. often more expensive to

implement and support.

Expans IDE/EIDE allows two SCSI is capable of supporting

ion devices per channel. up to 7 or 15 devices.

Most computers have

2 channels.
Ease EIDE is commonly an Configuring SCSI can be more

easier product to set difficult for most users

up than SCSI. compared to IDE.

Faster Today, the latest EIDE All the fastest drives are often

and SCSI drives available for SCSI first and in

running at the same many cases 10,000+ RPM

RPM are very close. hard drives are only available

However, 10,000+ as SCSI drives.

RPM drives are often

only available for

SCSI.

Resour All motherboards Unlike IDE, SCSI requires an

ces today have an interface expansion card in

ATA/EIDE interface most cases (unless the

and unless additional motherboard already has it).

drives are needed no Adding any new hardware

additional resources means more system resources

need to be taken. are going to be required.


Connection

EIDE interfaces also provide network cards, and much more


connections for optical disc drives and tape drives.

SCSI Supported devices include hard disks, optical disc drives, tape
drives, printers, scanners.

5.7 Hard Drive Partitions

❏ Partitioning a drive is when you divide the total storage of a drive into different
pieces. These pieces are called partitions.
❏ Once a partition is created, it can then be formatted so that it can be used on a
computer.
❏ When partitions are made, you specify the total amount of storage that you would
like to allocate to that partition from the total size of the drive.
❏ For example, if you have an 80 GB drive, then it would be possible to make one
partition consisting of the entire 80 GB of available storage.
❏ Alternatively,you could make two partitions consisting of a 20 GB partition that
will be used for the operating system and programs and a 60 GB partition set
aside for data, music, and images.

❏ To store data and applications on a hard disk, users should partition it at first.

When we create a partition, the physical parameters of the hard disk have been

set, and the hard disk master boot record (generally referred to the mbr) and the

storage location of the boot record backup have been determined.


Disk partitioning means that users use the partition editor to divide a hard disk into

several logical parts.

❏ After that, they can store different directories and files into different partitions.
❏ The more partitions, the more different storage places.
❏ Thus, users can store files into different partitions. But, users may encounter
some unexpected troubles and difficulties if they divide their hard disk into many
partitions.
❏ Space management, access permissions and directory searching ways depend
on the file system saved on the partition.
❏ Therefore, when users change something (like converting FAT16 to FAT32 files
system), they have to carefully consider the size of the partition.
❏ Disk partitions can be seen as a simple technique for logical volume
management predecessor.
❏ However, no matter how many partitions users divide the disk into and no matter
which type of disk is used (either SCSI hard drives or IDE hard disk), they should
set the primary partition as the active partition. Thus, they can boot the system
from this hard disk.
Reason for Partitioning Hard Disk
In general, each notebook users bought only contains a drive C.

1. When the system needs to be restored, the entire drive C (it is the system
disk) will be formatted. Thus, all information saved in the system disk will be
lost.
2. Saving massive information on system partition will slow down the
computer.
3. Different types of data should be saved in different partitions.
4. After disk partitioning, the size of the cluster will be smaller. Cluster is the
smallest storage unit, and the operating system determines that a cluster can
only store the contents of a file. Therefore, space occupied by a file can only
be an integer multiple of the cluster. If the file size is smaller than cluster size,
it still takes up a cluster. So well, using small clusters can help promote disk
space use ratio.

Extended Partition and Logical Partition


DOS and FAT file system originally were designed to support 24 partitions on a hard

drive at most, using 24 drive letters from C to Z.

But the master boot record can contain up to 4 partitions records. To solve this

problem effectively, FDISK command of DOS partition allows users to create an

Extended Partition where 23 logical partitions can be created.

Each of these logical partitions is assigned with a drive letter alone, and can be used

by the computer as a separate physical device.

Information about the Logical Partition is stored in the extended partition, while the

primary partition and extended partition information is store in the MBR of hard disk.
This means no matter how many partitions the disk contains, the master boot record

includes information of 4 primary partitions or 3 primary partitions and 1 extended

partition.

Types
After the hard disk is partitioned, there will be three kinds of partitions, namely

primary partition, extended and logical.


Primary Partition

Primary partition is a relatively simple partition which is usually located in the top of

hard disk area to constitute the logical C disk.

It provides a master boot program to check the correctness of the hard disk partition

and determine the active partition.


Besides, this master boot program will help to pass the boot right to the DOS or other

operating systems saved in the active partition.

The system cannot boot from the hard disk if this program is damaged, but the disk

can be read and written after we boot the computer from floppy or CD-ROM.

Extended Partition

The concept of extended partition is a little more complicated. Actually, an extended

partition can be divided into multiple logical partitions. Thus, users are allowed to

create multiple partitions. Here is an example of where the disk contains one primary

partition and one extended partition made up of three logical drives:

For DOS systems (DOS, Windows 9x), only the primary partition is bootable and is,
therefore, the only one on which the operating system can be started.
5.8 Logical Drives
A logical drive is a drive space that is logically created on top of a
physical hard disk drive.

A logical drive is a separate partition with its own parameters and


functions, and it operates independently.
A logical drive can also be called a logical drive partition or logical disk
partition.

The logical drive is part of a physical disk drive.

It is primarily used to organize the storage capacity of a physical disk drive


into smaller and logical drive units.
A physical disk drive can have one or more drives depending on the
capacity of the base physical HDD and the operating system support.
The data stored in a logical drive is directly stored on the physical drive but
is logically separated from other logical drives.
When more than four logical disks are required on a single physical disk, the first
partition should be a primary partition. The second partition can be created as an
extended partition, which can contain all the remaining unpartitioned space on the
disk.
A primary partition is one that can be used as the system partition. If the disk does not
contain a system partition, you can configure the entire disk as a single, extended
partition.

Within the extended partition, you can create any number of logical drives.

When you have an extended partition on the hard disk, the entry for that partition in the
Partition Table (at the end of the Master Boot Record) points to the first disk sector in
the extended partition.

The first sector of each logical drive in an extended partition also has a Partition Table,

These are the entries in an extended Partition Table:

● The first entry is for the current logical drive.


● The second entry contains information about the next logical drive in the
extended partition.
● Entries three and four are all zeroes.

This format repeats for every logical drive.

The last logical drive has only its own partition entry listed.

The entries for partitions 2-4 are all zeroes.

The Partition Table entry is the only information on the first side of the first cylinder of
each logical drive in the extended partition.

The entry for partition 1 in each Partition Table contains the starting address for data
on the current logical drive. And the entry for partition 2 is the address of the sector
that contains the Partition Table for the next logical drive.

The Total Sectors field is the total size of the logical drive defined in the Partition 2
entry.
5.9 FAT and Root Directory

FAT File Systems. FAT32, FAT16, FAT12

❏ The File Allocation Table (FAT) file system is a simple file system originally

designed for small disks and simple folder structures.

❏ The file allocation table resides at the beginning of the volume. To protect the

volume, two copies of the table are kept, in case one becomes damaged.

❏ The file allocation tables and the root folder must be stored in a fixed location

so that the files needed to start the system can be correctly located.

❏ A volume formatted with the FAT file system is allocated in clusters. The default

cluster size is determined by the size of the volume. For the FAT file system, the

cluster number must fit in 16 bits and must be a power of two.

❏ Simple - and common - file system

❏ Found on all Windows OS and many devices

❏ FAT12: Developed 1977 (MS Disk BASIC)

❏ FAT16: Developed 1987 (MS-DOS 3.31)

❏ FAT32: Developed 1996 (Win95 OSR2)

❏ Few data structures supported:

❏ Cluster: Basic storage unit for files

❏ Directory: Lists file name, starting cluster, and length

❏ File Allocation Table: Contains cluster status and pointer to next cluster in

chain
Boot Sector, FAT, Root Directory, and Files

● ​

File tyui.jpg:

○ occupies clusters 2, 3, and 4.

○ The file size is 1,400 bytes, it occupies 1,536 bytes (3 clusters)

on the disk, and cluster 4 includes 136 bytes of slack space.

● File mes.doc:

○ occupies clusters 5 and 6.

○ The file size is 980 bytes, it occupies 1,024 bytes (2 clusters),

and has 44 bytes of slack space in cluster 6.

● Clusters 7, 8, and 9 are unallocated.


Structure of a FAT Volume


The figure below illustrates how the FAT file system organizes a volume.

FAT Boot Sector


● First sector of a FAT system is the boot sector
○ Contains most of the information with which to determine
■ the file system type, and
■ size and location of data structures
● Boot sector format is different for FAT12/16 and FAT32

The table describes the fields in the Partition Boot Sector for a volume formatted with
the FAT file system.

Fields in Partition Boot Sector (FAT File System)

Byte Offset (in hex) Field Length Sample Value Meaning

00 3 bytes EB 3C 90 Jump instruction

03 8 bytes MSDOS5.0 OEM Name in text

0B 25 bytes BIOS Parameter Block

24 26 bytes Extended BIOS Parameter


Block

3E 448 bytes Bootstrap code

1FE 2 bytes 0x55AA End of sector marker

The Table describes BIOS Parameter Block and Extended BIOS Parameter Block
Fields.

File Allocation System


The FAT file allocation system is named for its method of organization, the file
allocation table, which resides at the beginning of the volume.

To protect the volume, two copies of the table are kept, in case one becomes
damaged.
In addition, the file allocation tables must be stored in a fixed location so that the files
needed to start the system can be correctly located.

The file allocation table contains the following types of information about each cluster
on the volume (see example below for FAT16):

● Unused (0x0000)
● Cluster in use by a file
● Bad cluster (0xFFF7)
● Last cluster in a file (0xFFF8-0xFFFF)

There is no organization to the FAT folder structure, and files are given the first
available location on the volume. The starting cluster number is the address of the
first cluster used by the file. Each cluster contains a pointer to the next cluster in the
file, or an indication (0xFFFF) that this cluster is the end of the file. These links and
end of file indicators are shown below.

Example of File Allocation Table

This illustration shows three files. The file File1.txt is a file that is large enough to use
three clusters.

The second file, File2.txt, is a fragmented file that also requires three clusters.

A small file, File3.txt, fits completely in one cluster. In each case, the folder structure
points to the first cluster of the file.

FAT Root Folder


The root folder contains an entry for each file and folder on the root.

The only difference between the root folder and other folders is that the root folder is
on a specified location on the disk and has a fixed size .
Folders have a set of 32-byte Folder Entries for each file and subfolder contained in
the folder.

● Contains file names and metadata


○ Located immediately after FAT(s) in FAT12/16 or in a location specified in
the FAT32 boot sector
● Supports long file names
● New entries are added to the directory using a first-available or next-available
strategy
○ First-available: Finds first unallocated entry in the directory (e.g., Win98)
○ Next-available: Finds next available entry from the last allocated entry; at
end of directory chain, start again at beginning (e.g., WinXP)

The Folder Entry includes the following information:

● Name (eight-plus-three characters)


● Attribute byte (8 bits worth of information)
● Create time (24 bits)
● Create date (16 bits)
● Last access date (16 bits)
● Last modified time (16 bits)
● Last modified date (16 bits)
● Starting cluster number in the file allocation table (16 bits)
● File size (32 bits)

There is no organization to the FAT folder structure, and files are given the first
available location on the volume. The starting cluster number is the address of the
first cluster used by the file. Each cluster contains a pointer to the next cluster in the
file, or an indication (0xFFFF) that this cluster is the end of the file.

The information in the folder is used by all operating systems that support the FAT file
system. In addition, Windows NT can store additional time stamps in a FAT folder
entry. These time stamps show when the file was created or last accessed.

Normally, only the operating system controls the settings of these bits.
❏ FATs Compared

5.10 DOS Commands to Manage a Hard Drive MKDIR,CHDIR, RMDIR,


TREE, ATTRIB, MIRROR, UNFORMAT,PATH

1. MKDIR
There are multiple ways to create or add a folder, subfolder, directory,
and subdirectory on a computer. The methods depend on the
operating system or where the directory is being created. Select a link
below for steps on how to create a directory and folder in each major
operating system.
To create a directory in MS-DOS or the Windows command line (cmd),

use the md or mkdir MS-DOS command. For example, below we are

creating a new directory called "hope" in the current directory.


mkdir directory1

You can also create multiple new directories in the current directory

with the md command. In the next example, we are creating three new

directories, called "user1," "user2," and "user3," in the current

directory.

md user1 user2 user3

If you want to create a directory with spaces, you need to surround the

directory name with quotes. In the example below, we are creating a

directory called "my example directory" in the current directory.

md "my example directory"

To create a directory in the parent directory, without first moving into

that directory, you can use the command below. This example moves

back one directory to create the "example" directory.

2. CHDIR
Chdir (change directory) is a command used to switch directories in
MS-DOS.Used to change from one directory to another you specify.
The command can be used without the drive designator (d:) if you
were changing to a different directory on the current drive.

Chdir syntax
CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]

Chdir examples
chdir

Typing chdir by itself displays the current directory.

chdir\

Goes to the highest level, the root of the drive.

chdir..

Goes back one directory. For example, if you are in the

C:\Windows\COMMAND> directory, this would take you to

C:\Windows> directory.

chdir Windows

If present, would take you into the Windows directory. Windows

can be substituted with any other name.


3. RMDIR

Windows XP and later syntax


RMDIR [/S] [/Q] [drive:]path

RD [/S] [/Q] [drive:]path

Removes all directories and files in the specified directory

in addition to the directory itself. It is used to remove a

directory tree.

Quiet mode, do not ask if ok to remove a directory tree

with /S.

Syntax
Removes (deletes) a directory.

RMDIR [drive:]path

RD [drive:]path

Rd and rmdir examples


rmdir c:\full

If a directory contains files or folders, you will receive "The

directory is not empty." error message if you try to use rd or

rmdir. If you want to delete directories that are full, use the
deltree command or if you're using Windows 2000 or later, use

the example code below with the /s switch.

rmdir c:\test

Remove the test directory, if it's empty.

4. TREE
The tree command allows the user to view an easy-to-read list
of files and folders.

tree syntax
TREE [Drive:[[Path] [/F] [/A]

Driv Drive and directory containing disk for the display

e:\P of directory structure.

ath

/F Displays the file names contained in each

directory.

/A Extended characters used for linking lines instead

of graphic characters. /a is used with code pages

that do not support graphics characters and to

send output to printers that do not properly

interpret graphics characters.


Tree examples

The tree command typed alone produces a listing and overview

of the current directory (shown in the image to the right).

tree

In the example, C: is the current directory, "banners" is one of

the directories, and "big" is a subdirectory of the "cdn"

directory.

tree /F
The command above uses the tree command with the /F switch.

The resulting output would include the names of files located in

each of the directories in the tree. Depending on how many files

are located in each directory, the tree listing could be quite long.

5. ATTRIB
The attrib command allows an MS-DOS and Windows command
line user to change the attributes of a file or files. For example,
you could make a file hidden using the attrib command.
Attrib is an external command that is available for the
following Microsoft operating systems attrib.exe.

Basic Attribute Switches (R, H, A, S)

1. R – This command will assign the “Read-Only” attribute to your selected files or
folders.
2. H – This command will assign the “Hidden” attribute to your selected files or
folders.
3. A – This command will prepare your selected files or folders for “Archiving.”
4. S – This command will change your selected files or folders by assigning the
“System” attribute.

“Attrib” Syntax
You will need to know the proper syntax to use for the “attrib” tool before you get
started.

ATTRIB [+ attribute | - attribute] [pathname] [/S [/D]]

In this syntax, you will need to know what the different switches and parameters
represent.

1. The + and – indicate whether you will activate or deactivate the attribute
specified.
2. The attributes you can use are those explained above.
3. The “/S” signifies that you want to search the entire path specified including
subfolders for a particular file.
4. The “/D” signifies that you want to include any process folders as well.
5. The pathname indicates the location of your target folder or file. The proper
syntax for path files is shown below.

Clear “Hidden and System” attributes with a single command to make your files or
folders normal.

For this example, we will first create a file in your “Documents” directory called
“sample.txt.” First, open up the directory and right-click somewhere in the window, move
your mouse to the “New” section, click on “Text File,” and name the document “sample.”

Now go to your CMD window. We will change the file’s properties so that it is both a
system file, and hidden. Do this by entering the following command.

attrib +h +s C:\Users\Martin\Documents\sample.txt

Remember to substitute the “Martin” section of the path parameter with your
computer’s username.
Once you have done this, you will notice that the file has disappeared from your
documents folder. Now that we want to remove the System and Hidden file attributes
from “sample.txt,” we will need to use the following simple command.

attrib –h –s C:\Users\Martin\Documents\sample.txt

Note that if you try to enter the file name without a path, you will receive an error. You
must remember to add the entire path to your command. Now, if you go back to your
“Documents” directory, you will see the file in the list.

Scenario 2 – Make all text files in your “Downloads” folder read-only system files.

Now we will create a few sample text files in the “Downloads” directory and we will edit
them using the “attrib” tool so that they all become read-only system files.
Once you have your sample text files created, it is time to use CMD to write a command
that will change the attributes of all text files in a specified directory to “Read-Only and
System.” For this, we will need to use wildcards to select all the text files. You can do
this by using the command below. Remember to substitute the “Martin” section with
your computer’s username.

attrib +r +s C:\Users\Martin\Downloads\*.txt

Now you can open your downloads folder, right-click on one of the text files and then
select properties. You will note that the file attributes have been changed. To remove
these settings simply use the same command, but replace the plus signs with minus
signs.

attrib -r -s C:\Users\Martin\Downloads\*.txt
6. MIRROR
The MIRROR command saves disk storage information that can be used to recover
accidentally erased files.
The command is available in MS-DOS version 5. It is available separately for versions 6.2 and
later on Supplemental Disk.
Type: External

Syntax:

MIRROR [d:]path [d:] path [...]


MIRROR [d1:][d2:][...] [/T(drive)(files)] [/partn][/U][/1]

Purpose: Used to store information about a disk`s file allocation table, boot
record, and root directory .

Discussion

The MIRROR command is used to save information that can be used later for file
recovery using the UNDELETE and UNFORMAT commands. MIRROR creates a
duplicate or MIRROR of this important information in case the original information
becomes unreadable.
For each drive you specify, MIRROR creates a read-only file named MIRROR .
FIL on the disk`s root directory. The file contains all the information that could be
used later to recover deleted or damaged files, or even to rebuild the file
structure of the entire disk.

Options

/1 - Specifies that MIRROR should keep only one-data information file, based on
the latest information about the drive you specified.
[d:]path - Specifies the drives for which information will be saved and used later
for file recovery.
/partn
v Used to save a copy of the drive`s partition table on a diskette in drive A.
When using the MIRROR command, do not specify a network drive or a drive
that has been previously specified using the JOIN, ASSIGN, or SUBST
command.
If you do not use the /1 option and MIRROR finds a file on the disk named
MIRROR.FIL, that file will be renamed MIRROR.BAK and a new file named
MIRROR.FIL will be created.

Examples

To save a file with disk-recovery information for drives C and D, enter

mirror c:d:

7. UNFORMAT
The unformat command is used to restore a formatted drive to its
original state.
Unformat is an external command that is available for the following
Microsoft operating systems as unformat.com.

Unformat syntax
Restores a disk erased by the FORMAT

command or restructured by the

RECOVER command.

UNFORMAT drive: [/J]


UNFORMAT drive: [/U] [/L] [/TEST] [/P]
UNFORMAT /PARTN [/L]

dri Specifies the drive to unformat.

ve

:
/J Verifies that the mirror files agree with the system

information on the disk.

/U Unformats without using MIRROR files.

/L Lists all file and directory names found, or, when used

with the /PARTN switch, displays current partition tables.

/TEST Displays information but does not write changes to disk.

/P Sends output messages to a printer connected to LPT1.

/P Restores disk partition tables.

AR

TN

Unformat examples

unformat c:

Command specified to unformat drive

c: if it was formatted.
8. PATH

The path command is utilized to specify the location where MS-DOS


should look when it executes a command. For example, if you were to
use "format" command, the path must be specified or you will receive
the message "bad command or file name." See our path definition for
a full explanation and examples of paths on computers.
Path is an internal command that is available in the following Microsoft
operating systems.

Path syntax
Displays or sets a search path for executable files.

PATH [[drive:]path[;...]]
PATH ;

Type PATH ; to clear all directory names stored in your PATH variable.

This command will force Windows to search only in the current directory

for command names you run.

Path examples
path

Typing "path" by itself shows the current path information. Below is an

example of the output you may receive when utilizing this command. As

shown in the example below, there are multiple directories in the path

separated by a semicolon.

PATH=C:\Program Files (x86)\NVIDIA


Corporation\PhysX\Common;C:\Program Files (x8
6)\WinSCP;C:\Perl\site\bin;C:\Perl\bin;C:\WINDOWS\system32;
C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86 )\Windows Live\Shared;C:\Program
Files (x86)\FAHClient;

path=c:\windows\command

The command above would set the path to C:\windows\command, which

is where many of the Windows commands are located.

5.11Fragmentation

In contiguous memory allocation whenever the processes come into RAM,


space is allocated to them.

These spaces in RAM are divided either on the basis of fixed partitioning(the
size of partitions are fixed before the process gets loaded into RAM) or
dynamic partitioning (the size of the partition is decided at the run time
according to the size of the process).

As the process gets loaded and removed from the memory these spaces get
broken into small pieces of memory that can't be allocated to the coming
processes. This problem is called fragmentation. In this blog, we will study
how these free space and fragmentations occur in memory. So, let's get
started.
Fragmentation
Fragmentation is an unwanted problem where the memory blocks cannot be

allocated to the processes due to their small size and the blocks remain

unused. It can also be understood as when the processes are loaded and

removed from the memory they create free space or holes in the memory and

these small blocks cannot be allocated to new upcoming processes and results

in inefficient use of memory. Basically, there are two types of fragmentation:

● Internal Fragmentation

● External Fragmentation

Internal Fragmentation
In this fragmentation, the process is allocated a memory block of size more

than the size of that process. Due to this some part of the memory is left

unused and this causes internal fragmentation.

Example: Suppose there is fixed partitioning (i.e. the memory blocks are of

fixed sizes) is used for memory allocation in RAM. These sizes are 2MB, 4MB,

4MB, 8MB. Some part of this RAM is occupied by the Operating System (OS).

Now, suppose a process P1 of size 3MB comes and it gets memory block of

size 4MB. So, the 1MB that is free in this block is wasted and this space can’t

be utilized for allocating memory to some other process. This is called

internal fragmentation.
How to remove internal fragmentation?
This problem is occurring because we have fixed the sizes of the memory

blocks. This problem can be removed if we use dynamic partitioning for

allocating space to the process. In dynamic partitioning, the process is

allocated only that much amount of space which is required by the process. So,

there is no internal fragmentation.

External Fragmentation
In this fragmentation, although we have total space available that is needed

by a process still we are not able to put that process in the memory because

that space is not contiguous. This is called external fragmentation.

Example: Suppose in the above example, if three new processes P2, P3, and P4

come of sizes 2MB, 3MB, and 6MB respectively. Now, these processes get

memory blocks of size 2MB, 4MB and 8MB respectively allocated.

So, now if we closely analyze this situation then process P3 (unused 1MB)and

P4(unused 2MB) are again causing internal fragmentation. So, a total of 4MB

(1MB (due to process P1) + 1MB (due to process P3) + 2MB (due to process P4))

is unused due to internal fragmentation.


Now, suppose a new process of 4 MB comes. Though we have a total space of

4MB still we can’t allocate this memory to the process. This is called external

fragmentation.
How to remove external fragmentation?
This problem is occurring because we are allocating memory continuously to

the processes. So, if we remove this condition external fragmentation can be

reduced. This is what is done in paging & segmentation(non-contiguous

memory allocation techniques) where memory is allocated non-contiguously

to the processes.

Another way to remove external fragmentation is compaction. When dynamic

partitioning is used for memory allocation then external fragmentation can

be reduced by merging all the free memory together in one large block. This

technique is also called defragmentation. This larger block of memory is then

used for allocating space according to the needs of the new processes.

5.12 Disk Compression


A disk compression software utility increases the amount of information that can
be stored on a hard disk drive of given size.
Unlike a file compression utility, which compresses only specific files—and which
requires the user to designate the files to be compressed—an on-the-fly disk
compression utility works automatically through resident software without the
user needing to be aware of its existence.
On-the-fly disk compression is therefore also known as transparent, real-time or online
disk compression.
When information needs to be stored on the hard disk, the utility compresses the
information.
When information needs to be read, the utility decompresses the information. A
disk compression utility overrides the standard operating system routines. Since all
software applications access the hard disk using these routines, they continue to work
after disk compression has been installed.
Disk compression utilities were popular especially in the early 1990s, when
microcomputer hard disks were still relatively small (20 to 80 megabytes).

Hard drives were also rather expensive at the time, costing roughly 10 USD per
megabyte. For the users who bought disk compression applications, the software
proved to be in the short term a more economic means of acquiring more disk space as
opposed to replacing their current drive with a larger one.
A good disk compression utility could, on average, double the available space
with negligible speed loss. Disk compression fell into disuse by the late 1990s, as
advances in hard drive technology and manufacturing led to increased capacities and
lower prices.

Common disk compression solutions

Standalone hardware
Some of the initial disk compression solutions were hardware-assisted and utilized add-on
compressor/decompressor coprocessor cards in addition to a software driver. Known
solutions include:
● Stacker XT/8 and Stacker AT/16 from Stac Electronics
● Expanz! and Expanz! Plus from InfoChip Systems
● DiskDoubler dd2000 from Datran Corporation
● MRCI (Microsoft Real-Time Compression Interface) from Microsoft

Standalone software
With increasing PC processor power software-only solutions began to reach or even
outperform the performance of hardware-assisted solutions in most scenarios. These
compression utilities were sold independently. A user had to specifically choose to install
and configure the software.

● Squish and Squish Plus from Sundog Software


● Stacker from Stac Electronics
● XtraDrive from Integrated Information Technology (IIT)
● SuperStor and SuperStor Pro from AddStor
● DoubleDisk and DoubleDisk Gold from Vertisoft Systems
● JAM (JAM.SYS) from JAM Software, Kiev, Ukraine
● DiskDoubler from Salient Software
● Double Density from Data Becker

5.13 Disk Caching

A disk cache is a cache memory that is used to speed up the process of storing
and accessing data from the host hard disk. It enables faster processing of
reading/writing, commands and other input and output process between the hard
disk, the memory and computing components.
A disk cache is also referred to as a disk buffer and cache buffer.A disk cache is a
mechanism for improving the time it takes to read from or write to a hard disk.
Today, the disk cache is usually included as part of the hard disk. A disk cache
can also be a specified portion of random access memory (RAM).
The disk cache holds data that has recently been read and, in some cases,
adjacent data areas that are likely to be accessed next. Write caching is also
provided with some disk caches.A disk cache is an integrated part of the hard
disk and is a standard feature of most hard disk drives.
The size of disk cache ranges from 128 MB in standard disks to 1 GB in solid
state disks.Typically, a disk cache stores the most recent and frequently used
programs and data.
When a user or program requests data, the operating system first reviews the
disk cache. If the data is found, the OS and memory quickly deliver the data to the
program.
A disk cache can also be soft disk cache when it’s implemented on the RAM
rather than the host/native hard disk.

You might also like