Secondary Storage Structure:
Secondary Storage: Secondary storage refers to non-volatile storage
devices that retain data even when the system is powered off. The most
common type of secondary storage is the hard disk drive (HDD), but solid-
state drives (SSD) and other storage technologies follow similar principles
in structure.
Overview of disk structure:
Types of Disks:
I. Hard Disk Drive (HDD)
II. Solid-State Disks (SSD)
III. Optical Disks
IV. Magnetic Disks
V. Floppy Disk
HDD SDD
Floppy Disk
Types of Disk Structure’s:
1. Physical Structure
2. Logical Structure
Physical Structure:
Physical structure consists of 4 Parts:
1. Platters (for HDD’s): Data is stored in the form of Platters.
2. NAND chips (for SSD’s): Data is stored in the form of Chips
3. Tracks & Sectors: The surface of the disk is divided into concentric
tracks and further divided into sectors.
4. Blocks: Blocks are usually called as the smallest unit of storage
(from 512 Bytes to 4KB)
5. Firmware & Controller: Usually handles or manages Read/Write
operations and Error Handlings.
Magnetic Disk Structure
Logical Structure:
Logical Structure also known for OS-Level Disks, has two types of
structures they are Partition Tables & File Systems. Partition Tables defines
how the disks are divided into partitions. Now, Partitions can be done
multiple ways Master Boot Record (MBR) which supports up to 4 primary
partitions and maximum size is 2TB and GUID Partition Table (GPT) which
is supported for unlimited partitions and maximum size is 9.4ZB.
File Systems defines how to store, organize and retrieve files on a disk.
File Systems are different in each OS optimized for specific use cases:
1. NTFS (New Type File System): Compatible for Modern Windows
Systems, Supports Large Files and partitions up to 16Exabytes and
Volumes up to 8Petabytes
2. FAT32 (File Allocation Table 32-bit): This is the Older or Elder File
System compatible with all Kinds of OS (MacOS, Linux & Windows).
But Less Secure than NTFS.
3. exFAT (Extended File Allocation Table): This is specially designed for
flash drives like USB, SD cards, SSD’s. There is no file size limit and
supports all kinds of OS.
4. EXT4: Also known as fourth Extended File system mostly used in
Linux OS which supports large files. It can be used in windows or
mac but with a support of third-party tools, which is not good to use.
5. XFS: Also known as Extended File System used in Enterprise storage
as this is good at handling Large Scale data. It is mostly used in
CentOS, RHEL.
6. APFS: Also known as Apple File System, this is a default file system
for MacOS. This is not supported.
Disk Attachment Methods:
Disk attachments are of three types they are Physical Disk Attachment,
Virtual Disk Attachment & Network Disk Attachment. Where Physical Disk
have Internal & External Storages. For Internal Storage we use SATA
(Serial ATA), NVMe (Non-Volatile Memory Express) & SAS (Serial Attached
SCSI). For External Storage we have USB, Thunderbolt & eSATA (External
Serial ATA). Network Disk Attachment is Network Based attachment where
for Linux it uses Network File System (NFS), for Windows we use Server
Message Block (SMB) & additionally we have iSCSI (internet small
computer system interface) & Fibre channel.
Disk Scheduling:
It is a method used by an OS to decide the order in which disk I/O requests
are processed, as disk operations are slow compared to CPU operations,
disk scheduling helps to optimize the performance of the disks by
reducing the latency. For disk scheduling there are multiple algorithms to
follow:
1. First-Come, First-Served: FCFS algorithm processes the requests in
the order they arrive.
2. Shortest Seek Time First: SSTF Serves the request closest to the
current head position.
3. SCAN: SCAN is an Elevator Algorithm moves the disk arm back and
forth serving the requests along the way.
4. C-SCAN: C-SCAN Scheduling is a variant of Designed to provide a
more uniform wait time.
5. LOOK & C-LOOK: LOOK Scheduling & C-LOOK Scheduling are
respectively like SCAN Scheduling & C-SCAN Scheduling but LOOK &
C-LOOK avoids moving to the extreme ends of the disk.
RAID Structures:
RAID: Also known as Redundant Array of Independent Disks is a storage
technology that combines multiple disks for Performance & redundancy.
These RAID are of Different Levels & different Types.
Levels of RAID’s:
RAID 0: for Data stripping across Disks
RAID 1: for Data Mirroring
RAID 5: for Data spread across multiple disks with parity and Data
stripping.
RAID 6: RAID 6 is RAID 5 with extra parity
RAID 10: also known as RAID 1 + RAID 0, which is combination of Data
mirroring and Data Stripping.
Types of RAIDS:
1. Software RAID: Software RAID is managed by OS (windows & Linux)
2. Hardware RAID: Software RAID is managed by a RAID controller for
better performance.
Stable Storage Implementation:
Stable storage ensures the data consistency, protection, reliability. It even
ensures that the data is safe when there is a power failure or system
crash. As the data is very valuable stable storage is very crucial for
databases, transaction logs and critical systems.
Techniques for Stable Storage:
1. Wite-Ahead Logging (WAL)
2. Journaling File System
3. RAID for Redundancy