Blog Marcina Bojko

Linux,Windows,serwer, i tak dalej ;)

Posts Tagged ‘hyper-v

Packer Hyper-V support for CentOS 8.1 is here

Written by marcinbojko

22 kwietnia, 2020 at 19:22

Napisane w work

Tagged with , , , , ,

HV-Packer in version 1.0.8

Written by marcinbojko

25 Maj, 2019 at 17:01

Napisane w work

Tagged with , , , ,

Veeam Instant Recovery – when life is too short to wait for your restore to complete.

(courtesy of @nixcraft)

„Doing backups is a must- restoring backups is a hell”
So how can we make this ‚unpleasant’ part more civilised? Let’s say – our VM is a couple hundred GB in size, maybe even a couple TB and for some reason, we have to do some magic: restore, migrate, transfer – whatever is desired a the moment.

But in oppositon to our will – physics is quite unforgiving in that matter – restoring takes time. Even if we have bunch of speed-friendly SSD arrays, 10G/40G network at our disposal, still few hours without their favourite data can be ‚no-go’ for our friends from „bussiness side”.
In this particular case, Veeam Instant Recovery comes into rescue.
How does it works?
It uses quite interesting quirk – in reality, the time you need for having your VM ready is to restore small, kb-sized VM configuration, create some sparse files for drives, and mount the drives itself over a network. This way, within 3-5 minutes your machine is up and ready

But, disks, you say, disks! „Where are my data, my precious data?”.
They are still safe, protected in your backup repository, mounted here as ReadOnly volumes.

Phase 1

So, after an initial deploy our VM is ready to serve requests. Also in Veeam B&R Console tasks is waiting for you to choose: begin migration from repositories into real server, or just to power it off.

