Automation Backup in a Hyper-v for Small Business/Start up
small business and start up’s are always looking for ways to save money. As you should know, small companies they don’t have money to buy fancy products and when people decide to open their business, they have a small amount of money to do some X (this could be buy a PC, server, etc) and keep it running for a couple of months/year without need to invest anymore.
When I started RFLSystems while ago, I had the same, a money to start the business and keep it running for some time.
in my case, I needed an environment that would be used to do demos to customers as well as running production stuff like CRM, SCCM, File Share, etc.
As you can imagine, for me going to cloud was easy, I could add some vm’s, buy services from provides, etc. but, money was a restriction.
for me, having a reliable/secure e-mail and file share is everything. I need to have control over what people are doing, imagine if they steal some data? or send the e-mail to someone else that may damage my business? or imagine, if the internet is down and I need some files? of they have a maintenance going on exactly the day I need to demo something to the customer?
well, those are some of the factors that helped me to go for a hybrid solution. e-mail is something that needs to be high available, so I decided that to use Office 365, this was easy solution because I could have the same messages on my phone, company laptop as well as on the web without too much changes. there are services that still used POP or IMAP and I don’t want used them.
for the other services, I checked the following:
1- for each user for CRM I had to pay about £40 per month
2- for each user of a solution for management (ie Intune), about £15 per month
3- file share (onedrive for business) is included on office 365, but during my tests, it wasn’t good enough…
4- having a demo environment, well. I used over £100 in just couple of days in azure/aws…
so, I decided that for everything else, I needed to have an on-prem solution, but this is costly as you can imagine. for me, as a Microsoft Partner, I got access to the action pack, that for Small amount of money per year, I can have almost every single Microsoft product to be used for up to 10 people/computer, so more than enough for a startup/small business.
today I have over 8 Virtual Machines, running on a Hyper-V Server (it has 64GB of RAM, i7 processor with 12 cores, 3x 465 SSD, 1x 128SSD, 2x Hybrid 698GB, 2x 1GB network card), a NAS (WD MyCLoud Ex4) with 1x 3TB and 2x 2TB for backup, 1 netgear switch and 1 wifi access point. everything was not cheap, but I spent less than 2.5k. cheap than buying a ready to use kit. so, initial price was high, but less on the big run, probably about couple of months of a SCCM lab running in azure or AWS
Anyway, today we have all those vm’s running in this server. but what about backup? if I had everything in the cloud, backup would be nice to have but I would not need a lot, so I decided to have:
1- all company files being backup up by crashplan (http://www.code42.com/crashplan/). I did not need yet to restore (as i also have 2 other ways to backup on-prem) so I don’t know if it will work or not, but they have a really good deal of 150USD for unlimited data
2- once a month I use a script (below) to power off all VM’s, create a snapshot (and delete the old snapshot), export the VM’s, boot up all VM’s in the correct order (and as you can imagine, I need to wait a bit between the boot so there is no issue with services, etc) and then copy to the NAS.
3- the script has some functions that I use often
3.1 – Write-Log. used to write to a log file, based on a CMTrace format
3.2 – Start-VirtualMachine. used to start a VM and wait some time (that is specified by a parameter)
3.3 – Stop-VirtualMachine. used to power off VM’s
3.4 – Snapshot-VirtualMachine. used to snapshot a vm
4- the $VMList variable is an array of script where it has the name of the computer and the time to way to start the machine up. add them the way you want to stop so the machines you need to power off before needs to be on the top. my domain controller is the last one I want to stop. when I start up the machines again, I look from the last vm to the 1st
4.1 it is used on section 2 part to power off the machine
4.2 it is used on section 3 to snapshot the vm
4.3 it is used on section 4 to export VM’s
4.4 it is used on section 5 to start vm’s
5- the $VMList on section 4 is used to start up the vm’s.
6- the script has 6 secions
6.1 – section 1 is a clean up, it delete the older backup from the exported path
6.2 – section 2 is used to stop all vm’s
6.3 – section 3 is used to snapshot all vm’s
6.4 – section 4 is used to export the vm’s to the exported VM folder. this section is also used to clean up old snapshot so I only have 1 snapshot
6.5 – section 5 is used to start VM’s
6.6 – section 6 is used to NAS
if you’re interested, download the script here (rename to PS1 instead of PS1.TXT)
ps. we have a downtime of about 4hrs, that is the time it takes to export all VM’s to the local backup drive and there are about same time to copy to the external NAS, but in this case all VM’s are already running, so no big deal.
the script is running overnight, so no user impacted :):):)