Server 2019 management

I have been playing on and off with some form of Hyper-V Server 2019 for a few years now.

Note: I worked on this post over a really long time and it’s become something of a mess. It’s less of a guide and more of a random reference for later.

Hyper-V Server in particular is the “free as in beer” version of Windows server specifically for headless virtual machine hosting. It’s a minimal OS that doesn’t come with a GUI and relatively little in the way of actually setting it up. In fact it has an old-school (I’m talking pre-Windows) menu system when you first login and a CMD box next to that. And that’s all you get “out of the box”.

The latest version, 2019, just came out in June of 2019. I did write a little bit about it on day 31 (with more on day 32) of my ill-fated 100 days of code attempt (I also wrote about my server hardware in another post about the Dell R520).

So there’s a few different approaches to the subject: the hardware including the server, the SAS card and the hard drives, the operating system including installation and configuration and the networking of Server 2019 with my main Windows 10 PC.

As I mentioned, Hyper-V server in particular was made with the “headless” part in mind which means “remote management”. Which is just fancy speak for Windows 10 programs that connect to the server to perform different functions on it.

There’s Hyper-V Manager. That one is kind of self-explanatory. It allows for the creation and management of virtual machines with Hyper-V. It manages Hyper-V, yes.

The other is just called Server Manager.

Server Manager has actually been working well for me for a while now. This where you do things like set up storage pools and virtual disks out of a group of hard drives. It’s also where you could see many servers at once if there was more than one on the network.

Hyper-V Manager, on the other hand, I’ve been having some issues with. I’ll have it working perfectly for a really long time and it will just stop working with the same errors I originally had when I first installed the server OS.

So I now I have list of commands I try when the errors start cropping again. I’m still not sure how many of these are necessary or which combination of commands would solve it on the first try.

The first thing I always try is setting winrm again (which can only be run via PowerShell). This I run on both the server and my Win 10:

winrm quickconfig 

It may not be necessary but I usually start with it.

Usually the above alone won’t help. This is a sample of the winrm command I have to use to add trusted clients. It took a long time to get all the quotes and spacing just right so this would actually run. Obviously this these are sample host names I have on my network. This command will only work in PowerShell and I run it on both the server and the win 10 client. It doesn’t seem to matter if the command includes the name of the PC it’s being run on, e.g. it’s being told to “trust itself”. This is good since it’s that much easier to copy/paste this way.

winrm set winrm/config/client'@{TrustedHosts="ToughPeg,ThinkCentre1,GalacticaGamer7"}'

If that doesn’t work, this command is run on the Win 10 PC:

Enable-WSManCredSSP -Role client -DelegateComputer *

Usually one or both of these will work. But I have a few more commands to try if neither do.

The first is this one. It seems to work in both PowerShell and CMD equally well. I have no idea what it does just that it fixed one of the errors was getting with Hyper-V manager. This I run only on the server:

MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof

Also only on the server I run below. I believe this actually disables the firewall so for the love of god don’t do it on a production machine. I mean the output of the command says it’s deprecated but it still works so…whatever.

netsh firewall set opmode disable

Once I can mange both the server and Hyper-V remotely I’ll need to start on the next step of organizing all the hard drives into a single storage device. In the case of the R520 I could use the actual firmware on the motherboard to create some form of RAID device or I could use the actual OS to do that.

For various reasons I’ll be going with the software-based options.

I seem to have bad luck with creating storage pools and virtual disks in that learning how to modify or delete them never seems to go too terribly well. And by that I mean they completely fail.

This happened recently when I was going to start experimenting with the eventual configuration of my recent purchase 5 10TB hard drive.

By that I mean I was going to use the several 1 and 2TB drives I have in the server now to figure out the best way to set them up for possible failures and finding which if any configuration would work with a designated hotspare.

The existing drive array was actually created through the R520’s firmware so I had to dismantle that first. I did set the virtual disk to offline/disconnected first. I thought that would make it safe. I then deleted/destroyed the disk in the firmware and booted back to the OS. But the OS could still see the virtual disk. It could be I’m missing something.

Every time I tried to use server manager to delete the storage pool/virtual disk I got error message. Said something like the array was read-only. No matter what I did I couldn’t take apart that pool.

Eventually I had to look up the PowerShell command to do it for me:

Remove-StoragePool -FriendlyName "Storage Pool1"

This is probably self-explanatory: using the “friendly name” of the pool, remove it. That’s about it. Or literally it.

