Networking and System AdministrationUnit 412 min read
File Systems, Storage Types, RAID, LVM, Partitioning & Backup
Unit 4 of Networking and System Administration explores file systems (ext4, NTFS, FAT32), storage technologies (HDD, SSD, NAS), RAID configurations (0, 1, 5, 10), Logical Volume Management (LVM), disk partitioning, and backup strategies (full, incremental, differential) with real-world examples from eSewa, Daraz, and N
What is a File System?
A file system is a method and data structure that an operating system uses to control how data is stored and retrieved on storage devices (HDDs, SSDs, USB drives). It defines:
- How files and folders are named and organized.
- How data is stored on disk blocks.
- How permissions and metadata (size, date, owner) are managed.
Common File Systems
| File System | OS Support | Key Features | Use Cases |
|---|---|---|---|
| ext4 | Linux | Journaling, large file support (16TB), efficient metadata handling | Linux servers, desktops, eSewa backend storage |
| NTFS | Windows | Security descriptors, compression, large volumes (16EB), shadow copies | Windows servers, Ncell internal storage, corporate file shares |
| FAT32 | Windows, Linux | Simple, no journaling, max 4GB file size, widely compatible | USB drives, bootable media, embedded systems (e.g., Daraz delivery logs) |
| XFS | Linux | High performance for large files, scalable to petabytes | High-traffic web servers (e.g., YouTube storage) |
| ZFS | Linux, BSD | RAID, snapshots, checksums, data integrity, but resource-heavy | Enterprise storage (e.g., NTC’s network equipment logs) |
How ext4 Organizes Data
classDiagram
class BlockGroup {
+Superblock (metadata)
+Group Descriptor Table
+Inode Table (file metadata)
+Data Blocks (actual file content)
}
class Superblock {
+Filesystem UUID
+Block size
+Total blocks
+Free blocks count
}
class Inode {
+File size
+Permissions (rwx)
+Owner:Group
+Timestamps (atime, mtime, ctime)
+Pointers to data blocks
}
BlockGroup "1" --> "many" Superblock : contains
BlockGroup "1" --> "many" Inode : contains
BlockD["Data Block"] "1" --> "many" Inode : referenced byStorage Devices: HDD vs. SSD vs. NAS
1. HDD (Hard Disk Drive)
- Mechanism: Magnetic platters + read/write heads on an actuator arm.
- Speed: 50–150 MB/s (slower due to mechanical movement).
- Capacity: 500GB–20TB (cheaper per GB).
- Use Case: Bulk storage (e.g., NEPSE’s historical stock data archives).
2. SSD (Solid State Drive)
- Mechanism: NAND flash memory (no moving parts).
- Speed: 300–3500 MB/s (faster random access).
- Capacity: 120GB–15TB (expensive per GB).
- Use Case: OS boot drives, databases (e.g., eSewa transaction logs).
3. NAS (Network-Attached Storage)
- Definition: A dedicated file-level storage device connected to a network (e.g., Synology, QNAP).
- Use Case: Centralized storage for multiple users (e.g., Daraz’s order processing servers).
- Protocols: NFS (Linux), SMB/CIFS (Windows), AFP (macOS).
RAID (Redundant Array of Independent Disks)
RAID combines multiple physical disks into a logical unit for performance, redundancy, or both. Common levels:
graph LR
subgraph RAID 0
A["Disk 1"] -->|"Striping"| B["Disk 2"]
B -->|"No redundancy"| A
end
subgraph RAID 1
C["Disk 1"] -->|"Mirroring"| D["Disk 2"]
D -->|"Exact copy"| C
end
subgraph RAID 5
E["Disk 1"] -->|"Striping + Parity"| F["Disk 2"]
F -->|"Parity block"| G["Disk 3"]
G -->|"Tolerates 1 failure"| E
end
subgraph RAID 10
H["Disk 1"] -->|"Mirrored"| I["Disk 2"]
J["Disk 3"] -->|"Mirrored"| K["Disk 4"]
I -->|"Striped"| J
K -->|"Striped"| H
endVisual comparison of RAID levels using Daraz’s storage example| RAID Level | Description | Minimum Disks | Fault Tolerance | Performance Gain | Use Case |
|---|---|---|---|---|---|
| RAID 0 | Striping (no redundancy) | 2 | ❌ No | ✅ High read/write | Temporary storage (e.g., video editing) |
| RAID 1 | Mirroring (exact copy) | 2 | ✅ 1 disk | ❌ None | Critical data (e.g., Ncell’s billing DB) |
| RAID 5 | Striping + distributed parity (1 disk lost) | 3 | ✅ 1 disk | ✅ Moderate | Web servers (e.g., YouTube backups) |
| RAID 10 | Mirroring + striping (RAID 1 + RAID 0) | 4 | ✅ 1 disk | ✅ High | Financial systems (e.g., NEPSE trading) |
Worked Example: Daraz’s Order Queue Storage
Daraz processes 10,000 orders/hour. If they use:
- RAID 0 (2x 1TB HDDs): 2TB total, but 1 disk failure = all data lost.
- RAID 1 (2x 1TB HDDs): 1TB usable, but faster reads (mirrored).
- RAID 5 (3x 1TB HDDs): 2TB usable, tolerates 1 failure, good balance.
Recommendation: RAID 10 for high availability (e.g., order processing DB) + RAID 5 for backups.
Logical Volume Management (LVM)
LVM allows dynamic resizing of storage volumes without downtime. Key components:
- Physical Volumes (PVs): Physical disks or partitions.
- Volume Groups (VGs): Pool of PVs.
- Logical Volumes (LVs): Filesystems or swap space created from VGs.
Steps to Create an LVM Setup
sequenceDiagram
participant Admin
participant PV as Physical Volume
participant VG as Volume Group
participant LV as Logical Volume
participant FS as Filesystem
Admin->>PV: pvcreate /dev/sdb
Admin->>VG: vgcreate myvg /dev/sdb
Admin->>LV: lvcreate -n data -L 50G myvg
Admin->>FS: mkfs.ext4 /dev/myvg/data
Admin->>FS: mount /dev/myvg/data /mnt/dataAdvantages of LVM
- Extend storage: Add a new disk to a VG and expand an LV.
- Snapshots: Create point-in-time copies (e.g., before a software update).
- Flexibility: Move data between LVs without reformatting.
Disk Partitioning
Partitioning divides a disk into independent sections (e.g., /boot, /home, /var). Common schemes:
| Partition | Purpose | Size Recommendation | Filesystem |
|---|---|---|---|
/ |
Root filesystem (OS + apps) | 20–50GB | ext4 |
/home |
User data (documents, downloads) | Remaining space | ext4 |
/var |
Variable data (logs, caches) | 10–20GB | ext4 |
swap |
Virtual memory | = RAM size | swap |
Worked Example: Ncell’s Server Partitioning
Ncell’s billing server requires:
/(root): 30GB (OS + MySQL, Apache)./var: 50GB (logs, call records)./home: 200GB (customer data).swap: 8GB (RAM size).
Command to create partitions:
fdisk /dev/sda
n (new partition)
p (primary)
1 (partition number)
+30G (size)
t (type)
83 (Linux filesystem)
w (write)
mkfs.ext4 /dev/sda1
mount /dev/sda1 /
Backup Strategies
| Type | Description | Pros | Cons | Example Use Case |
|---|---|---|---|---|
| Full | Copies all data every time. | Simple, reliable | Time-consuming, storage-heavy | Weekly backup of eSewa DB |
| Incremental | Copies only changes since last backup. | Fast, storage-efficient | Complex restoration | Daily backups of Daraz orders |
| Differential | Copies changes since last full backup. | Faster than incremental | Slower than incremental | Nightly backups of Ncell logs |
3-2-1 Backup Rule
- 3 copies of data (e.g., primary + 2 backups).
- 2 different media (e.g., HDD + cloud).
- 1 offsite (e.g., encrypted backup at a remote data center).
In the Real World
eSewa’s Transaction Logs
- Uses RAID 10 for high availability (mirrored + striped) to handle 10,000+ transactions/minute.
- LVM allows dynamic scaling during Diwali (peak season).
- ext4 filesystem for journaling (prevents corruption during power failures).
Daraz’s Order Processing
- RAID 5 for order databases (tolerates 1 disk failure).
- Partitioning: Separate
/varfor logs (analyzed for fraud detection). - Incremental backups nightly to reduce storage costs.
Ncell’s Network Equipment Logs
- ZFS for checksums (detects corrupted logs from hardware failures).
- NAS centralizes logs from 50+ cell towers for analysis.
Exam Tip
Diagrams are worth marks:
- Draw RAID configurations (show parity blocks for RAID 5).
- Sketch LVM components (PV → VG → LV).
- Label partition tables (MBR vs. GPT).
Compare file systems:
- ext4 vs. NTFS: journaling, permissions, max file size.
- FAT32 vs. exFAT: file size limit, compatibility.
Worked examples:
- Calculate RAID 5 usable space:
(n-1)*disk_size(e.g., 3x1TB → 2TB usable). - Design a partition scheme for a given scenario (e.g., web server vs. database server).
- Calculate RAID 5 usable space:
Backup questions:
- Given a scenario, choose the best backup type (full vs. incremental).
- Explain the 3-2-1 rule with real-world constraints (e.g., "NTC has limited cloud storage").
Commands:
fdisk,mkfs,mount,pvcreate,vgcreate,lvcreate.rsyncfor backups (e.g.,rsync -avz /data/ backup@server:/backups/).
Summary Table
| Concept | Key Idea | Exam Focus |
|---|---|---|
| File Systems | ext4 (Linux), NTFS (Windows), FAT32 (USB) | Compare features, journaling |
| RAID | RAID 0 (speed), RAID 1 (mirror), RAID 5 (parity), RAID 10 (mirror+stripe) | Calculate usable space, fault tolerance |
| LVM | Dynamic storage management (PV, VG, LV) | Diagram components, extend LV |
| Partitioning | /, /home, /var, swap |
Design scheme for given use case |
| Backups | Full, incremental, differential; 3-2-1 rule | Choose strategy for scenario |
Based on the TU BITM syllabus for Networking and System Administration (IT271), unit 4.
Discussion
Loading…