Add New Disk in Linux

Check Disk is installed

fdisk -l|grep Disk

Partition Disk

Assuming new disk is sdc

fdisk /dev/sdc

Commands

p - to print the partition table
n - to create new
w - to write

Make file system

Assume you created a single partition on sdc1

mkfs -t ext4 /dev/sdc1

Reserve 1% for root

tune2fs -m 1 /dev/sdc1

Create file system

Create Mount directory

mkdir /home1

Get Disk UUID

blkid|grep /dev/sdc1

Make entry in fstab to automount

Add line to /etc/fstab:
# New 2 TB Hard Disk
UUID=d1bff2fd-537b-40fb-8981-cb59bd8e1221 /home1          ext4    defaults        0       2

Mount with

mount -a

Check with

df -Ph

Test with

dd if=/dev/urandom of=/home1/sample.txt bs=1G count=1

QR Code
QR Code tech:linux:new_disk (generated for current page)