Phase 1 during restore:

  • IO Read is served from mounted (RO) disk from backup repisotory
  • IO Write from client is server into new Drive snapshot (or written directly into sparse Disk_1 file.
  • In background, data from backup repository are being moved into Disk_1_Sparse file.




Phase 2

Phase 2 to begins when there are no data left to move from backup repository – this initiates merging phase, when ‚snapshot’ (CHANGED DATA) are being merged with originally restored DISK_1.

As with everything, there are few PROS and CONS

PROS:

  • machine is available withing a few minutes, regardles of its size
  • during InstantRecovery restore, VM is alive and can (slowly) process all requests

CONS

  • restoring can take a little longer then real ‚offline’ restore
  • space needed during restore proces can be as much as twice your VM size. If you’ll ran out of space during restore, process will fail and you’ll loose all new data.
  • your data are served with some delay – to read a needed block, VM have to reach it from repository, which means on-the-fly deduplication and decompression
  • if your VM is under heavy use, especially on IO Write, restoring can take much longer then anticipated, as there will be no IO left to serve read and transfer from original disk.
  • if your restore will fail from ANY reason – your data are inconsistent. You’ll have to repeat this process from point 0 – any data changed in previous restore attempt, will be discarded.

So which targets should be ideal for this process?

Any VM which doesn’t change data much but needs to be restored within few minutes:

  • frontend servers

Any VM which offers small-to-medium usage of IO Read , not so many IO Write

  • fileservers

Which targets should we avoid?

  • database servers
  • cluster role members/nodes

Written by marcinbojko

24 marca, 2019 at 19:17

Napisane w work

Tagged with , , , , ,

Hyper-V Packer Gen2 machines – version 1.0.5

https://github.com/marcinbojko/hv-packer

 

Written by marcinbojko

3 października, 2018 at 20:02

Napisane w work

Tagged with , , , ,

Hyper-V Packer Gen2 machines – version 1.0.4

Written by marcinbojko

21 Maj, 2018 at 19:44

Napisane w work

Tagged with , , , , ,

Hyper-V Packer Gen2 machines – version 1.0.3

The most „bad ass” release so far 🙂

  • * `BREAKING FEATURE` – preparing switching to submodules/subtree for ./scripts and ./files – to share common code with other providers
  • * tree structure in `./scripts` and `./files`, moved to `./extras`
  • * [Windows] adding `phase-3.ps1` script to put less generic stuff there. Just uncomment line with `exit` to get rid of it
  • * [Windows] added support for `Windows Server 1709 Edition (Standard)`
  • * [Windows] remove some clutter from `bootstrap.ps1`
  • * [Windows] added `exit 0` for most of the scripts as some external commands were leaving packer with non-zero exit codes
  • * [CentOS] added `zeroing.sh` script to make compacting more efficient
  • * [CentOS] reworked bug with UEFI – this time after deploying from image you can run script `/usr/local/bin/uefi.sh` which will recheck and readd CentOS UEFI entries. For SCVMM deployments (which separates vhdx from vmcx) use `RunOnce`
  • * [CentOS] removed clutter from `provision.sh`
  • * [CentOS] removed screenfetch, replaced with neofetch
  • * [CentOS] reworked `motd.sh` in `/etc/profile.d` to reflect .Xauthority existence*

https://github.com/marcinbojko/hv-packer

Written by marcinbojko

23 lutego, 2018 at 19:34

Napisane w work

Tagged with , , , , ,

Hyper-V Packer’s Virtual Machine Generation 2 Templates – Windows 2016 and CentOS 7.4

Selection_999(897)

As you probably know – HashiCorp’s Packer (https://www.packer.io/) is a great tool for generating customized OS images for future use.

You can use many builders, starting from Virtualbox, Azure, Amazon EC2. You can also use mechanizm of providers to customize your image even more.
That becomes very handy when you have to manage your infrastructure fighting for every minute your machine will be available, and later on – ready to work. It’s advisable to put some effort to prepare latest images possible, with your organization custom needs.

However great tool, it still lacked a lots of decent documentation how to prepare images using less common builder – Microsoft’s Hyper-V. Hyper-V is a part of Microsoft Windows for a long time, it can be used as standalone product (Microsoft Hyper-V Server) or a additional feature (Hyper-V Feature in Windows 2016/10). When using packer with so-called „generation 1” images packer templates are no different from common examples prepared for popular Virtualbox builder.

With „Generation 2” images it required some more work to achieve this goal.

What’s the use for Gen-2 images? Few features than can be useful:

  • secure boot (Windows/Linux)
  • UEFI boot
  • no IDE/COM burden from previous generations
  • boot from SCSI devices

If you want to know more about „Genration 2” – read this post: https://www.altaro.com/hyper-v/comparing-hyper-v-generation-1-2-virtual-machines/

It took me a while to prepare them Hyper-V ready, also with SystemCenter Virtual Machine Support. They were (and are) tested with both (2012 and 2016) editions and just became quite important part of my deploys.

Long story short – here is my github repository with Hyper-V Windows 2016 and CentOS 7.4 Generation 2 templates.

https://github.com/marcinbojko/hv-packer

Leave me a sign if these were useful to you 🙂

 

 

Written by marcinbojko

11 listopada, 2017 at 19:30

Napisane w work

Tagged with , , ,

Centos 6/7 virtual machines and Production Checkpoints in Hyper-V 2016.

As we may know – Microsoft introduced new way of doing snapshots/checkpoints in Hyper-V 2016. However term „production” is misleading, implying Standard checkpoints are not production ready – which is simply not true.
The biggest difference is that Production checkpoints are mostly used with VSS-aware applications (like MS SQL/Exchange, MS Windows itself) allowing them to flush/sync/commit changes to filesystem.

As a major difference – production checkpoints don’t save memory or cpu state, starting always with machine powered off after restore.

You can choose which way you want to do your snapshots here:

Selection_999(411)

Windows-based virtual machines have supported this since previous versions of integration services (2012 R2, 8/8.1) and from the start in case of Windows 2016/10. What about Linux-based, Centos 6/7 machines?

When installed out of the box, without any additional packages, trying to do a production snapshot of Centos 7 (with all updates) we got something like this:

Selection_999(410)

Quick how-to.

  1. If youre using external LIS (Linux Integration Services) from Microsoft, as an external package – remove it. It’s a piece of crap,  breaking kernels from time to time, packed with ‚latest’ errors and workaround rejected by linux kernel maintainers. It’s really not worth risk to have it installed: 
    yum remove microsoft-hyper-v kmod-microsoft-hyper-v

    or

    yum remove $(yum list installed|grep microsoft)
  2. Check if your Hyper-V offers all Integration Services for this VM.Selection_999(412)
  3. Check  and install hyperv-daemons
     yum info hyperv-daemons

    Available Packages
    Name : hyperv-daemons
    Arch : x86_64
    Version : 0
    Release : 0.29.20160216git.el7
    Size : 4.5 k
    Repo : base/7/x86_64
    Summary : HyperV daemons suite
    URL : http://www.kernel.org
    Licence : GPLv2
    Description : Suite of daemons that are needed when Linux guest : is running on Windows Host with HyperV

    yum install hyperv-daemons -y
  4. Enable and start services
    systemctl enable hypervfcopyd
    systemctl enable hypervkvpd
    systemctl enable hypervvssd
    
    systemctl start hypervkvpd 
    systemctl start hypervvssd 
    systemctl start hypervfcopyd
  5. Check status
    [root@centos7 ~]# systemctl status hypervkvpd
    ● hypervkvpd.service - Hyper-V KVP daemon
     Loaded: loaded (/usr/lib/systemd/system/hypervkvpd.service; static; vendor preset: enabled)
     Active: active (running) since Wed 2017-07-26 02:37:30 CDT; 14s ago
     Main PID: 3478 (hypervkvpd)
     CGroup: /system.slice/hypervkvpd.service
     └─3478 /usr/sbin/hypervkvpd -n
    
    Jul 26 02:37:30 centos7 systemd[1]: Started Hyper-V KVP daemon.
    Jul 26 02:37:30 centos7 systemd[1]: Starting Hyper-V KVP daemon...
    Jul 26 02:37:30 centos7 KVP[3478]: KVP starting; pid is:3478
    Jul 26 02:37:30 centos7 KVP[3478]: KVP LIC Version: 3.1
    [root@centos7 ~]# systemctl status hypervvssd
    ● hypervvssd.service - Hyper-V VSS daemon
     Loaded: loaded (/usr/lib/systemd/system/hypervvssd.service; static; vendor preset: enabled)
     Active: active (running) since Wed 2017-07-26 02:37:30 CDT; 27s ago
     Main PID: 3485 (hypervvssd)
     CGroup: /system.slice/hypervvssd.service
     └─3485 /usr/sbin/hypervvssd -n
    
    Jul 26 02:37:30 centos7 systemd[1]: Started Hyper-V VSS daemon.
    Jul 26 02:37:30 centos7 systemd[1]: Starting Hyper-V VSS daemon...
    Jul 26 02:37:30 centos7 hypervvssd[3485]: Hyper-V VSS: VSS starting; pid is:3485
    Jul 26 02:37:30 centos7 hypervvssd[3485]: Hyper-V VSS: VSS: kernel module version: 129
    [root@centos7 ~]# systemctl status hypervfcopyd
    ● hypervfcopyd.service - Hyper-V FCOPY daemon
     Loaded: loaded (/usr/lib/systemd/system/hypervfcopyd.service; static; vendor preset: disabled)
     Active: active (running) since Wed 2017-07-26 02:37:30 CDT; 44s ago
     Main PID: 3492 (hypervfcopyd)
     CGroup: /system.slice/hypervfcopyd.service
     └─3492 /usr/sbin/hypervfcopyd -n
    
    Jul 26 02:37:30 centos7 systemd[1]: Started Hyper-V FCOPY daemon.
    Jul 26 02:37:30 centos7 systemd[1]: Starting Hyper-V FCOPY daemon...
    Jul 26 02:37:30 centos7 HV_FCOPY[3492]: starting; pid is:3492
    Jul 26 02:37:30 centos7 HV_FCOPY[3492]: kernel module version: 1

    As a result:
    Selection_999(413)
    and in /var/log/messages

    Jul 26 02:43:27 centos7 journal: Hyper-V VSS: VSS: op=FREEZE: succeeded
    
    Jul 26 02:39:25 centos7 systemd: Time has been changed
    
    Jul 26 02:39:25 centos7 journal: Hyper-V VSS: VSS: op=THAW: succeeded

 

Written by marcinbojko

26 lipca, 2017 at 18:05

Napisane w work

Tagged with , , , , ,

5 serious issues/deal breakers with System Center Virtual Machine Manager.

System Center Virtual Machine Manager was Microsoft’s answer to VMWare’s vSphere. It’s Microsoft, so what could have gone wrong? It’s Microsoft – so everything.
Below is a list of most annoying things, some of them are so serious it makes you wonder – maybe Powershell is the answer? Seriously? In 2017, Microsoft, you FORCE everybody to use text console again?
In a moment of doubt we used to call it overgrown cancer over Powershell commands.

Let’s start, sorted by weight of crime:

Deal breakers:

1) Terrible things you cannot do in SCVMM but you can in Hyper-V Manager, Failover Cluster or Powershell like:

  • rename you machine when its powered on (sic)
  • change its MAC from Dynamic to Static other way like manually copy it character by character.
  • change booting order (sic) of machines and templates
  • select all Integration Services offered
  • change location of smart paging file
  • change affinity with cluster (high/medium/low/do not autostart)

and so on.

2) Console. Console is so terrible, that its sorry state is just good meme source.

