Download Implementing hard drive.

Document related concepts

Spring (operating system) wikipedia , lookup

Burroughs MCP wikipedia , lookup

Booting wikipedia , lookup

Batch file wikipedia , lookup

Unix security wikipedia , lookup

Commodore DOS wikipedia , lookup

VS/9 wikipedia , lookup

Windows NT startup process wikipedia , lookup

CP/M wikipedia , lookup

Design of the FAT file system wikipedia , lookup

File Allocation Table wikipedia , lookup

Master boot record wikipedia , lookup

Transcript
1
Overview
In this chapter, you will learn to
 Explain the partitions available in Windows
 Discuss the formatting options
 Partition and format a hard drive
Introduction
 A new Hdive (HD) is nothing than a huge pile of
sectors.
 CMOS sees the drive, it shows up in the autodetect screen and BIOS knows how to talk to drive.
 For operating system, It must organize that pile of
sectors so one can create 2 things: folders and files.
 After installing a HD, 2 more steps must be
performed to translate a drives geometry into
something usable to the system.
 Partitioning
 and formatting.
3
Partitioning
 Process of electronically subdividing the physical
hard drive into groups of cylinders. Called
partitions or volumes
 A HD must have at least one partition.
 You can have multiple partitions on single HD.
 Windows assigns them names such as C: or D:
 Logical divisions of a hard drive.
4
Partitioning
5
Formatting
 After partition you must format derive.
 Installs a file system onto the drive that organizes
each partition in such a way that operating system
can store files and folders on the drive. called high
level formatting.
6
Hard Drive Partitions
 Partitions provides flexibility in HD organization. You
can organize a drive in a way that suits your taste. How?
 Partitioning enables a single HD to store more than one
operating system .
 Windows 2000/XP support 2 different Partitioning
methods:
1. Master Boot Record (MBR) partitioning scheme.
• Older but universal
• The HD is called ‘basic disk’
2. Dynamic partitioning scheme.
• Newer but proprietary to Microsoft
•
The HD is called ‘dynamic disk’.
7
Basic Disk
 Basic disk partitioning creates two very small data
structures on a drive:
 Master Boot Record (MBR)
 and a Partition Table
 Stores them on the first sector of the HD- called
the Boot Sector.
 MBR is a tiny bit of code that takes control of the
boot process from system BIOS.
 When a computer boots to a HD, BIOS
automatically looks for MBR code on the boot
sector.
8
Basic Disk
 MBR looks in the partition table for a partition with
a valid operating system.
 Only one MBR per disk
Program
Data
9
Basic Disk
 Partition table supports up to 4 partitions.
 Supports 2 types of partitions: primary and
extended.
 Primary:
designed
to
support
operating
systems.(bootable)
 Extended: not bootable
 A single disk may have up to 3 primary partitions
and only one extended partition.
 If you don’t have an extended partition, you may
have up to 4 primary partitions. This allows for
multiple (up to 4) operating systems (called
multiboot, dual boot)
10
Basic Disk
 Each partition must have some unique identifier to
enable user to recognize it as an individual partition.
 Windows assign primary partitions a drive letter
from C: to Z:. Extended partition do not get drive
letters.
 After you create an extend partition you must create
logical drives within that extend partition. Logical
drive get a drive letter from D: to Z:
 C: is always reserved for first primary partition in
windows PC.
11
Hard Drive Partitioning
C:
?
12
Volume boot sector
 The first sector of the first cylinder of each partition
also has a boot sector called volume boot sector.
 Stores information important to its partition, such
as location of OS boot files and partition size.
13
Primary Partition
 Can be bootable
 Has a special setting called ‘active’ stored in the
partition table. It is either on/off on each primary
partition.
 Only one partition at a time can be the active
partition because you can run only one OS at a
time.
 At boot, the MBR uses the active setting to
determine which primary partition is active to
load OS from.
 The partition is set active when you install OS. It
never actually says this in the install.
 Rest of chapter assume only one primary partition.
14
Boot Sector
15
Boot Sector
 Few system use more than one primary
partition.
 You almost never see four partitions used in
windows world.
 How we can change active partition? And why?
16
Extended Partition
 Why we have extended partition?
 Further divided into logical drives which get a drive
letter from D: to Z:
 An extend partition may have as many logical drives
as you wish.
 Cannot be bootable or Active
 Completely optional. What doest means?
 Why we try to create extended partition.
17
Partitions
Primary Partition
Extended Partition
Primary Partition
Logical
Drive 1
Drive Letter = c:
Drive Letter = d:
Set to “Active”
Stores O.S.
Logical
Drive 2
Drive Letter = e:
Hard Disk
18
Example
2 Drives (DOS)
Dual OS
Master
Extended Partition
Primary Partition
C:
E:
MBR
Logical Drives
tells layout of the disk
Primary Partition
D:
MBR
tells layout of the disk
F:
Slave
Extended Partition
G:
H:
Logical Drives
19
When to partition
 Two most common situations:
 when installing an OS on a new system
 when adding a second drive to an existing
system
 Traditionally, once a partition is made, you can not
change its size or type other than by erasing it.
 Third-party tools can non-destructively resize
partitions (without losing the data)
 Windows 2000 and XP can non-destructively
resize a partition to be larger but not smaller.
 Vista can non-destructively resize partitions any
