Extending Backup Repository on Virtual Appliance

Product version: 10.3

Last modified: 11 May 2021

Question

How can I extend a Backup Repository on a Linux Virtual Appliance with NAKIVO Backup & Replication?

Answer

If you are using the Virtual Appliance (VA) that originally came with v4.1.x or later, refer to the Increasing Backup Repository Size on a Virtual Appliance topic.

If you are using the Virtual Appliance (VA) that originally came with v4.0.x or earlier, refer to the information below.

Example 1: Extending the Onboard repository by adding a new disk

  1. Log in to the vSphere Client and add a new hard drive to the VA.

  2. Log in to the NAKIVo Backup & Replication VA. The default credentials are root/root

  3. The df -h -T command shows you the filesystem and mount point of the Onboard Backup Repository, for example:

    /dev/mapper/Volume_Group_Backup_Repository_500GB-Logical_Volume_Backup_Repository_500GB  511G   70M  491G   1% /opt/nakivo/repository

  4. Rescan the SCSI bus for new hardware by executing the following commands:

    1. cat /proc/partitions and note the list of devices. Note that the Onboard Backup Repository resides on an sdb device.

    2. apt-get install scsitools

    3. rescan-scsi-bus

    4. cat /proc/partitions and see which devices have been added. For example, an sdc device will be found.

  5. Create a partition on the new disk by executing the following commands:

    1. fdisk /dev/<new device>, for example, fdisk /dev/sdc

    2. Command (m for help) – type m to see all options.

    3. Type n to create a new partition.

    4. Type p to create a primary type of partition.

    5. Type 1 to create the first partition.

    6. Press Enter to select default values for the first and last sectors.

    7. Type t to change the partition’s system id.

    8. Hex code (type L to list codes): Type 8E corresponding to the Linux LVM id.

    9. Type w to write table to disk.

    10. Type the command partprobe to inform the operating system about partition table changes.

    11. Type cat /proc/partitions to verify that the new partition has been created. For example, you have to see sdc1.

  6. Extend the existing LVM structure by executing the following commands:

    1. Type pvcreate /dev/<new partition>.For example, pvcreate /dev/sdc1 to create a physical volume.

    2. Type pvdisplay to verify that a physical volume has been created.

    3. Type vgextend Volume_Group_Backup_Repository_500GB /dev/sdc1 for extending the volume group called Volume_Group_Backup_Repository_500GB.

    4. Type vgdisplay to verify that the volume group has been extended.

    5. Type lvdisplay to see what logical volumes exist. Note that only logical volume called Logical_Volume_Backup_Repository_500GB exists within the VA.

    6. Type lvextend -l+100%FREE /dev/Volume_Group_Backup_Repository_500GB/Logical_Volume_Backup_Repository_500GB to extend the logical volume.

    7. Type resize2fs /dev/mapper/Volume_Group_Backup_Repository_500GB-Logical_Volume_Backup_Repository_500GB to extend the filesystem.

    8. Type df -h -T to verify that the repository size has been increased.