First – console from Hyper-V Manager/FailoverCluster

Selection_670.png

Then from SCVMM

Selection_671.png

  • you cannot attach console and then power on machine. You HAVE to – power on machine, wait few sec for console button to be available then race through time to start it BEFORE OS starts. You have better chances of winning some of Grand Prix then finish the trick above on first run.
  • only actions you have is Reconnect and Send CTRL+ALT+Delete. Never working ‚Clipboard’ added in SCVMM 2016 requires you to paste text HERE, then it’s pasted in VM console
  • when it start before machine starts – you have to kill an application. It’s no good to use it ever again, it won’t ‚click’ with machine you’ve started. Exit? Something terrible may happen.

Selection_672.png

3) Requirements

  • MS SQL Server Standard or Enterprise. https://technet.microsoft.com/en-us/system-center-docs/system-requirements/sql-server-version-compatibility
  • 4 GB Ram required, 16 GB recommended (don’t even bother going below)
  • A lot of not-really-so-working tricks to use it to manage hosts from other domains, especially without 2 way trusts settled.
  • Price. With whole gang of System Center tools, prepare to be robbed in a daylight. Doesn’t matter you have no intention to use other components – you have to pay for it. You cannot just pick and buy needed component – you have to buy-and-pay with bulk.

4) GUI

  • General slowness of GUI, regardless of hosts number, running tasks, library sizes.
  • Jobs window – generally unusable with more than one admin or more than one job running- lots of informational comments. Important actions (like: who deleted or altered machine) quickly goes off the screen, covered by messages like: refresh was completed.
  • Oh, did I mention ‚Refresh’ habit? Learn it. Learn it, and let your fingers memorize this config, as you will be using it a lot.

Refresh is required almost on everything. In options like: you DID change something via Powershell and HV-Manager – I can understand, refresh may be required. But you will have to hit REFRESH before, in time, and after ANY action you would like to perform. If not – expect the worst. Virtual machine seems to be non responding on your commands? Maybe its locked for backup, maybe it hanged, maybe it migrated to another host – you have to refresh, refresh and refresh to persuade SCVMM that you have most recent data.

