How to add new partition (when we add new hard disk) in linux server

How to add new partition (when we add new hard disk) in linux server

Step 1
lsblk

Step 2
Check the newly add harddisk label mostly sdb or sdc

Step 3
parted /dev/sdb

Step 4
mklabel gpt

it will ask for yes and no enter yes

Step 5
mkpart primary xfs 0% 100%

this will make a partition

Step 6

sudo mkfs.ext4 /dev/sdb1

format the partition to ext4

Step 7

sudo mkdir /mnt/disk

we will create a folder now to mount partition

Step 8

sudo mount /dev/sdb1 /mnt/disk/

now we mount the partition

Step 9

df -h

Finally, check the mount point using this command:

Step 10

sudo blkid

First, retrieve the UUID (block ID) of the new volume:

Step 11

UUID=2e4a9012-bf0e-41ef-bf9a-fbf350803ac5 /mnt/disk ext4 nofail 0 0

in /etc/fstab edit the uuid to the disk uuid we get from step 9 and upload the file

that’s it