In a lab environment, sometimes anything can go. Solutions aren’t always standards compliant or don’t always follow best / sensible practices. One that I can’t shake off though is using separate drives in my VMs for operating systems and data. It’s too ingrained.
Given my new found penchant for using Windows 2008 R2 Server Core for VMs in my lab though I hit a little niggle that I thought I ought to note down for when I inevitably forget about it.
When deploying a VM from a template for a specific purpose, it’s natural to add extra disks to it. In the normal version of windows, using the DiskManagement snapin to bring the disk online automatically makes it read-write as well. In Server Core, you can’t use the snapin locally. Firewalls permitting, you should be able to use it remotely (via RSAT tools installed on another machine) but if you’re in a hurry and comfortable with DISKPART then you might be tempted to use that. And that’s where the niggle is.
In DISKPART when you online a new disk, it changes the disk’s state but not whether it is read-only or read-write. And you can’t create a partition on a readonly disk!
So, what do you do? It’s just a couple of extra steps really.
1. In the command prompt window on the VM’s console, start up DISKPART.
2. First, list the disks present on the VM:
You notice that Disk 1 is 100% free but Offline.
3. Next we select that disk and then turn it Online.
If you tried to create a partition now you’d get a fairly non-specific error.
4. Look at the disk’s detail and you see why though.
“Current Read-only State: Yes”, not the clearest way of saying it but the disk is read-only at present.
5. To make the disk writable you need only type ATTRIBUTE DISK CLEAR READONLY.
Now you can create a partition as you normally would.