Sometimes even refresh doesn’t work. Like in recovery or cluster node failure, you shouldn’t count on SCVMM to update its status before timer reaches day or two. Take your time! Sometime you will have to reboot SCVMM to persuade it to have the latest data. So, when your action fails – search no more, VM is probably locked, on other host or powered off. SCVMM takes its auto-refresh very slowly.

  • General over complexity in Logical Network and Switches. It’s like you have to create every VLAN again, even if you’ve done it on dozen of network devices, fill variables like subnets, gateways. You have to group it all together and again, attach to every Hyper-V switch on hosts you have.
  • Adding you own custom fields and filling them is, again, over complicated and requires you to do a lot of scripting and scheduling them in a Windows manner.
  • You cannot add, change or sort fields like Operating systems. What Microsoft got you are values like this:
    • Microsoft Windows Server 2012 R2
    • 64-bit edition of Microsoft Server

Selection_673.png

  • Hyper-V integration Services are always few releases behind. It started to change with Windows 2016 and idea to install them via Windows Update.
  • Inability to rename vm folder when machine changes its name. This way you will have to do a Live Migration to rename folder.
  • Complexity of generated script.One will think generating a new machine is easy: New-SCVirtualMachine with a lot of parameters. No. Script is long, heavy, complex and tries to do things in complete different matter.
  • Templates – only way to refresh a template is to create it again, or replace vhdx in library, and do some internal tricks.
  • Inability to do anything with machine when the job is running – all fields are grayed out and you have to wait for jobs to end or fail.

5) Agent

  • if you’re lucky, agents are deployed ALMOST instantly, but adding host to SCVMM requires it to restart
  • if you’re not lucky, then in case of SCVMM upgrade, you will have to manually redeploy and reinstall all agents. Quite common I’d say.
  • [IMPORTANT] The mess agent leaves on filesystem is just legendary. Lets say we would like to migrate our machine from folder d:\vm to e:\vm.After migration (when we choose right option) we will got:

– empty files in d:\vm\machinename

– machine in e:\vm\machinename

Let’s say we would like to migrate it back for some reason

We will get:

  • empty d:\vm\machinename
  • empty e:\vm\machinename
  • machine in e:\vm\machinename (1)

And migration is just done twice. Do you see the pattern? After few migrations we have complete chaos on filesystems with a lots of empty, semi-empty, almost empty and ‚soon-to-be-empty folders’. You’ll end up with removing them manually – again, if you’re lucky.

  • locked folder after failed job. Yes, when you migration failed, you will end with d:\vm\machinename which you’re not able to delete. Sometimes it can be deleted after some time, sometimes after SCVMM/host reboot, sometimes never.

Above list, not fully completed can be seen in SCVMM 2012 R2 and SCVMM 2016 versions. It’s clear that SCVMM is not very high on Microsoft ‚to do’ list as same errors and mistakes are transferred to newer version and hunts us until this day.

 

UPDATE (1)
Changed from Requirements (Enterprise) to (Standard , Enterprise)

Written by marcinbojko

4 lutego, 2017 at 20:08

Napisane w work

Tagged with , , , ,

Hyper-V Integration Services en masse ;)

Yes, we all „love” the way Microsoft gives us new stuff (like forced updates in Windows 10). As we usually know better what and when should be applied, let’s say it is time to upgrade our guest integration services to the latest version.
I usually  express strong conviction that HV integration services should be kept up to date, the thing most sysadmins disregards. Those tools are responsible for keeping your VMs in shape, maintain communication between them and host services, so they SHOULD be always updates. Of course, as with almost everything TEST it before applying on any important environment.
As on 2016-12-31, the latest HV Integration Services version is 6.3.9600.18398

Let’s say – we would like to upgrade all our Windows machines (those BEFORE Windows 10 and Windows 2016) . We can do it manually (not cool, not cool at all), semi-automatic (no reboot) or almost … magical way – fully automatic 😉

Let’s start we have proper source added to Chocolatey:

choco source add -n=public -s"https://www.myget.org/F/public-choco" --priority=10
  • semi automatic (RDP, psexec, powershell)
    choco install hvintegrationservices -y
  • fully automatic (with reboot) using The Foreman and win_manage

    win_manage:
        chocolatey_packages:
          hvintegrationservices:
            ensure: 6.3.9600.18398
        dsc_reboot:
          dsc_reboot:
            message: Machine requested a reboot
            when: pending

 

Written by marcinbojko

31 grudnia, 2016 at 15:14

10 Myths about Hyper-V

