How to prepare a local disk or partition for backups in WHM? Serverhosthub – The Hosting Platform Made For You – Go Online With Hosting serverhosthub | free hosting | Linux shared hosting | Hosting | Free domain | Life time Free ssl certificate | Chepest web hosting | Low price hosting | Domain Transfer

How to prepare a local disk or partition for backups in WHM? [STEP BY STEP]️

In this tutorial, we’ll explore how to configure a disk or partition to be used as a local backup directory when enabling backup in WHM.

Watch this video tutorial on how to prepare a local disk or partition for backup in WHM.

If you don’t want to watch the video tutorial, skip to the text version below and move on.

Step 1. lsblk, and fdisk. Detect and identify hard drives from the command line using

Let’s take a look at the disks available on a test server. using the lsblk command, I can see the result below:

Code:

# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda    253:0    0   20G  0 disk
└─vda1 253:1    0   20G  0 part /
vdb    253:16   0    5G  0 disk
loop0    7:0    0  500M  0 loop /var/tmp

The disc we are interested in is vdb Disk, which is represented in the system
As /dev/vdb. we can confirm fdisk -l Order:

Code:

# fdisk -l

Disk /dev/vdb: 5368 MB, 5368709120 bytes, 10485760 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

Step 2. Partitioning the Disk Once we have confirmed the specific disk we want to use (/dev/vdb in this example), we can use the fdisk /dev/vdb command to partition it can.

Code:

As soon as you execute this command, you will get the details of each manual entry under the code block.

Code:

# fdisk /dev/vdb
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 0x48285897.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-10485759, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759):
Using default value 10485759
Partition 1 of type Linux and of size 5 GiB is set
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

We are interested in the ‘n’ option, after pressing ‘n’ on the keyboard we are asked what type of division we want.

How to Prepare a Local Disk or Partition for Backup in WHM
How to Prepare a Local Disk or Partition for Backup in WHM

• Because we are using an entire disk for backup, with only one partition we are using the letter ‘p’ to create the primary partition.

How to Prepare a Local Disk or Partition for Backup in WHM
How to Prepare a Local Disk or Partition for Backup in WHM

• The fdisk command will ask for the first and last sectors. We can press Enter when asked for the first sector, and we can press Enter when the last sector is asked to use up the entire disk.

• We have to press ‘w’ key to write changes to the partition.

How to Prepare a Local Disk or Partition for Backup in WHM
How to Prepare a Local Disk or Partition for Backup in WHM

Now we have our disk partitioned, and we can see vdb1 using the lsblk command:

How to Prepare a Local Disk or Partition for Backup in WHM
How to Prepare a Local Disk or Partition for Backup in WHM

Step 3. Create the File System Now we have a partition, and we need to format the partition with the mkfs.ext4 command so that it has a valid ext4 file system:

How to Prepare a Local Disk or Partition for Backup in WHM
How to Prepare a Local Disk or Partition for Backup in WHM

Order:

Code:

# mkfs.ext4 /dev/vdb1

Step 4. /etc/fstab . Configure the partition/disk to be mounted appropriately with

We can mount the disk on the /backup directory with the mount command:

Code:

# mount -t ext4 /dev/vdb1 /backup/
How to Prepare a Local Disk or Partition for Backup in WHM
How to Prepare a Local Disk or Partition for Backup in WHM

Note: The above was a manual mount, and if the server must reboot it will not be mounted back when the system boots. To automate disk, we first need to open the /etc/fstab file in a command line text editor (eg vi, nano):

Code:

# vi /etc/fstab

Then, add the following line to the end of this file and save:

Code:

 /dev/vdb1 /backup ext4 defaults,noauto 0 0
How to Prepare a Local Disk or Partition for Backup in WHM
How to Prepare a Local Disk or Partition for Backup in WHM

The above entry specifies the following: The partition we created is /dev/vdb1

That’s it, you’re done!!!

hope this helps!!!