Example 2: Extending the Onboard repository by extending the current disk

  1. Log in to vSphere Client and extend the existing disk of the virtual machine.

  2. Log in to NAKIVO Backup & Replication VA. The default credentials are root/root

  3. The df -h -T command shows you the filesystem and mount point of the Onboard Backup Repository, for example:
    /dev/mapper/Volume_Group_Backup_Repository_500GB-Logical_Volume_Backup_Repository_500GB 511G 70M 491G 1% /opt/nakivo/repository

  4. Rescan the SCSI bus for new hardware by executing the following commands:

    1. cat /proc/partitions and note the list of devices. Note that the Onboard Backup Repository resides on an sdb device.

    2. apt-get install scsitools

    3. rescan-scsi-bus

    4. cat /proc/partitions and see which devices have been added. For example, you will see an sdb device, sdb1 partition and free space added to the sdb device.

    5. Note
      If the command rescan-scsi-bus does not identify the free space, run the following commands:

      1. apt-get install lsscsi

      1. lsscsi – the output will be the follwoing:

        [1:0:0:0] cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0
        [2:0:0:0]diskVMware   Virtual disk 1.0   /dev/sda
        [2:0:1:0]diskVMware   Virtual disk 1.0   /dev/sdb

      2. Rescan the sdb device by executing the following command: 

      3. echo 1 > /sys/bus/scsi/devices/2\:0\:1\:0/rescan

      4. Execute dmesg | grep change – for example, the output can be:

        [91503.909069] sdb: detected capacity change from 558345748480 to 590558003200

  5. Create the second partition on the free space added to the sdb device by executing the following commands:

    1. fdisk /dev/sdb

    2. Command (m for help) – type m to see all options.

    3. Type n to create a new partition.

    4. Type p to create a primary type of partition.

    5. Type 2 to create the second partition, for example, sdb2.

    6. Press Enter to select the default values for first and last sectors.

    7. Type t to change the partition’s system id.

    8. Type 2 to choose the second partition.

    9. Hex code (type L to list codes) – Type 8E corresponding to the Linux LVM id.

    10. Type w to write table to disk.

    11. Type the command partprobe to inform the operating system about partition table changes.

    12. Type cat /proc/partitions to verify that a new partition has been created, for example, you have to see sdb2.

  6. Extend the existing LVM structure by executing the following commands:

    1. Type pvcreate /dev/<new partition> for example, pvcreate /dev/sdb2 to create a physical volume.

    2. Type pvdisplay to verify that the physical volume has been created.

    3. Type vgextend Volume_Group_Backup_Repository_500GB /dev/sdb2 to extend the volume group called Volume_Group_Backup_Repository_500GB.

    4. Type vgdisplay to verify that the volume group has been extended.

    5. Type lvdisplay to see which logical volumes exist. Note that only logical volume called Logical_Volume_Backup_Repository_500GB exists within the VA.

    6. Type lvextend -l+100%FREE /dev/Volume_Group_Backup_Repository_500GB/Logical_Volume_Backup_Repository_500GB to extend the logical volume.

    7. Type resize2fs /dev/mapper/Volume_Group_Backup_Repository_500GB-Logical_Volume_Backup_Repository_500GB to extend the filesystem.

    8. Type df -h -T to verify that the repository size has been increased.

Example 3: Adding a separate disk and creating another Backup Repository

  1. Optionally, remove the Onboard Backup Repository from the VA. Do this if the onboard repository is not needed anymore or if you need to reuse the existing disk that the onboard repository resides on for the new backup repository.

  2. Log in to the vSphere Client and add a new hard drive disk to the virtual machine

  3. Rescan the SCSI bus for new hardware by executing the following commands:

    1. cat /proc/partitions and note the list of devices. Note that the Onboard Backup Repository resides on an sdb device.

    2. apt-get install scsitools

    3. rescan-scsi-bus

    4. cat /proc/partitions and see which devices have been added. For example, an sdc device will be found.

  4. Create a partition on the new disk by executing the following commands:

    1. fdisk /dev/<new device>, for example, fdisk /dev/sdc

    2. Command (m for help) – type m to see all options.

    3. Type n to create a new partition.

    4. Type p to create a primary type of partition.

    5. Type 1 to create the first partition.

    6. Press Enter to select the default values for the first and last sectors.

    7. Type t to change the partition’s system id.

    8. Hex code (type L to list codes): Type 8E corresponding to the Linux LVM id.

    9. Type w to write table to disk.

    10. Type the command partprobe to inform the operating system about partition table changes.

    11. Type cat /proc/partitions to verify that the new partition has been created. For example, you have to see sdc1.

  5. Create a new LVM structure on the newly created partition by executing the following commands:

    1. pvcreate /dev/sdb1

    2. pvdisplay to verify that the physical volume has been created.

    3. vgcreate Volume_Group_Name /dev/sdb1

    4. vgdisplay to  verify that the volume group has been created.

    5. lvcreate -l 100%FREE -n Logical_Volume_Name Volume_Group_Name

    6. lvdisplay to verify that the logical volume has been created.

  6. Create a filesystem on the LVM structure:

    mkfs -t ext4 /dev/Volume_Group_Name/Logical_Volume_Name

  7. Create a mount point:

    cd /mnt,
    mkdir repository

  8. Mount your LVM to /etc/fstab file as follows:

    1. Edit the file fstab:

      nano /etc/fstab

    2. Add the following line:

      /dev/Volume_Group_Name/Logical_Volume_Name /mount_point ext4 defaults 0 2, where mount_point stands for instance /mnt/repository

    3. Execute mount -a that will make LVM bootable

    4. The df -h -T command shows you the filesystem and mount point of your Backup Repository.

  9. Give proper permissions to the repository mount folder:

    1. chmod -R 770 /mnt/repository

    2. chown -R bhsvc:bhsvc /mnt/repository

  10. Add the backup repository to the NAKIVO Backup & Replication UI using the following path: /mnt/repository

