Linux - File Systems and Partitions

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
Search for a command to run...

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
No comments yet. Be the first to comment.
1. Difference between Docker and Kubernetes Docker → Builds and runs containers.Kubernetes → Orchestrates containers across multiple nodes. Key points: Docker = container runtime. Kubernetes = container orchestration tool. Kubernetes provides auto...
In this session, we learn how to monitor a Kubernetes cluster using Prometheus and Grafana.This is not just theory — there is a GitHub repository containing all installation commands and demo steps.The repo will also be enhanced later with advanced K...
1. What is a ConfigMap in Kubernetes? A ConfigMap is used to store non-sensitive configuration data that your application needs — such as: Database port Connection type Any general configuration values In normal applications (non-Kubernetes), de...
Kubernetes normally supports built-in resources like: Deployment Service Pod ConfigMap Secret Ingress These are called native resources. Sometimes companies (Istio, ArgoCD, Prometheus Operator, Kyverno, etc.) want to add new features that Kub...
1. Why Kubernetes Services Are Needed When a Pod is created in Kubernetes, it receives a dynamic IP address.If the Pod dies and restarts, its IP changes.So other Pods (like checkout → payments) cannot rely on Pod IP because it changes, creating issue...
Managing file systems and partitions is essential for effective data organization and optimal system performance in Linux. In this blog, we'll cover the basics of file systems, how to create and manage partitions, and best practices for maintaining them.
What is a File System?
A file system in Linux defines how data is stored and accessed on storage devices. Common Linux file systems include ext4, XFS, and Btrfs, each offering unique features suited to different use cases. For example, ext4 is widely used due to its reliability and performance, while XFS is preferred for handling large files, and Btrfs is popular for its advanced features like snapshots.
Understanding Partitions
Partitions divide your hard drive into distinct sections, allowing for better data management. In Linux, you can create primary, extended, and logical partitions. Proper partitioning not only helps with data organization but also improves system performance.
Step-by-Step Guide to Partitioning
Step 1: Add the new disk
In this guide, a 5GB virtual disk has been added in vSphere for testing purposes.

Once you've added the new virtual disk, verify that Linux recognizes it by running the following command:
lsblk
You'll see a list of disks, including your newly added one (e.g., /dev/sdb or /dev/sdc).

Linux provides tools like fdisk and parted for partitioning. Here's how to use fdisk:
Open a terminal and run:
Replace sdX with your new disk identifier (e.g., /dev/sdc).
sudo fdisk /dev/sdX

Create a new partition:
Type n to create a new partition, and follow the prompts:
Primary or Extended Partition: Select p for a primary partition.
Partition Number: Press Enter to accept the default.
First Sector: Press Enter to accept the default.
Last Sector: If you want to use the entire disk, press Enter. For a specific size (e.g., 3GB), type +3G.
Press p to print the partition table and verify the changes.

Write the changes:
Press w to write the changes and exit fdisk.

Before formatting, check the disk name by running:
lsblk

Now, format the newly created partition with the ext4 file system:
sudo mkfs.ext4 /dev/sdX1
Replace sdX1 with the partition identifier (e.g., /dev/sdc1).

Create a mount point and mount the partition:
sudo mkdir /mnt/newdisk
sudo mount /dev/sdX1 /mnt/newdisk

Your partition is now ready to use. Verify the mounted disk by running:
df -h

Conclusion
Effectively managing file systems and partitions in Linux is crucial for enhancing system performance and ensuring well-organized data. Familiarizing yourself with these concepts will make you a more proficient system administrator, capable of optimizing storage devices for various use cases.