Skip to main content

Commvault Restores

Commvault Restores

Commvault restore types:

MySQL Restores

File level restores

VPC Restores

====================================================================================

MySQL Restores

There are 2 types of database restore we can look to perform through commvault, depending on the type of backups in use.

If the client has MySQL level backups, see here

If the client only had file-level backups, see here

====================================================================================

MySQL level backups

Starting the restore job

Commgui > Client Servers > Ctrl+F > Search SID > Double Click MySQL > Double Click SID   

Right click > All tasks > browse and restore > Untick Recover > Select Required Date using end time  

Select Required Database from the list > Recover Selected 

Post-restore action

Replaying bin logs  

cp –a DBNAME DBNAME.sql  

Check disk space before replaying 

mysqlbinlog -v --database="DBNAME" RESTOREPATH/BINFILENAME.* >> RESTOREPATH/DBNAME.sql 

Once the bin logs have been replayed, we need to remove USE staments:

grep -i ^USE DBNAME
sed -i '/^[uU][sS][eE] /d' DBNAME

Replaying bin logs to a certain time: 

https://kb.ukfast.net/MySQL#Bin_Logs 

  Once the bin logs have been been replayed, we can look to remove the bin logs and older db copy  

------------------------------------------------------------------------------------------------------------------------------------------  

Restoring a specific table from DB level backups 

------------------------------------------------------------------------------------------------------------------------------------------  

Identify the line number of the desired table in the dump file: 

grep -in 'dumping data for' dumpfile.sql 

Next, we need to remove the lines before and after the desired table 

sed -i '10611,28206d' m2meandemcom.sql 

The 2 numbers here are the line number of the next table (shown in the original grep command) and the final tables line number (also in the dump) 

Next we do the same for the table line numbers before the one we need: 

sed -i '51,10581d' m2meandemcom.sql 

 ====================================================================================

File level database restore

====================================================================================

File Level Restores

====================================================================================

eCloud VPC Restores

------------------------------------------------------------------------------------------------------------------------------------------  

Commvault VM Level Backup Restore:  

CommGUI > Client Computers > ctrl+f > VM ID/VPC Instance ID > right click > browse and restore > Full Virtual Machine > Select End time  (if required) > Browse > Select VM > Restore full VM  >  Select Restore DataStore, change name to VMID_TICKETNUMBER> Go  

Vmware > search for restore VM (VMID_Ticket)  

Edit settings (along the top)  

    1. Disable Networking

    vSphere > VM > Edit Settings > Network Adapter > Disable 'Connect at power on'

    2. Power on restore VM

    vSphere > VM > Actions > Power > Power On

    3. Add swing disk

    Confirm how much space you will require for a swing disk to be used to move data over to the live VM.

    vsphere > VM > Edit Settings > Add New > Hard Disk > OK

    Once the disk has been added in vSphere, you'll need to configure this on the server.

    Use mkfs to initialise the disk filesystem.

    mkfs /dev/sdX

    Mount the disk once configured.

    mount /dev/sdX /mnt

    4. Move requested data onto disk

    Add5. Unmount the disk sizefrom ofrestore restore  VM

    Power'Once the data has been moved onto the disk, unmount the disk from the server filesystem:

    umount /mnt

    And, unmount the disk from the restore VM within vSphere

    vSphere > Edit Settings > X symbol next to disk we've added. Don't click 'Delete files from datastore'.

    5. Transfer the disk to the live VM

    Mount disk on live VM in vSphere

    Edit Settings > Add New Device > Existing Hard Disk > Datastores > Restores > Identify restore VM VM > Add restore swing disk

    Mount the disk on live server filesystem

    mount /dev/sdX /mnt

    6. Move file away from swing disk, into the required location for the client

    Add7. newClean disk onto server: up 

    Lsblk - find disk name 

    Mkfs /dev/(device name) 

    Mount /dev/sdb /mnt 

    Move desired files into restore directory  

    Unmount the disk from serverthe throughlive vSphere VM 

    Open main server in vSphere  

    Add disk > existing disk > choose from restore datastore  

    Log onto server > expand disk onto fs  

    Mkdir /restore_ticketno 

    Mount

    umount /dev/
    diskname  /restore_ticketno 

    Move files off mounted disk onto server 

    Umount /dev/diskname  

    Once done, 

    Vsphere > edit settings > remove disk >   

    Delete the restore VM
    vSphere > Restore VM > Actions > Delete from disk > yes

    ------------------------------------------------------------------------------------------------------------------------------------------  

    Removing Restore  

      

    Once the client has finished with the restore, the disk will need to be unmounted from the server and the restore VM can be deleted.  

      

    SSH onto client VPC > df –h > check for /restore > umount /restore  

      

    Once the disk has been unmounted:  

      

    Vmware > Client VM >  Edit Settings > Restore Disk > Remove (X on right side)  

      

    Now delete the Restore VM:  

      

    Vmware > restore VM > Power Off > Actions > Delete From Disk  

      

    ------------------------------------------------------------------------------------------------------------------------------------------  

    Attach disk 

    Access restored server 

    Lsblk - find device name 

    Mkfs /dev/(device name) 

    Mount /dev/(devicename) /mnt 

     

    Main server > edit settings > attach device > existing disk > find disk 

    On server: 

    Mount /dev/(devicename) /mnt 

    Move restored files onto server