On my lectures and meetings with both: IT and Management  I’ve had a pleasure to be a myth buster about Hyper-V. As much as I don’t appreciate Microsoft’s ‚way of life’ – Hyper-V is mostly feared due to: lack of proper knowledge and very low quality support from Microsoft. Few most common myths are:

  1. It’s very expensive
    Let’s calculate:
    If you’re going to use standalone hosts with Microsoft Hyper-V Server your cost will be just zero coma zero.
    If you’re going to use a lots of Microsoft Windows virtual machines on them – you can rent them as SPLA licenses (per machine), or just rent Windows Datacenter edition for whole host.
    If you’re gonna to use Linux machines (assuming opensource, not paid edition) – again – zero coma zero
    If you’re going to use HA, all you need is just 1 (preferably more) OS for Domain Controller.
    If you’re gonna to manage standalone hosts, all you need (and rather as a suggestion) is a Microsoft Windows 10 Anniversary Edition machines. Just one 🙂
    You don’t have to pay extra for all fine features like: HA, Live Migration, Cluster Aware Updates. With W2k16 edition few extra features are available only in Datacenter edition (which I believe is a grave mistake) but that’s all.
  2. It requires System Center to be managed by
    No. As a matter of fact, SC is only useful in situations when you have lots of VLANS, Logical Network, templates to be deployed or Services. In any other case like: have your VLANS’s accounted for, drop Services as nobody is using this part. System Center Virtual Machine Manager is nothing more than overgrown cancer on a top of Powershell scripts it runs. Since 2012 edition Microsoft couldn’t ever fix the simplest things like: responsive console and not having refreshed it manually after every operation.
  3. It’s slower than VMWare or ‚any’ other competitor
    No. Overhead of Hyper-V is done mostly on storage level and most problems with it are created on a level of infrastructure design.
    For example: If you have a lot of hosts, and you do not require virtual machines there to be Highly Available – do not (i repeat) DO NOT connect them all as cluster nodes.
    If you’re using 1 or 2 iSCSI 1GB cards as you paths for low quality machines – expect nothing more than problems.
    Instead: use local storage, combined with low-end HW controllers. Even having 2 (mirror) or 4 (RAID5 or RAID10) disks for those machines is way better than having one underpowered ‚best of the world storage’. Plan this usage carefully – you still have things like Shared Nothing Live Migration (in a case of maintenance on specific host).
    Creating a lot of host, giving them all 1 or 2 ClusterSharedVolume to share is just asking for trouble.
  4. It requires a lot’s of PowerShell knowledge
    No. And I am the best example here 😉 With few exceptions like script for installing Hyper-V hosts, maybe create few LACPs – that’s all I used Powershell for.
  5. It doesn’t support Linux
    It does, it does it very well.
    Official document: https://technet.microsoft.com/en-us/windows-server-docs/compute/hyper-v/supported-linux-and-freebsd-virtual-machines-for-hyper-v-on-windows
    Few my lectures: https://marcinbojko.wordpress.com/2014/10/22/xxi-spotkanie-regionalnej-lubelskiej-grupy-microsoft-i-moj-wyklad-systemy-linux-na-platformie-hyper-v-2012/
    As a matter of fact – I use CentOS/RedHat, Ubuntu/Debian machines and appliances, and have to say: working with them on Hyper-V is just a simple pleasure.
    In 2016 with things like Hyper-V and Veeam, support for Linux machines on Hyper-V is very much alive. Even our beloved ‚System Center Virtual Machine Manager’ supports creating templates for Linux machines, with small agent to set a lots of things during and after deployment.
  6. It’s complicated to install, run, maintain especially HA & Clusters
    No. It is just simple as click few times: next, next, next,finish.
    Using System Center or (better) FailoverCluster Manager from any Windows Server machine works perfectly out of the box. Rules are simple, wizard will tell you what you should do next.
    With maintenance mode, Live Storage Migration, Cluster Aware Updates you can have stable and secure environment for your machines. Even migrating machines between different clusters (Shared Nothing Migration) is secure and efficient.
  7. It requires specific hardware 
    One of the biggest myths. Learn with a hard way with VMWare hosts , you do not require special NIC, special motherboards or any devices from very narrow VMWare HCL list. Requirements of Hyper-V are very small: VT enabled CPU, enough memory to fit VM’s and host OS itself, one HDD, one NIC. For small setups it almost equals in using desktops and other workstations as a hyper-v farm.
    After hearing this statement from one of my clients, I began to pursue the subject. It was someone from VMWare camp that told him: ‚you will need special hardware for SMB3 and SMB Direct’ – which is generally correct in a same matter like: ‚if you want a milk, you need a cow’ 😉
  8. It doesn’t work with Azure
    Hyper-V 2016  is a light years ahead of Azure:) They still seems to be using Windows 2008 as a hosts with all of its negative aspects.
    But, jokes aside, using pre-build templates or products like Veeam and Windows Azure Pack, creating you own hybrid cloud is one of the best things you can do. Don’t trust sales guy from Microsoft forcing you to ‚move everything to a cloud, our cloud’. Don’t trust you IT guy saying ‚only on premise or death!’. Live in a both worlds.
  9. I know NOTHING about Hyper-V.
    If you have ANY knowledge about Windows – you have knowledge about Hyper-V itself.
  10. But migration from platform X/Y/Z is pain in the ….
    Take a deep breath. Calculate it. Find tools to do it manually, recreate all you machines using somekind of CM tool (like mentioned The Foreman/Puppet)- https://marcinbojko.wordpress.com/2016/10/04/puppet-the-foreman-powershell-dsc-your-system-center-in-a-box/. Calculate it again.
    Do it 😉