Example 4: Adding a new HDD which is larger than 2 TB

  1. Log into vSphere Client and add a new hard drive disk to the NAKIVO Backup & Replication VA.

  2. Log into Nakivo VA using root/root credentials.

  3. Rescan the SCSI bus for new hardware by executing the following commands:

    1. cat /proc/partitions and note the list of devices. Note that the Onboard Backup Repository resides on an sdb device.

    2. apt-get install scsitools

    3. rescan-scsi-bus

    4. cat /proc/partitions and see which devices have been added. For example, you will see a sdc device.

  4. Create a partition on the new disk by executing the following commands:

    1. parted /dev/<new device>, for example, sdc

    2. mklabelgpt (type Yes)

    3. unit TB

    4. mkpart primary 0 100%. You will see the warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? You can type Ignore or use sections 1, 2, and 3 of this article.

    5. print

    6. quit 

    7. type cat /proc/partitions to verify that a new partition has been created. For example, you will see sdc1

  5. Extend the existing LVM structure by executing the following commands:

    1. pvcreate /dev/<new partition>, for example, sdc1 for creating a physical volume.

    2. pvdisplay to verify that pv has been created.

    3. vgextendVolume_Group_Backup_Repository_500GB /dev/sdc1 to extend the volume group called Volume_Group_Backup_Repository_500GB

    4. vgdisplay to verify that vg has been extended.

    5. lvdisplay to see what logical volumes exist. Note that only lv called Logical_Volume_Backup_Repository_500GB exists within the VA

    6. lvextend -l +100% FREE /dev/Volume_Group_Backup_Repository_500GB/Logical_Volume_Backup_Repository_500GB to extend the logical volume

    7. resize2fs /dev/mapper/Volume_Group_Backup_Repository_500GB-Logical_Volume_Backup_Repository_500GB to extend the filesystem ext4

    8. df -h -T to verify that the repository size has been increased.

Example 5: Removing Onboard repository and replacing with a separate storage larger than 2 TB

  1. Remove the Onboard Backup Repository from the VA.

  2. Log in to the vSphere Client and add a new hard drive disk to the NAKIVO Backup & Replication VA.

  3. Log in to the NAKIVO Backup & Replication VA using root/root credentials.

  4. Rescan the SCSI bus for new hardware by executing the following commands:

    1. cat /proc/partitions and note the list of devices.

    2. apt-get install scsitools

    3. rescan-scsi-bus

    4. cat /proc/partitions and see which devices have been added. For example, you will see an sdb device.

  5. Create a partition on the new disk by executing the following commands:

    1. parted /dev/<new device>, for example, sdb

    2. mklabel gpt (type Yes)

    3. unit TB

    4. mkpart primary 0 100%
      You will see the warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? You can type Ignore or use sections 1,2 and 3 of this article.

    5. print

    6. quit

    7. type cat /proc/partitions to verify that a new partition has been created. For example, you will see sdb1

  6. Create an LVM structure on the newly created partition by executing the following commands:

    1. pvcreate /dev/sdb1

    2. pvdisplay to verify that pv has been created.

    3. vgcreate Volume_Group_Name /dev/sdb1

    4. vgdisplay to verify that vg has been created.

    5. lvcreate -l 100%FREE -n Logical_Volume_Name Volume_Group_Name

    6. lvdisplay to verify that lv has been created.

  7. Create filesystem on the LVM: mkfs -t ext4 /dev/Volume_Group_Name/Logical_Volume_Name

  8. Mount your LVM to /etc/fstab file

    1. Edit the file fstab: nano /etc/fstab

    2. Add the following line: /dev/Volume_Group_Name/Logical_Volume_Name /mount_point ext4 defaults 0 2

    3. To create a mount point you have to go to mnt  directory (for example, cd /mnt) and create a folder repository: mkdir repository

    4. execute mount -a to make LVM bootable.

    5. execute df -h -T to see the filesystem and mount point of your Backup Repository.

  9. Give proper permissions to the repository folder.

    1. chmod -R 775 /mnt/repository

    2. chown -R bhsvc:bhsvc /mnt/repository

Add the Backup Repository to the NAKIVO Backup & Replication UI using the path /mnt/repository.