Linux : Storage Management (Day 6)
Bhupesh Patil ?
DevSecOps Engineer ??? | 2x Microsoft Azure ? 1x OCI ?? | Go ? Docker ? Kubernetes ? CI/CD ? Security ? Obeservabillity ? Terraform ?????? ||
Linux Storage Management Commands
Understanding Disk Storage
Disk storage refers to the physical storage devices (such as hard drives or SSDs) used to store data. In Linux, disks are represented as block devices (e.g., /dev/sda, /dev/nvme0n1). Understanding disk storage involves knowing how to manage these devices effectively.
Partitioning Hard Disks
Partitioning is the process of dividing a disk into logical areas called partitions. Each partition can be managed separately. Here are the steps for creating partitions:
Attach the Disk:
Create Partitions:
sudo parted /dev/sdb mklabel gpt
sudo parted /dev/sdb mkpart primary ext4 1MiB 10GiB
Create a File System:
sudo mkfs.ext4 /dev/sdb1
Mount the File Systems:
sudo mount /dev/sdb1 /mnt/data
Logical Volume Management (LVM)
LVM provides flexible disk management by allowing you to create logical volumes (LVs) from physical volumes (PVs). Here are some LVM-related commands:
Checking Existing LVM:
领英推荐
Creating LVM Logical Volumes:
sudo vgcreate myvg /dev/sdc
sudo lvcreate -n mylv -L 5G myvg
Growing LVM Logical Volumes:
sudo lvextend -L +2G /dev/myvg/mylv
sudo resize2fs /dev/myvg/mylv
Mounting Filesystems
sudo mount /dev/sdb1 /mnt/data
Swap Areas
sudo mkswap /dev/sdb2
sudo swapon /dev/sdb2
Creating a Filesystem with mkfs
sudo mkfs.ext4 /dev/sdb1
Remember to adjust the commands and paths according to your specific setup. Feel free to explore more options and dive deeper into each topic! ??
DevOps Engineer ??
10 个月Bhupesh Patil Very useful thanks for sharing ??