Adding Backup Drives to CentOS 7 cPanel Server

This guide will help you to Add a New backup disk to an Existing Linux / CentOS 7 / Cloudlinux Server

let’s get started

1/ execute the following command to view and manage hard disks and partitions on Linux systems.

root@ds77 [~]# fdisk -l

you should see the following output

[root@ds77 /]# fdisk -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x7e0b4176

Disk /dev/sda: 480.1 GB, 480103981056 bytes, 937703088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 44778DB5-745C-6942-A930-F786324DC74C

Disk /dev/sdb: 1000.2 GB: this is SATA disk that I want to make as a /backup
Disk /dev/sda: 480.1 GB : this is the main SSD disk

2/ go to Create a directory mkdir /backup inside the root

root@ds77 /]# mkdir backup

you should see the following output

[root@ds77 /]# ls
backup  bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  quota.user  razor-agent.log  root  run  sbin  scripts  srv  sys  tmp  usr  var

3/ let’s make the partition on /dev/sdb by executing the following command

root@ds77 [~]# fdisk /dev/sdb

you should see the following output

[root@ds77 /]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x2c6fc8a9.

Command (m for help):

next start from partitioning the new disk
Use the following order

Enter -> “n” key for new partition
Enter -> “p” key for primary partition
Enter -> “1” key for the first partition
Enter key -> first cylinders then again Enter key -> for last cylinders (automatically use the entire disk)
Enter -> “w” key to save what you have done and exit

executing following command verifies the partition

root@ds77 [~]# fdisk /dev/sdb

you should see the following output

[root@ds77 /]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x7e0b4176

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  1953525167   976761560   83  Linux

4/ Now you can see that we’ve added a partition to the drive, Now that our disk is partitioned to sdb1 we’ll need to format it.

The next step is to format the disk with mkfs command. executing following command

[root@ds77 /]# mkfs.ext4 /dev/sdb1

5/ Once formatting has been completed, now mount the partition as shown below.

[root@ds77 /]# mount /dev/sdb1 /backup

6/ If we want that partition to be mounted permanently, it will be necessary to edit the file /etc/fstab

1st Determine the UUID of a Particular Device, executing the following command

root@ds77 [~]# blkid /dev/sdb1
/dev/sdb1: UUID="6ac1e57c-060d-46a2-ae60-dcefca495f3b" TYPE="ext4"
root@ds77 [~]# vi /etc/fstab

add the following line to Make an entry in /etc/fstab file for the permanent mount at boot time.

# /dev/sdb1
UUID=6ac1e57c-060d-46a2-ae60-dcefca495f3b    /backup    ext4    defaults  0    0

That’s it! You’ve just added a new hard drive to your server

Leave a Comment

+ 83 = 89