So now I just have to create a new pool. Again this is with the 1 and 2TB drives. I haven’t installed the 10TB ones yet. I’m kind of eager to, really.

From a prior experience I did learn something of creating a multi-drive pool but somehow flagging it as only one drive, allowing for removal and replacement of a single drive from the pool. This can only be done with a PowerShell command, not with the Server Manager.

The solution came from a technet blog discussing this very issue. Specifically it’s this “number of columns” property. The blog has a much better walk through and explanation of what’s happening, but here is the PowerShell command for the drive pool:

New-StoragePool –FriendlyName "Storage Pool1" –PhysicalDisks (Get-PhysicalDisk PhysicalDisk1, PhysicalDisk2,PhysicalDisk3 ) –StorageSubSystemFriendlyName *space*

This would be followed by the creation of the virtual disk block device, also in PowerShell. As mentioned, the column count is set to 1.

New-VirtualDisk –StoragePoolFriendlyName "Storage Pool1" –FriendlyName VDisk1 –NumberOfColumns 1 –ProvisioningType Fixed –ResiliencySettingName Simple -UseMaximumSize

I’m just copy/pasting in the sample commands from the blog. I will have to modify them for use on my system. And I would want to experiment with the resiliency setting besides. I have the PowerShell reference handy though. It probably won’t take that long.

I’m making progress on the above but I’m going to take a little side trip to another minor annoyance: two of the drives I’m currently working with keeping coming up with a “media type” of “unknown”.

When I run the PowerShell command to show my physical disks:


I do get the right output, it’s just those two drives come up as “unknown” in the MediaType column.

So using examples in the actual PowerShell provided help, I looked at Set-PhysicalDisk and used this command to set the usage to that of a HDD:

Set-PhysicalDisk -FriendlyName "ATA SAMSUNG HD103UJ" -MediaType HDD

The friendly name I obviously copy/pasted from the actual PS window. and this apparently works. I don’t have any idea actually on the why of these two particular drives coming up as “Unknown”

In my browsing of various online documentation I also found a really good shortcut for creating new storage pools and virtual disks:

$PhysicalDisks = Get-StorageSubSystem -FriendlyName "Windows Storage*" | Get-PhysicalDisk -CanPool $True 

This line takes the output of a command, tests for the drives that come back true on the “canpool” attribute and stores it in a variable. In other words that’s a lot of typing and copy/pasting saved from one little line and variable.

Of course I’m not sure I can use it: I am still doing experiments with creating the pools virtual disks and may not want to use all the available disks at the same time. Maybe I just want to use 3 of the 5 initially so I can add disks in to see how expanding works. I could probably use a variation of the variable simply spelling out the friendly names of the ones I wanted to use.

It’s been a very fruitful Labor Day weekend on the server front. I’ve been using some old hard drives I still have as a test bed for my experimenting with the storage pool and virtual disk. Took a few false starts and I still don’t know if i have it right not but I think about ready for the 10TB disks.

I was taking notes in a notepad window the whole time but I don’t think I’m going to bother pasting that in. Instead I’ll take the right apparent bits and just paste those in.

I should mention I’m using the optical drive SATA port for the OS drive so that is drive zero while the rest are drives 1 – 5. That makes it easier somehow.

What I learned over a lot of time is that a storage pool is first created and out of that a “virtual disk”. Not a VHDX virtual disk though. A volume out many disks that can be formatted and used by the host OS. In fact to look at the server manager the virtual disk is literally the pool.

There’s still a few things I’m confused about like whether to specify parity in the pool or in the virtual disk creation. But I think I got it figured out. I mean I still don’t know which one but I found a way to do it so that’s how I’m doing it.

I had found this video about creating pools originally but I couldn’t add disks to the pool and I couldn’t figure out why. Then I found this PowerShell command to specify the number of “columns” set to 1. This setting of the columns to 1 can only be done through PS.

That’s for a “simple” volume though which equates to striped RAID which means no redundancy. As it turns out this actually isn’t what i wanted: I always intended to use “parity” which is equivalent to RAID 5.

As I mentioned the first step was creating the storage pool. But I wanted to use three of the 1TB drives for this which left an additional 1TB and a 2TB drive for later experimenting.

It was actually kind of amusing – to me – figuring this next part out. I had to go back to the notes I took from the PS book and piece it together one bit at a time. In order to set a variable to only the three 1TB drives I used this command:

$PhysicalDisks = Get-PhysicalDisk -CanPool $True | Where-Object -filter { $_.DeviceID -lt 5 } | sort  descending |select -last 3

