How to prepare a local disk or partition for backups in WHM?

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 in preparation for using it as a local backup directory when enabling backups in WHM

Watch the video tutorial on How to prepare a local disk or partition for backups in WHM.

If you don’t want to watch the video tutorial, skip and proceed with the text version mentioned below.

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

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

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 disk we are interested in is the vdb disk, which is represented in the system
as /dev/vdb. We can confirm this with the fdisk -l command:

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. Partition the disk Once we have confirmed the specific disk we want to use (/dev/vdb in this example), we can then use the fdisk /dev/vdb command to partition it.

Code:
# fdisk /dev/vdb

As soon you execute this command you will a description of each manual entry is available 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 get asked the type of partition we want.

How to prepare a local disk or partition for backups in WHM
How to prepare a local disk or partition for backups in WHM

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

How to prepare a local disk or partition for backups in WHM
How to prepare a local disk or partition for backups in WHM

• The fdisk command is going to ask for the first, and final sectors. We can press enter when asked for the first sector, and enter when asked for the final sector to use the entire disk.

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

How to prepare a local disk or partition for backups in WHM
How to prepare a local disk or partition for backups in WHM

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

How to prepare a local disk or partition for backups in WHM
How to prepare a local disk or partition for backups in WHM

Step 3. Create the filesystem We now have a partition, and we need to format the partition with the mkfs.ext4 command so it has a valid ext4 filesystem:

How to prepare a local disk or partition for backups in WHM
How to prepare a local disk or partition for backups in WHM

Command:

Code:

# mkfs.ext4 /dev/vdb1

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

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 backups in WHM
How to prepare a local disk or partition for backups in WHM

Note: The above was a manual mount, and should the server reboot it won’t be mounted back when the system boots. For the disk to be automounted, we need to first open the /etc/fstab file in a command line text editor (e.g. 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 backups in WHM
How to prepare a local disk or partition for backups in WHM

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

That’s all, You are done!!!

Hope this helps!!!

For more information, kindly follow us on social media like Twitter and Facebook and for video tutorials, subscribe to our YouTube channelhttps://youtube.com/redserverhost.com

Facebook Page- https://facebook.com/redserverhost

Twitter Page- https://twitter.com/redserverhost.com

If you have any query, feel free to let us know via the comments section below.

Thanks for Reading!!!

Tags: cheap linux hostingbuy linux hostingcheap reseller hostingbuy reseller hostingbest reseller hostingcheap web hostingcheapest web hostingcheapest reseller hosting,  cheap reseller hostcheap linux hostcheapest linux hostingbest linux hostingbest web hosting