Written by marcinbojko

28 grudnia, 2016 at 17:12

And I landed on a BitBucket…

Written by marcinbojko

27 sierpnia, 2016 at 09:47

Hyper-V default settings

I decided to make my script public via GitHub. What it does is helping making new Hyper-V installation easier. This little thing helped me in numerous Hyper-V deployments.

https://github.com/marcinbojko/hv_default

Written by marcinbojko

14 lipca, 2016 at 17:39

Napisane w open source, Uncategorized, work

Tagged with ,

Blogi które śledzę – MVP i nie tylko.

Nie jest tajemnicą, iż uważam Microsoft za firmę, w której myśl inżynieryjna jest tłamszona przez część schizofreniczno-marketoidalną, co widać w ich kolejnych posunięciach. Brak jakiejkolwiek możliwości wpływania przez inżynierów na swoje produkty, częste zmiany zasad gry w połowie rozgrywki, paranoidalne trzymane się jedynie rynku USA (nie chcę nawet komentować wykastrowanego XBL w PL). Po kolejnej konferencji, na której widzę te same twarze „celebrytów-evangelistów” wiem, że nic się w tej sytuacji nie zmieni na dobre.

Tym, którzy nie widzieli – polecam, to niezły otwieracz oczu:

Rynek i chęć współpracy z produktami Microsoftu ratują dla mnie REALNI (nie ewangeliczni) MVP – ludzie zatrudnieni na co dzień w przeróżnych firmach, zajmujący się realnymi problemami, rozwiązującymi je i dzielącymi się tym z całym światem.

Swoją przygodę z Hyper-V zaczynałem od próby weryfikacji różnic pomiędzy produktami konkurencji – język Technetu to beznadziejna maszynowa nowomowa, która w żaden sposób nie wyjaśnia jak osiagnąć to co próbujesz. Śmiało moge powiedzieć iż siedziałbym jeszcze w epoce IT łupanego, gdyby nie kontakt z MVP – ludzmi, którzy częściowo bezinteresownie przeprowadzali nas przez meandry korporacyjnych zawiłości.

Obecnie, aby pozostać w obiegu (na bełkot Microsoftu szkoda mi czasu) sledzę:

  • Mało przydatne:

System Center: Virtual Machine Manager http://blogs.technet.com/b/scvmm/

W zasadzie tylko komunikaty o poprawkach i opisy rozwiązań problemów, już dawno przez społeczność rozwiązanych.

Virtualisation Bloghttp://blogs.technet.com/b/virtualization/default.aspx

Jak wyżej.Niestety.

  • Obowiązkowe (Microsoft, Hyper-V, File Server)

Łukasz Kałużnyhttp://blog.kaluzny.pro/ – Blog Łukasza był dla mnie początkiem próby zrozumienia działania i przewagi HyperV. Chociaż ostatnio pisze rzadziej, sposób w jaki przekazywał powodował iż na początkowym etapie bywał po prostu niezastąpiony.

Aidan Finnhttp://www.aidanfinn.com/ – wyszczekany, niepoprawny politycznie, hejter Linuksów i VMWare. Wrzuca zarówno rozwiązania swoje, jak i w formie agregatora newsów rzeczy związane z Hyper-V, Azure. Nie boi się w mało delikatny sposób zaznaczyć kto w Microsofcie ma problemy z głową przy wprowadzaniu (tak, tak! więcej zamieszania w licencjonowaniu i supporcie) nowości.

Ben Armstronghttp://blogs.msdn.com/b/virtual_pc_guy/ – Manager programu Hyper-V. Gość z niesamowitą wiedzą, dzielący się DZIAŁAJĄCYMI rozwiązaniami w ramach oficjalnego uczestnictwa w programie Microsoftu.

Jose Barreto’s Bloghttp://blogs.technet.com/b/josebda/default.aspx – kolejny uczestnik programu Microsoftu (FIle Server Team). Jego posty z kolei skupiają się na rozwiązaniach z zakresu Storage. Nie ma co jednak zapominać iż Storage to SILNY i KLUCZOWY parametr dobrego hypervisora.

Didier Van Hoye ‚Working Hard in IT’http://workinghardinit.wordpress.com/ tam gdzie zawiodą oficjalne sposoby Microsoftu, lub osoby powyżej mają związane ręce z powodów oficjalnych, tam wkracza Didier. Jego artykuły mogą uratować Ci życie (lub karierę) w przypadku kolejnego świetnego pomysłu marketingu czy kierownictwa Microsoftu. Dobrze Wam radzę – wrzucać jego notki do Evernota czy Pocketa bo w chwili kryzysu mamy rozwiązanie podane jak na tacy.

Michael Rueefli AKA Dr.MIRUhttp://www.miru.ch/ Michael skupia się na najbardziej niedocenionym obecnie pomyśle Microsoftu czyli HyperV Replica. Z tym rozwiązaniem jest świetnie jak działa – jak nie działa, to na 99% Michael JUŻ wie dlaczego i co zrobić.

Kristian Nesehttp://kristiannese.blogspot.com/ – Azure i HyperV

  • Obowiązkowe – sensowni ludzie w PL