way we wish.
20
21
Hard Drive Formatting
 Done after partitioning
 Every partition needs to be formatted. Why?
 Formatting does two things
 It creates a file system – like a library’s card
catalog
 and makes the root directory in that file system.
 Current file systems in Windows:
 FAT16
 FAT32
 NTFS.
 Root directory provides foundation upon which OS
builds files and folders.
22
FAT – File Allocation Table
 A file is stored in many sectors (possibly one).
 The main job of FAT is to track which sectors are
assigned to each file, which sectors are unused and
which are bad.
 The sector number is represented in 16 bits.
Therefore there are 64K sectors (2^16).
 64K sectors limits partition size to 32MB (how?)
23
FAT – File Allocation Table
 The right column of the FAT contains information
about the status of sectors.
 Formatting: creating FAT and testing
sectors. Assign 0000 to good and
open for use sectors and FFF7 to bad ones.
 OS must locate bad sectors (if any).
 This mapping of bad sectors is one of
the functions of high-level formatting.
 Floppy disks use FAT with 12 bits.
0000
0000
0001
FFF7
0002
0000
……….
0000
……….
0000
FFFF
0000
24
FAT Limited
 Using 16-bit FAT addresses a maximum of 64 K
location.
 The size of hard disk partition should be limited to
64 K x 512 bytes per sector (32 M).
 As hard drives grew in size you could use FDISK to
break them up into multiple partitions.
 Therefore using FAT 16 with very large HD is
unacceptable.
 Solution was clustering, allowing partition sizes up
to 2 GB
25
Clustering
 To break the limit of 32MB in partition size with
backward compatibility.
 Enables one to format partition larger than 32MB
 Idea: combining a set of contiguous sectors and
treating them as a single unit (cluster) in FAT. i.e.
FAT addresses a cluster instead of a sector. So, the
cluster became the smallest addressable block of
data stored on a drive. The size of a cluster is not
fixed.
26
Clustering
 Number of clusters is still 64K (16 bit). So, number
of sectors/cluster is determined according to
partition size. (how?)
 The large the partition the more sector per cluster.
27
Clusters and Sectors
28
FAT16
 FAT16: clustering FAT where the cluster is
represented in 16 bits.
 Cluster sizes: 4,8,16,32 64 (max. partition is
2GB). Compute it?
 Hard Drives become fragmented. This mean
that data for one individual file may not be in
consecutive clusters
 Excess fragmentation slows down systems. It
needs defragmentation from time to time.
29
FAT16 in Action
 When an API tells the OS to save a file
(MOM.TXT).
 Windows start at beginning of FAT looking
for the first open cluster.
30
FAT16 in Action
 Before filling 3ABC window enter the value 3ABC
in 3ABB status.
FAT 16
31
FAT16 in Action
32
FAT16 in Action
0000 = Good
FFF7 = Bad
FFFF = End of File
33
FAT and Root Directory
 Windows then goes to the folder storing the file and
adds the file name and the cluster’s number to the
folder list
 File folder located in different cluster.
 What happen if program requesting that file?
34
Fragmentation
 Fragmentation occurs when files are spread across
drives (not contiguous)
 Individual files are broken into pieces that fit into a
sector or cluster
 The pieces are stored on the hard drive but may not be
stored in contiguous clusters
 Fragment take place all the time on FAT 16.
 Fragmentation slows down the system during hard
drive reads and writes
 Programs such as Disk Defragmenter or Speed Disk
can be used to defragment files, folders, or both
 Takes longer for system to piece together and can
impact performance.
35
Disk Defragmenter
36
Disk Defragmenter
37
FAT 32
 Uses 32 bits to describe each cluster
 Cluster size can drop to reasonable size compared
to FAT16.
 A 2-GB volume using FAT16 would use 32-KB
clusters, while the same 2-GB volume using FAT32
would use the minimum cluster size (4KB).
 FAT 32 support partition up to 2 terabyte.
 But needs de-fragmentation
 Remember, only DOS and Windows 3.x/95/98/Me
use FAT
38
NTFS
 File system of choice today.
 NT File System (NT came from Windows NT, first
OS to use it)
 Windows NT, 2000, XP, Vista.
 Uses clusters and file allocation table in a much
more complex and powerful way compared to
FAT16 and FAT32 this table called Master File
Table (MFT).
 Main
improvements: redundancy, security,
compression, encryption, disk quotas, and cluster
sizing.
39
NTFS
 Security:
 Provides file and folder access control
 Uses Access Control List with
permissions
 If you’re on the list, you’re granted the
specific permission
 Compression: Compresses data on a hard drive to
allow more data to be written to the drive. (Slower).
 Encrypting file system:
 Allows files and folders to be
encrypted and unreadable to
anyone without the key
40
NTFS
 Files and folders can be
encrypted or compressed
 Disk quotas
 Can control how users can
use space
 Set on a per-drive basis
 Cluster sizes
 Can adjust cluster sizes
 Rare to do so
41
Divisions of a Hard Drive
42
43
Bootable Disks
 Any software that can boot up a system is by
default OS.
 Bootable disk is any removable media that has a
bootable OS installed
 Floppy, CD-ROM, USB thumb drive
 All Windows and Linux installation CDs are
bootable
44
Install Hard Drive
 Connectivity
 CMOS
 Partitioning
 Formatting
45
46
48
49
50
51
52
53
54