Wednesday, October 17, 2007

VMware over NFS: Backup tricks...continued

There have been a couple of questions on how to do file level backups of a Linux vmdk over NFS. I described the process for a Windows vmdk in a previous article here

In order to do this for a Linux vmdks you need to do the following:

  1. Create a Flexclone of the NFS volume from a snapshot
  2. Mount the flexclone to your linux server
  3. Do not use the read-only mount option as linux requires read-write access
  4. Specify -t ext3 as the mount option (you can get the FS type per partition by "df -T")
  5. Remember to use fdisk -lu to get the starting sector for each partition
    Multiply the starting sector x 512 bytes and specify the result in the "offset" field of the mount command
Here's an example to mount and explor a copy of the /boot partition of a Red Hat 4 U4 vmdk using a flexcloning:



One reader asked a good question regarding Windows. The question was how to do file level backups of partitioned windows vmdks? The answer to this lays in the offset parameter of the mount option


What you need to do in a scenario like this is:

  1. Run msinfo32.exe in your Windows vm
  2. Go to Components -> Storage -> Disks
  3. Note the Partition Starting offsets and specify them as part of the mount option.








6 comments:

Anonymous said...

Awesome, thanks...this helps a lot...i tried all sorts of things and google...with no help. Now with the flexclone of a nfs volume, does that bring down anything(downtime). Now I have the command to create flexclone is below, is that correct?

vol clone create nfs_volume55_clone -s file -b /vol/vol55 hourly.0

Does this take up any space on the netapp, and do I need to run the command below to disable snapshots on the flexclone volume?

snap sched nfs_volume55_clone 0

Also is there any other way to do the linux file level restore without flexclone? Because using NFS for file-level recovery within VMs I think has one key disadvantage: the use of FlexClone requires a license correct?

Anonymous said...

Sorry for all the questions...File level restoring and backup covered...how do you go about restoring a VM itself using the snapshots taken. Example, VM1 goes down and we need to restore VM1, the VM1 snapshot is in /vol/vol55/.snapshot/hourly.0/VM1
and VM1 is in /vol/vol55/VM1

How can you restore it without restoring the whole volume(such as snapretore)?

Nick Triantos said...

Steven,

1) No downtime to create a flexclone. it's an on-they-fly process and takes about 1-2secs to create.

2) Flexclones are read-write.

3) ideally you want to turn automatic snapshots off and also turn off the snap schedule on the clone.

# vol options clone_name nosnap on
# snap sched clone_name 0 0 0

3) Flexclones share some blocks from the snapshot with the parent volume unless they are split from it (snapshot). Other than that they are independent from their "parent". So when you create a clone, what you are really doing is creating a brand new volume (clone) equal to the size of the parent. That brand new volume (clone) happens to share some blocks with the parent volume via the snapshot. Having said that, when you create the clone you do need to specify a space guarantee.

4) Command to create a flexclone:
# vol clone create path_of_new_vol_name -s none -b parent_volume_name snapshot_name

The path to the new volume name needs to be fully specified (i.e /vol/test). The path to the parent volume does not need to be and neither does the snapshot name. For erample:

#vol clone create /vol/bootclone
-s volume -b boot mysnap

Pay attention to the -s option. The -s option has 3 switches:

volume - volume space is guaranteed from the aggregate

none - volume is thin provisioned

file - space is guaranteed for written files only

We really haven't found a good use case for "file". If you want to do testing or backup then set the guarantee (-s) to "none" unless you have physical capacity in the aggregate to guarantee all the space in the flexclone (-s volume).

For linux vmdks you will need read/write access which means you will need a flexclone which does require a license. For Windows vmdks you don't need this since you can mount the vmdk as read-only using the loopback.

Nick Triantos said...

How do you restore a whole VM. Good question.

You can restore the VM using single file snap restore and restore from an existing snapshot. With snaprestore you can restore the following:

1) The whole volume (i.e datastore)
2) A file within the volume or datastore(if you are using NFS)
3) A LUN within a volume (datastore)

#snap restore -t vol -s snapshot_name volume_name

-t = vol or file

If you are restoring a file(vmdk) you want the path to the file/vmdk. For example:

system> snap restore -t file /vol/vol1/RHEL4U4/some.vmdk
-s mysnap

You can also restore to a different directory path or under a different vmdk name as well using the -r option.

Anonymous said...

Any idea what to do for ext3 filesystems encapsulated within a Linux LVM when attempting to do a file level restore from a vmdk?

Anonymous said...

this is talked about here:

http://blogs.netapp.com/storage_nuts_n_bolts/2008/01/vmware-over-net.html#comments