{"id":2008,"date":"2009-12-10T10:46:44","date_gmt":"2009-12-10T09:46:44","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/how-to-backup-small-business-server-2008-on-hyper-v"},"modified":"2024-04-04T08:34:36","modified_gmt":"2024-04-04T08:34:36","slug":"how-to-backup-small-business-server-2008-on-hyper-v","status":"publish","type":"page","link":"https:\/\/www.itwriting.com\/blog\/articles\/how-to-backup-small-business-server-2008-on-hyper-v","title":{"rendered":"How to backup Small Business Server 2008 on Hyper-V"},"content":{"rendered":"<p>Microsoft Small Business Server 2008 bundles Active Directory, Exchange 2007, IIS and Sharepoint into one supposedly easy to use package, tailored to run on a single server. It is aimed at networks of up to 75 users, and is great value if you want or need to run this stuff on-premise.<\/p>\n<p>A new feature in Windows Server 2008 is Hyper-V, for server virtualisation; and a new feature of Small Business Server 2008 is the Premium Edition which comes with a license for a second server. One of the supported scenarios is that you use the second server to run a Hyper-V host, and run SBS 2008 itself as a virtual server.<\/p>\n<p>Well, it is more or less supported. However, there is one significant oversight in Microsoft\u2019s product design. SBS 2008 comes with a new backup solution based on imaging to an external hard drive rather than tape. Hyper-V guests do not support USB pass-through, so you cannot use the backup system in the way that is intended.<\/p>\n<p>How then do you backup virtual SBS? Microsoft\u2019s grown-up backup system is <a href=\"http:\/\/www.microsoft.com\/systemcenter\/dataprotectionmanager\/en\/us\/default.aspx\">Data Protection Manager<\/a>, which supports Hyper-V; but that is extra cost and an extra server, hardly appropriate for SBS.<\/p>\n<p>What about just backing up the host? Since Windows Server Backup is able to backup live virtual machines, that seems a good solution. However, there are a few disadvantages:<\/p>\n<p>1. Especially if your Virtual Hard Drives (VHDs) are fixed size, backing up the host is inefficient. Each VHD looks like a single huge file and will be backed up as such. <\/p>\n<p>2. Backing up a live VM is a complex process. The host tells the guest it is being backed up, and VSS (Volume Shadow Services) gets invoked both on the host and in the guest. I\u2019ve had backup failures when the guest is running, that disappear when the guest is shut down first.<\/p>\n<p>3. There are special considerations when <a href=\"http:\/\/blogs.dirteam.com\/blogs\/sanderberkouwer\/archive\/2008\/08\/14\/active-directory-in-hyper-v-environments-part-2.aspx\">backing up a virtual domain controller<\/a>, like SBS. It is recommended that you backup a domain controller from the guest:<\/p>\n<blockquote>\n<p>Only use the standard way to backup and restore Active Directory Domain Controller, since the default checks of Active Directory consistency will only be performed when the Domain Controller is aware of a restore. <\/p>\n<p>Using imaging solutions like <a href=\"http:\/\/shop.symantecstore.com\/store\/symnasmb\/en_US\/DisplayProductDetailsSmbPage\/productID.104206700\/ThemeID.106400\/pgm.12858700\">Symantec Ghost<\/a> and <a href=\"http:\/\/www.acronis.com\">Acronis TrueImage<\/a> seem like smarter backup and restore solutions, but they are imaging solutions (in contrast to proper backup and restore solutions.) Restoring an image of a Domain Controller may cause an Update Sequence Numbers (USN) rollback situation to occur, which may lead to replication problems and other undesired effects. <\/p>\n<\/blockquote>\n<p>4. SBS 2008 backup has a very easy wizard for restoring individual files, such as a document that is inadvertently deleted. If you only have a host backup, getting at that individual file will not be quite so easy \u2013 though it should be possible to mount the backup VHD and copy the file from there.<\/p>\n<p>I don\u2019t mean to suggest that you should never do a host backup. It is a good idea; but should not be your <strong>only<\/strong> backup.<\/p>\n<p>Is there a way to use the built-in SBS backup when running virtual? Here\u2019s what I have come up with.<\/p>\n<p>1. Use <a href=\"http:\/\/www.microsoft.com\/hyper-v-server\/en\/us\/r2.aspx\">Hyper-V 2008 R2<\/a>, not the first release. There is a free version, provided you can cope with server core. The reason is that R2 lets you attach and detach VHDs from the virtual SCSI controller while the guest is running.<\/p>\n<p>2. Use a VHD as the backup target. A VHD attached to the virtual SCSI controller actually looks like a removable drive to the guest, so SBS backup will be happy. You need a large VHD \u2013 I suggest a dynamic VHD, which can be located on a cheap Sata drive if you like, since if the drive fails it can be easily replaced with minimal impact on the main server.<\/p>\n<p>Backing up to a VHD actually works very nicely, since you can restore individual files using the wizard.<\/p>\n<p>3. The tricky bit: how do we safely copy the backup VHD to an external drive each day, for off-site storage? Ideally this should not require the user to do more than simply plug and unplug a USB drive from the server.<\/p>\n<p>You can accomplish this with a scheduled PowerShell script. First, grab the <a href=\"http:\/\/www.codeplex.com\/PSHyperv\">PowerShell Management Library for Hyper-V<\/a> from Codeplex and install it on the host.<\/p>\n<p>4. Next, go into the guest and open device manager. Under Disk drives, right-click the drive that is the backup VHD, click Policies, and choose Optimize for quick removal.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.itwriting.com\/images\/quick-removal.gif\" \/><\/p>\n<p>What if you have several drives, all called Msft Virtual Disk SCSI Disk Device? You can tell which is which by the LUN, which shows on the General tab. You can also see this number in the Hyper-V manager. I suggest you always use the same LUN for your backup VHD; in the example that follows it is LUN 6.<\/p>\n<p>The reason you have to do this is that there is no way (that I know of) to script the Safe Remove Hardware wizard in order to safely remove the backup VHD. You will need to safely remove it, in order to back up the VHD with confidence. Turning off write caching means safe removal is not necessary.<\/p>\n<p>5. Schedule your backup using the SBS wizard. The script will be detaching the backup target, so clearly you need to leave enough time for the backup to complete before detaching the drive. Fortunately, the SBS backup is incremental and usually completes relatively quickly; but leave plenty of margin. If a problem occurs, the SBS report will tell you.<\/p>\n<p>6. Download <a href=\"http:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb897438.aspx\">sync.exe<\/a> from sysinternals and install it on the host. It doesn\u2019t matter where you put it, provided your script can find it. This enables you to flush the external backup drive so the user can safely disconnect it. <\/p>\n<p>Why didn\u2019t we use sync.exe on the guest as well? Because it requires a drive letter, and the SBS backup target does not have one.<\/p>\n<p>7. Here\u2019s a PowerShell script you can schedule on the host:<\/p>\n<blockquote>\n<p>IPMO HyperV      <br \/>Remove-VMdrive &quot;your-vm-name&quot; 0 6 -SCSI -DiskOnly       <br \/>Copy-Item path-to-source.vhd path-to-target-vhd       <br \/>Add-VMDisk &quot;your-vm-name&quot; 0 6 &quot;path-to-source.vhd&quot; -SCSI       <br \/>sync.exe target-drive-letter:<\/p>\n<\/blockquote>\n<p>In this script, <strong>your-vm-name<\/strong> is the name of your SBS virtual machine; <strong>path-to-source.vhd<\/strong> is the full path to the backup VHD; <strong>path-to-target-vhd<\/strong> is the full path to where you will be copying that VHD on the external drive; and <strong>target-drive-letter<\/strong> is the drive letter that is assigned to the external drive.<\/p>\n<p>The backup VHD will be large, so this script will take a while to complete. <\/p>\n<p>It is helpful to keep details of how you have configured the SBS VM, in case you need to do a restore. In particular, note the sizes of any VHDs that are attached, and whether they are SCSI or IDE, and make sure you know their internal drive letters as well. It makes sense to keep one drive letter per VHD; I suggest avoiding multiple partitions on a single VHD.<\/p>\n<h3>Restoring Virtual SBS<\/h3>\n<p>If you follow the above procedure, you will have no problem restoring individual files or Exchange mailboxes from the internal backup VHD, but there are a few complications if you need to do a bare-metal restore. Imagine that your SBS server is stolen and all you have is your recent copy of the backup.vhd.<\/p>\n<p>Here\u2019s how you can do a bare metal restore. First, install Hyper-V Server R2 on the new machine. You will need wbadmin on this machine; you can install this using ocsetup.<\/p>\n<p>Next, create a new VM using the same or similar settings to the original. Details such as the exact amount of RAM or the number of virtual processors don\u2019t matter too much, but having the same number and size of VHDs attached is important.<\/p>\n<p>Attach the backup VHD to the IDE controller, not SCSI. Otherwise the restore will not be able to see it.<\/p>\n<p>Now boot the VM from the SBS install media. Go into system repair, and do a full recovery from the backup.<\/p>\n<p>You will find that the recovery works for the C drive but not for any drives attached as SCSI. The recovery reports:<\/p>\n<blockquote>\n<p>The following disks were not restored &#8230; The backup is restored to available disks.<\/p>\n<\/blockquote>\n<p>Fortunately there is a workaround. Shutdown the VM once recovery completes; don\u2019t try to restart it yet. Now log onto the Hyper-V host. Use Diskpart to mount your VHDs, the backup as well as any target VHDs that were not recovered. Assign a drive letter to the backup VHD. Partition, quick format, and assign a drive letter to the target VHDs.<\/p>\n<p>Now you can use wbadmin to restore individual volumes. Continue until they are all complete. Take care to use the same version as used for the system recovery; normally you would just use the latest one.<\/p>\n<p>Finally, use diskpart to detach the VHDs. Go back to the Hyper-V manager and move the backup VHD to the SCSI controller. Start the VM.<\/p>\n<p>All going well, you will get a successful boot. In my tests, I found that the virtual NICs were re-detected by the guest, so it was as if the NICs had been replaced. This meant fixing networking, as the SBS server lost its assigned IP. In other respects, the restored SBS seemed to work fine.<\/p>\n<p>Note that you can also restore the host complete with its VMs, if you have a full backup. However, doing this on a daily basis is more difficult and lengthy than backing up from the guest. My suggestion is to backup the host occasionally as a fallback.<\/p>\n<p><em>Helpful post? <a href=\"http:\/\/www.itwriting.com\/blog\/sponsor-itwriting-com-for-ad-free-browsing\" target=\"_blank\" rel=\"noopener\">Sponsor ITWriting.com<\/a> for ad-free access to the site<\/em><\/p>\n<div style=\"padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px\" id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:810b9de0-b9c2-40d6-9b61-b59e676c7dfb\" class=\"wlWriterSmartContent\">Technorati Tags: <a href=\"http:\/\/technorati.com\/tags\/small+business+server\" rel=\"tag\">small business server<\/a>,<a href=\"http:\/\/technorati.com\/tags\/sbs+2008\" rel=\"tag\">sbs 2008<\/a>,<a href=\"http:\/\/technorati.com\/tags\/backup\" rel=\"tag\">backup<\/a>,<a href=\"http:\/\/technorati.com\/tags\/hyper-v\" rel=\"tag\">hyper-v<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft Small Business Server 2008 bundles Active Directory, Exchange 2007, IIS and Sharepoint into one supposedly easy to use package, tailored to run on a single server. It is aimed at networks of up to 75 users, and is great value if you want or need to run this stuff on-premise. A new feature in &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/articles\/how-to-backup-small-business-server-2008-on-hyper-v\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to backup Small Business Server 2008 on Hyper-V<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2036,"menu_order":95,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2008","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/2008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=2008"}],"version-history":[{"count":1,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/2008\/revisions"}],"predecessor-version":[{"id":12180,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/2008\/revisions\/12180"}],"up":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/pages\/2036"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=2008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}