Agregator Ziemborahttp://ziembor.pl/plitproblogs/ – Skupia wpisy profesjonalistów w PL piszących dla innych, celem pomocy. Nieopatrznie powiem, iż poniższy blog jest w nim obecny.

Chociaż w żaden sposób nie pretenduję do powyższej czołówki (charakter mojej pracy nie pozwoli mi specjalizować się tylko w kilku wybranych technologiach) chciałbym wierzyć (i wierzę, patrząc na statystyki i maile ze swojego bloga) iż komuś tak sprezentowane rozwiązanie przyda się w krytycznej chwili.

Serdeczne podziękowania dla Michała Panasiewicza (z którym sprzeczam się równie często, co namiętnie) jako inspiracji dla powyższego wpisu.

I jak wyżej – szanowni Microsoftowicze – MVP są naprawdę jedynym powodem, który przepycha mnie przez codzienne obcowanie z waszymi technologiami.

Written by marcinbojko

7 września, 2014 at 19:19

Napisane w open source, work

Tagged with , , , ,

Compacting Virtual Disks in System Center Virtual Machine Manager 2012 R2 or Hyper-V 2012 R2

As we all know – disk space isn’t free. If you allocate disk space to your virtual machine, you always want to allocate proper, well-balanced size to shorten future downtimes. But what is proper and balanced you ask?  There is no short answer to this, but if you’re  IT person, you always will try to allocate more than is needed right at the moment.  The decision is : should I use static or dynamic disks?

For me, there is no really need to use static disks anymore as there is no real speed difference. So, the real pro using dynamic disk is their smaller size.

In production environment, using Microsoft’s hypervisor, we can expect our VM to grow over time. During the nature of virtual machines and virtual disks, the real data machine uses are not the same numbers as virtual disk sizes. It is happening due to hypervisor behaviour – deleting all data from OS in virtual machine is no more than throwing away and index card from your book. The written data are still there, so there is no easy, automated way to compact a virtual disk.

Hypervisor however, tries to allocate in a first place, blocks marked as used. So the real expanding is happening when you’re constantly changing your data, without deleting them first. The great example is with databases, log and temporary trash disks and just plain and simple oversizing. I’ve had a case when relativly small machine (20 GB CentOS with a 600 GB VD) just grew over few days filling whole 600 GB of data because of logs set to DEBUG.

So what will be the cons and of virtual disk growing overtime?

  • obviously, more space allocated at expensive storage for VMs
  • more obviously, when you’re using any kind of backup software, you’re forced to write and store in multiple copies the data you really doesn’t need
  • CBT (Change Block Tracking) Table is bigger to process, with every move
  • more network traffic with every backup job you have
  • live ‚shared nothing’ migration times grows just out of proportions. If you have a small machine with 20GB data on 600 GB sized disk, you will have to transfer this whole fatso over you network to other machine. Even with compression set at live migration, it is just really unwanted.

So what can we do? We can just zero the data you’re not using and Hyper-v cmdlets  will take the rest.

You have to plan downtime for the machine, but according to my tests, zeroing machines with 600 GB took 15 to 30 minutes. With smaller sizes it is just matter of single minutes.

Before you go:
– plan your downtime, compacting should not to be interrupted
– take extra caution. Zeroing important data or uneeded data it’s just a matter of mistake.
– delete all snapshots/checkpoints
– make sure you converted VHD to VHDX (optional)
– make sure your disk is set as dynamic disk
– make sure you have enough room for compacting or resizing. Remember – if you have 600 GB virtual disk, during this process it may grow to this size.
– remember that compacting deletes CBT table for backup software – next backup will be a Full Backup.

The most usable zeroing ways I found was:

Offline methods

Cons
– longer downtime
Pros
– more accurate (no more background write)
– faster (no more background write)
– smaller risk of processes failure due to ‚out of space’ event

  • zerofree for Linux ext2/ext3/ext4 disks
  • ntfswipe for Windows based disks
  • dd for both Linux and Windows based disks or exotic fs (btrfs/xfs)

Online methods
Cons
– less accurate (background write  is still happening)
– machines became slower or unresponsible
– slower process
– risk of applications failing due to ‚out of space’ events
Pros
– smaller downtime

– SDelete or CCleaner for Windows based disks
– dd for Linux based disks

 

Phase I – Zeroing Offline

Offline zeroing (done with System Rescue CD 4.x)

  • Delete all uneeded data (logs, temps, bigfiles, dowloads, caches)
  • Umount all ext2/3/4/ntfs volumes
  • for NTFS volume: ntfswipe -av /dev/volume_name
  • for ext2/3/4 volume: zerofree -v /dev/volume-name
  • for LVM: vgchange -a y;zerofree -v /dev/mapper/volume_name
Zeroing swap space:
# swapoff -a

# free
total used free shared buffers cached
Mem: 8056340 2643132 5413208 155072 606916 914796
-/+ buffers/cache: 1121420 6934920
Swap: 0 0 0

