• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / Linux sysadmin tutorials linux system administrator / how to add a new disk in linux

how to add a new disk in linux

When you add a new physical disk to a Linux system, you need to format, partition, and mount it before use. Here’s a step-by-step guide:


Table of Contents

Toggle
    • ✅ Summary of Commands
  • Step 1: Identify the New Disk
  • Step 2: Create a New Partition
  • Step 3: Format the New Partition
  • Step 4: Create a Mount Point
  • Step 5: Mount the New Disk
  • Step 6: Auto-Mount on Reboot (Persistent Mount)
  • Step 7: Set Permissions (Optional)

✅ Summary of Commands

Task Command
Check available disks lsblk or fdisk -l
Open fdisk sudo fdisk /dev/sdb
Create partition n → p → w in fdisk
Format partition sudo mkfs.ext4 /dev/sdb1
Create mount point sudo mkdir /mnt/newdisk
Mount disk sudo mount /dev/sdb1 /mnt/newdisk
Auto-mount (permanent) Add entry in /etc/fstab

Step 1: Identify the New Disk

After attaching a new disk, check if the system recognizes it:

lsblk

or

sudo fdisk -l

🔹 Look for a device like /dev/sdb (assuming it’s the new disk).

If the disk is not detected, refresh the disk list:

sudo partprobe

or

sudo rescan-scsi-bus

Step 2: Create a New Partition

Use fdisk to create a partition:

sudo fdisk /dev/sdb

Inside fdisk:

  1. Press n → Create a new partition.
  2. Press p → Select Primary partition.
  3. Choose the partition number (default: 1).
  4. Specify the size (e.g., +20G for 20GB).
  5. Press w → Save changes.

Verify the partition:

lsblk

Now, you should see /dev/sdb1.


Step 3: Format the New Partition

Format the partition with a filesystem (e.g., ext4):

sudo mkfs.ext4 /dev/sdb1

For XFS:

sudo mkfs.xfs /dev/sdb1

Step 4: Create a Mount Point

Choose a directory where you want to mount the disk:

sudo mkdir /mnt/newdisk

Step 5: Mount the New Disk

Manually mount the partition:

sudo mount /dev/sdb1 /mnt/newdisk

Verify:

df -hT

Step 6: Auto-Mount on Reboot (Persistent Mount)

To make the mount permanent, add an entry in /etc/fstab:

sudo blkid /dev/sdb1

🔹 Note the UUID, then edit /etc/fstab:

sudo nano /etc/fstab

Add this line at the end:

ini
UUID=your-uuid /mnt/newdisk ext4 defaults 0 2

Save and exit. Apply changes:

sudo mount -a

Step 7: Set Permissions (Optional)

If needed, change ownership:

sudo chown -R $USER:$USER /mnt/newdisk

or set permissions:

sudo chmod -R 755 /mnt/newdisk

 

Primary Sidebar

Linux sysadmin tutorials linux system administrator

  • top 10 apt & apt-get commands (most used) apt vs apt-get
  • If-Else Statements in Shell Scripting
  • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • Find Files with Specific Text on Linux grep find command
  • linux performance tuning inode limit file descriptors tco, kernel etc
  • Variables and Data Types in Shell Scripting
  • Top 10 most used Cat commands with examples (create, view, append files)
  • Ip tables / ufw / firewall d commands for block port ip rate limiting
  • Top 10 zip / tar commands to compress & extract files in linux
  • TOP 10 mv & cp commands in linux to move & copy files in Linux
  • Top 10 GREP Commands in linux to search files directory words strings
  • lsof netstat commands to know listening ports in linux 3 ways
  • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
  • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
  • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
  • linux sysctl command tweaks & hardening
  • linux security limits.conf deciding user limits process limits for nginx server
  • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
  • red hat linux certification cost jobs salary syllabus courses fees
  • ufw firewall commads allow port enable disable ubuntu 20.04
  • ddos attack prevention
  • change ssh port in linux - avoid sshd ddos attacks
  • ping command
  • memcached install ubuntu wordpress
  • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
  • rsync command linux with examples comparison to scp
  • how to uninstall package in linux ubuntu rpm, yum apt-get
  • increase open file limit linux File descriptor ft nginx , mysql, lemp
  • remove repository ubuntu
  • htop commad memory details virtual vs shard vs resident
  • chown command in Linux with Examples
  • Kill PHP process
  • VIrtual Memory vs RSS Memory vs Shared memory in Linux
  • oom killer fixing it by configuration linux ubuntu
  • Install Lemp nginx mysql php fpm Stack on Debian 11 with repository
  • connect two remote servers linux command line
  • auto start after oom killer Mysql & php fpm nginx etc ubuntu wth systemd or cron job
  • load average Linux 1, 5, 15 min 2,4,8 cores explained
  • Control Structures in Shell Scripting
  • Shell Scripting Roadmap for Beginners to Advanced
  • awk commands with practical examples
  • Shell Scripting Tutorial for Beginners 🚀
  • find Command in Linux with Examples
  • sed Command in Linux with Examples (Beginner to Advanced)
  • Linux Text processing commands in with Examples
  • linux disk management commands
  • fdisk command in linux with examples
  • how to add a new disk in linux
  • Linux mount Command with Examples
  • fstab options with examples
  • Top 50 Shell Scripting Interview Questions and Answers
  • Linux Networking Interview Questions and Answers
  • Linux Networking Commands Cheat Sheet with Examples pdf
  • Netstat & SS Commands cheat sheet with examples Interview Questions
  • Nmap Cheat Sheet – Network Scanning & Security
  • Bash Brackets ([], (), {}, $( ), $(( ))) – Types, Uses & Examples

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy