Linux Single File Restore (SFR) Using Netapp VSC (FlexClone)

By | November 10, 2014

One of the things that I love about Netapp is the snapshot and flexclone capabilities. fast backups and fast restores.
The problem that if you want to restore the WHOLE VM then it’s a simple process (the Netapp VSC provides a simple way to do this) but the single file restore has always seemed a bit hodgepodge, especially on Linux.

I wanted to share the process and scripts that I created to restore single file inside of Linux (RHEL systems that uses LVM and ext4 filesystems) just to save someone out there some time.
NOTE: I take no responsibility for the use of any of these scripts in your environment! Please thoroughly read the scripts and test to see if it fits with your setup.

Process to Attach Disks

  1. Right Click on the VM and Choose Netapp -> Backup and Recovery -> Mountrestore1
  2. Choose the backup that you want to mount and the ESXi host that the VM you want to restore the files on is located and click Mountrestore2
  3. Right Click the VM and choose Edit Settings
    restore3
  4. Choose Add, Hard Disk, Use an Existing Virtual Disk
    restore4
    restore6
  5. Choose the datastore that was just mounted (it should have the date of the snapshot in it), choose the folder of the VM, choose a vmdk (the script below assumes all vmdks are attached)
    restore7
    restore8
    restore9
  6. Click Next->Next->Finish
    restore10
    restore11
    restore12
  7. You will see a new disk added, repeat the steps above to add the rest of the disks
    restore13
  8. Click OK on the Edit Hardware screen

Process to scan and mount disks

  1. Run the mount_recovery script
    restore14
  2. Answer y and press enter
    1. Import the vgs with word “clone” appended to it
    2. Activate the vgs
    3. Activate the LVs
    4. Convert labels to device names
    5. Match the original devices with the backup devices
    6. Use sed to replace the original and backup devices as well as the original and clone volume groups
    7. Mount the ext filesystems under /mnt/<servername>/root
      restore15
  3. Copy the files that you want to recover
  4. Run the umount_recovery script, this will do the following
    1. Unmount all of the filesystems under /mnt/<servername>
    2. Deactivate all of the clone logical volumes
    3. Deactivate all of the clone volume groups
      restore16

Process to Detach Disks

  1. Edit the VM’s hardware
  2. Select the backup hard disk
  3. Click Remove
  4. Repeat steps 2-4 for all backup hard disks
  5. Click OK (the os SHOULD clean up all device files)
  6. Right Click the VM ->Netapp -> Backup and Recovery -> Unmount
    restore17
  7. Choose the backup to unmount and click unmount
    restore18

 

mount_recovery script

umount_recovery

2 thoughts on “Linux Single File Restore (SFR) Using Netapp VSC (FlexClone)

  1. Ubuntu newbie

    Hi Chris,

    Sorry I am probably doing something very daft but the script that you have posted, should that work just as it is or are there certain sections that need changing depending on our environment?

    Craig

    Reply
  2. Chris Post author

    It’s been a while, but is assumes that every disk has a LVM partition, that you are using ext3, and that uuids are not used in fstab.

    If you post your fstab, fdisk -l vgdisplay and lvdisplay maybe i can figure out what’s going on.

    Reply

Leave a Reply to Chris Cancel reply

Your email address will not be published. Required fields are marked *