Restore a VM using the {vm}-flat.vmdk file

简介:

missing vmdk file error


A couple days ago I was asked the question “An admin deleted the vmdk file associated with a VM, there are no snapshots or backups of the VM . Can we restore this VM somehow?“. I believe in backups, I like to have my VM’s backed up so that I can depend on them for events just like this very issue. At first I was stumped, until the {vm-name}.flat.vmdk was mentioned. That’s when I remembered a method to recover a VM using the vm-flat.vmdk file that I had actually done 2-3 years ago.

Example preparation

For this example I’ve created a Server 2012 virtual machine (called Win2012) and placed a text file on the desktop called “Important Info”. I then deleted all the files associated with that VM with the exception of the Win2012-flat.vmdk file, as seen in the image at top.


VM before deleting VMDK file


After the files had been deleted I tried to power up the VM knowing it would not and received this error.


missing vmdk file error


Ok, now on to how to restore a VM with a missing .VMDK file.

How to Recover a VM using a vm-flat.vmdk file

  1. I created a new VM called Recovery with the same specs as my Win2012 server (2vCPU, 4GB RAM, 40GB HHD).

  2. Enable SSH on the host and logged in via PuTTy (or WinSCP) and verified the contents of Win2012 folder:
    cd /vmfs/volumes/vmNFS02/Win2012/
    win2012 folder contents

  3. Then navigate to the Recovery VM folder.
    cd ../Recovery/

  4. Rename the original Recovery-flat.vmdk file to Recovery-flat.vmdk.bak
    mv Recovery-flat.vmdk Recovery-flat.vmdk.bak
    copy recovery-flat.vmdk

  5. Now just copy the Win2012-flat.vmdk file from the Win2012 folder over to the Recovery folder (Note: This step could take several minutes):
    cp /vmfs/volumes/vmNFS02/Win2012/Win2012-flat.vmdk Recovery-flat.vmdk
    copy flat vmdk to recovery folder

  6. Finally, power up the new Recovery VM and your old VM (Win2012) should be back online good as new!
    after restore

  7. You can also go back and delete the Recovery-flat.vmdk.bak file as it won’t be needed.

So even though restoring a VM from a -flat.vmdk file is pretty easy it isn’t my recommended method, you’re far better protected with good, reliable backups, then on hoping that the -flat.vmdk file is still laying around somewhere.

本文转自学海无涯博客51CTO博客,原文链接http://blog.51cto.com/549687/1977451如需转载请自行联系原作者

520feng2007
相关文章
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
/******************************************************************************** * FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. * 说明: * 系统更新的时候遇到这个错误,记录一下处理步骤,其原因是我自己把其umount了 * 导致的问题。
6497 0
|
存储 缓存 Java
临时文件系统tmpfs-A Virtual Memory File System
tempfs 临时文件系统 操作系统 ramfs ramdisks
484 0
临时文件系统tmpfs-A Virtual Memory File System
|
弹性计算 PHP Docker
Contain Yourself! The VM Is Evolving
From traditional VMs to Docker containers, learn how the virtualization industry is evolving to meet constantly changing business needs.
2220 0
Contain Yourself! The VM Is Evolving
|
存储 Linux 开发工具
[OS][FS]查看ext3文件系统分区的superblock
本文将介绍怎样读取一个分区的superblock: 1. 首先我们查看一下在磁盘上有哪些分区,通过fdisk -l 这里有三个分区,我们下面查看/dev/sda3(这是一个device file) 2. 从/dev/sda3拷贝1024B-2048B(这就是superblock的位置)到一个叫superblock的文件 这里我们用到了dd这个工具,它在对磁盘进行这样读写操作时非常有用,具体请见man。
1151 0

热门文章

最新文章