# blkid |grep swap
/dev/sdb2: UUID="adad0488-3b67-4444-b792-6a1a775b8821" TYPE="swap"
# dd if=/dev/zero|pv -treb|dd of=/dev/sdb2 bs=8192
dd: error writing ‘/dev/sdb2’: No space left on device
1,91GB 0:01:04 [30,3MB/s]
249981+4 records in
249980+4 records out
2047868928 bytes (2,0 GB) copied, 67,931 s, 30,1 MB/s

#mkswap /dev/sdb2 -U "adad0488-3b67-4444-b792-6a1a775b8821"
Setting up swapspace version 1, size = 1999868 KiB
no label, UUID=adad0488-3b67-4444-b792-6a1a775b8821
# swapon -a

# free
 total used free shared buffers cached
Mem: 8056340 3309648 4746692 159844 1112232 919708
-/+ buffers/cache: 1277708 6778632
Swap: 1999868 0 1999868

Phase I – Online zeroing

1. Delete all uneeded data (logs, temps, bigfiles, dowloads, caches)

for Windows machine
sdelete -z letter:

Linux machine
#dd if=/dev/zero|pv -treb|dd of=/file.zero bs=4096;sync;sync;rm -rfv /file.zero;sync

Phase II – Compacting

1. Shutdown the machine

For System Center VMM 2012 R1/R2

Workspace 1_107
For Hyper-V powershell

Optimize-VHD -Path path_to_vhdx_file.vhdx -Mode Full

 

Workspace 1_108
——-
System Rescue CD – http://www.sysresccd.org/Download
SDelete – http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx
CCleaner Portable – https://www.piriform.com/ccleaner/builds
zerofree – http://manned.org/zerofree/00be91ab

Written by marcinbojko

3 sierpnia, 2014 at 13:10

Red Hat Enterprise Linux 7 (RHEL7) – maszyny wirtualne Hyper-V Generacji 2

Dla wszystkich, którzy czekali na RHEL7 mam dobrą wiadomość – gotowa do pobrania dystrybucja umożliwa jako drugie distro (po Ubuntu 14.04) tworzenie maszyn wirtualnych Hyper-V Generacji 2.

Plusy?

– start/stop maszyny zajmuje ułamki tego co pochłaniało przy RHEL6/CentOS 6

– wsparcie dla Hyper-V VSS (zintegrowane z systemem)

– kernele z serii 3.x

– poprawione błędy z dodawaniem (hotadd) pamięci dynamicznej

RHELG2 RHELG2_2 RHELG2_3Czekamy na ruchy społeczności CentOS 😉

 

Written by marcinbojko

12 czerwca, 2014 at 18:29

Napisane w work

Tagged with , , , ,

Microsoft System Center 2012 R2 VMM Update Rollup 2 and failed performance counters (Assigned Memory/Demanded Memory set to 0)

Strange thing happened after System Center 2012 R2 Virtual Machine Manager Rollback Update 2 – most fields with dynamic performance counters were not updated at all.

It looked like this:

Image
I did try to:

  • reboot of Hyper-V hosts and/or SCVMM 2012 R2 instance (no changes)
  • refresh all host and virtual machines (no changes)
  • remove host from SCVMM console and re-add with ‚Reassociate with this host’ option – It looks like re-installing VMM agents worked.

But in production environment, removing and re-adding all hosts is quite risky bussiness (and what about library and template servers?), so maybe we will try to force re-install scvmm agents?
Let’s look for a most recent one

Image

Image

As you can see on 2014-04-28 with Rollback Update 2 agent has changed to version (3.2.7634.0) but was not refreshed or upgraded on all hosts. I decided to do it manually.

Quick Solution:

  1. Copy vmmagent.msi from 3.2.7634.0 directory to a Hyper-V host or shared network path (for me it was users’s home mounted disk).
  2. RDP to Hyper-V host or do it in any remote execute way you want –
  3. execute (on Hyper-V host) :
    wmic product where name='Microsoft System Center Virtual Machine Manager Agent (x64)' call uninstall
  4. execute (on Hyper-V host) :
    msiexec /i your_path_to_files\vmmAgent.msi 
    or
    msiexec /i your_path_to_files\vmmAgent.msi /passive
  5.  Wait few minutes (5-10)
  6. Goto SCVMM, choose Hyper-v host, choose ‚Properties/Status’, click ‚Refresh’Image
  7. Wait few minutes (5-10)
  8. Refresh host and virtual machines.Image

Dear Microsoft. I couldn’t find a proper way to do it with GPO (update failed without removing agent first) or any other way. Do you understand that doing it with a dozens or hundreds of Hyper-V host is not funny, and in a kinda way is crooked thinking?

Written by marcinbojko

2 Maj, 2014 at 16:26

Napisane w work

Tagged with , , , , ,

Hyper-V R2 – ciężki w zarządzaniu? Wcale nie…

Dowolny Windows 8, Windows Server (2008/2012/R2), RemoteDesktop, darmowe aplikacje 5Nine – to wszystko w porównaniu do kobyły ‚klienta’ VMware.

A kopiowanie plików za pomocą RemoteDesktop ?

# net use * \\tclient\mój_dysk

 

Written by marcinbojko

12 stycznia, 2014 at 19:17

Napisane w Uncategorized

Tagged with , , ,

%d blogerów lubi to: