Posted On August 24, 2021

Linux: Commands to Add a New Disk

kimconnect 0 comments
blog.KimConnect.com >> Linux >> Linux: Commands to Add a New Disk
# Step 1: create partitioning table (gpt or msdos/mbr)
device=/dev/sdc
sudo parted $device mklabel gpt

# Step 2: Create primary partition and reserve the whole disk toward it
device=/dev/sdc
sudo parted -a opt $device mkpart primary ext4 0% 100%

# Step 3: Creating an ext4 file system
partition=/dev/sdc1
label=data
mkfs.ext4 -L $label $partition

# Optional: Change disk label
# partition=/dev/sdc1
# label=data
# e2label $partition data

# Step 4: Mount the new partition
mount=/media/data
partition=/dev/sdc1
mkdir -p $mount # create new mount point
mount $partition $mount # mounting partition toward new target mount point

# Add this line to /etc/fstab
LABEL=data /media/data ext4 defaults 0 2

# Reload mounts
mount -a

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Step by Step Kubernetes Application Hosting: Persistent Storage, Pod Creation, Deployment Plan, Service Clustering, and Ingress Routing

Overview Update: we have a new article which goes directly into a production-style setup of…

Set Automatic Updates for CentOS & Redhat

Easy. yum -y install yum-cron vimvim /etc/yum/yum-cron.conf----------apply_updates = yes----------systemctl start yum-cron.service

How to Install OpenVPN on Centos 5

Configure VPN   I. Setting up DMZ to forward all ports from Gateway to Router…