Disk added to QEMU Windows Guest comes up as off line
Add a new disk to a Windows Guest box and go to computer management and a message pops up:
As it turned out, this problem may appear in the failover cluster environments or virtual machines running Windows that have any shared disks can be accessed by several operating systems. It is related to the SAN Policy that appeared in Windows Server 2008. This policy controls automatic mounting of external disks and is used to protect shared disks available to multiple servers at once. By default, the Offline Shared (VDS_SP_OFFLINE_SHARED) policy is used for all SAN disks on Windows Server. You can change your SAN Policy to OnlineAll using Diskpart.
Run the command prompt as administrator and run the diskpart
. In diskpart context, display the current SAN policy:
DISKPART> san
SAN Policy : Offline Shared
Change your SAN Policy:
DISKPART> san policy=OnlineAll
DiskPart successfully changed the SAN policy for the current operating system.
View the current policy again:
DISKPART> san
SAN Policy : Online All
Select your disk (in our example, the disk index is 2):
DISKPART> select disk 2
You can view its attributes:
DISKPART> attributes disk
Make sure that the Read-Only attribute is not enabled. If it is, disable it, otherwise when trying to write something on the disk, you will see this message: The disk is write protected:
DISKPART> attributes disk clear readonly
Take the disk online:
DISKPART> online disk
DiskPart successfully onlined the selected disk
Close diskpart, restart your server and make sure that the disk is available after boot.
H/T: http://woshub.com/disk-offline-policy-set-administrator/