This command uses the “Get-PhysicalDisk” cmdlet to show me all the drives flagged as capable of going into a storage pool. This is then piped to a Where-Object filter to show me the “DeviceID” attributes with a value less than (the -lt) 5 which is that sorted and finally I ask that it show me the last 3. All this is stored in a variable called $PhysicalDisks. And using a variable like this does make this next part easier.

Keep in mind the above is not actually necessary under normal circumstances. I just really wanted to use those three 1TB drives and only those three 1TB drives.

With the variable defining the drives I wanted to use I could then use the command to create the storage pool:

New-StoragePool -FriendlyName WinStorePool -StorageSubsystemFriendlyName "Windows Storage*" -PhysicalDisks $PhysicalDisks 

As you see I have to reference the friendly name of the “Storage subsystem” (whatever that is). If you’re curious, you can see the name and other information about the “storage subsystem” with the command Get-StorageSubSystem. You can then just copy/paste that “FriendlyName” into your command (you can use a wildcard as above or put the whole name in double quotes to avoid any errors).

Moving on to the virtual disk creation…

After what seemed like entirely too long I came with this line to create the virtual disk:

New-VirtualDisk -StoragePoolFriendlyName "WinStorePool" -FriendlyName VDisk1 -ResiliencySettingName Parity -Size 2TB -ProvisioningType thin -PhysicalDiskRedundancy 1

I’m still unclear on the main benefits of use cases of a “fixed” versus “thin” provisioning. But seeing as the “thin” type allows for setting of an arbitrary size of the virtual disk which physicals can be added into the achieve this arbitrary size I think I will stick with it.

For instance the above New-VirtualDisk PS command uses those 3x1TB drives to create one disk which at max is going to be less than 3TB after formatting etc. The virtual disk can be set to be any arbitrary size however, such as 50TB:

Resize-VirtualDisk -FriendlyName "Vdisk1" -Size (50TB)

Keep in mind the “virtual disk” is not the same as the volume. At this stage there is no file system and/or way to copy data to the array. This is simply telling the OS the hypothetical size of the virtual disk which it apparently happily excepts.

Thus so far I am really liking the this “thin provisioning” feature. I’m sure there are disadvantages but as I’m not in a production environment I am not that worried.

With my new virtual disk apparently healthy and ready use, I went ahead and formatted the volume, setting the sector size to the max available (64K) as I was going to use this volume for the other kind of virtual hard drives, the kind used with virtual machines e.g. extremely large files.

I copied over about 100MBs worth of dummy data though for the rest of my tests. Have to be sure the data remains unaffected right? Although in all likely hood that would all be stored on one disk anyway I thought it was still a good test to have some data I could see was still there.

If it matters I first used NTFS and then switched to ReFS. I also don’t know what if any advantages will come up with ReFS but I also didn’t see a reason to avoid it.

I actually used Server Manager for the formatting part as it was just there and convenient. I don’t think the PS command would be that hard to figure out though. Or diskpart for that matter.

Like above I found another situation relatively unique to myself: two of my 1TB drives some how ended up with the same “friendly name”.

This was a minor issue for me because just about all the example commands do things like setting attributes by friendly name. So how do I change friendly name if all I have to go on is the friendly name? I mean tried it. I tried to set a new friendly, by friendly name and you know what happened? That’s right. Changed the friendly name of both drives to the same new friendly name. Not exactly solving the issue.

Well I took a chance and/or guess that maybe the output of get-physicaldisk would be compatible input for set-physicaldisk. I’m almost positive I remember reading that in the PS book. Anyway I saw in the reference that get-physicaldisk can show disks by serial number. So I set the output of that to a variable. I then used this variable as the inputobject of set-physicaldisk. And strangely enough it worked. Here is what I used:

$DiskToChange = Get-PhysicalDisk -SerialNumber WD-WMATV8730079
Set-PhysicalDisk -InputObject $DiskToChange -NewFriendlyName "1TB ID 6"

I mean it’s not the greatest friendly name since I could always change positions of the disk but the good news is I don’t have two disks with identical friendly names now.

I’m still deciding if I want to create a fresh pool and start adding 10TB drives to it or if I just want to slowly replace the existing drives with 10TB drives. In theory it shouldn’t matter but I kind of want to start fresh anyway.

Also, even though I could keep this post going perpetually I think I’m going to break it here and continue in a follow-up post.

References and Resources

10 thoughts on “Server 2019 management

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s