Link to home
Start Free TrialLog in
Avatar of cmp119
cmp119Flag for United States of America

asked on

Hyper-V Dynamic Disk Pros and Cons

http://backupchain.com/i/dynamic-disk-hyper-v-backup-considerations

I was reading the above mentioned article, and it appears to suggest not using dynamic disks if at all possible.  It suggests not using dynamically expanding disks because of reduced performance by increased overhead and fragmentation.

I usually assign the guest VM OS as a fixed disk.  This also applies to virtual disks with databases.  However, for growing company file storage, I usually assign the virtual disk as dynamically expanding with a cap imposed.

I will be installing a new Windows 2016 hyper-v server with two vms.  On one of the two vms I was going to assign the guest os (80Gbs) and a database virtual disk (150Gbs) as fixed virtual disks.  Their company data is currently at 330Gbs, and growing, and I was going assign it as a dynamically expanding disk with a cap of 800Gbs.   As a rough estimate the amount of disk space will probably double within 4 or 5 years.

After reading this article, I may want to consider assigning this virtual disk as fixed (800Gbs), and be done with it.  I understand, a large fixed disk has drawbacks when it comes to moving/restoring the entire drive should that be necessary.  However, fragmentation is just as an important issue over the near/distant future.  Also, I purchased this server with a more than adequate amount of overall disk space to last many years, so disk space is not really an issue.

The article also mentioned the following referencing Dynamically Expanding VHDX:

Use a defragmentation tool once a week (by the way, this can be done while VMs are running) and keep plenty of disk space (over 30%) free to provide plenty of free disk space for growth and as defrag work space.

Not sure if it refers to Windows defrag utility or some sort of third party option.

I am just wondering what your opinions are about this.
Avatar of Cliff Galiher
Cliff Galiher
Flag of United States of America image

Dynamic expanding disks are a good way to get in trouble. If you have any doubt, don't use them.
I cover this in my article Virtual or Physical? - https://www.experts-exchange.com/articles/27799/Virtual-or-Physical.html - see the storage section.  For ease:

There are three ways to configure disks in Hyper-V: A dynamically expanding virtual hard disk, a fixed virtual hard disk, and a pass-through hard disk. Each has its pros and cons.

Dynamically expanding VHD/VHDx drives offer the advantage of using only the space they need. This is not a guarantee however. I have seen dynamic VHDs grow in size well beyond their internally used space and shrinking them is not always possible (it’s not automatic at any point and requires the disk be offline). Assuming the VHDs behave themselves, using dynamic drives provide the advantage of being smaller and thus more easily copied/transferred/replicated to other system. Consider that a 600 GB VHD can take an hour and a half to copy at gigabit speeds – 30-45 minutes at best with USB 3 to an SSD, but if only 95 GB is used and hence the VHD size is only 100 GB, it will go much faster. Dynamic VHDs also allow you to overcommit your disk space. Want to allow 5 servers to each see 1 TB of space available when you only have 3 TB of total physical disk? Use Dynamic VHDs and they will.

You do need to be careful when using Dynamic Disks. If they grow to a point that the physical disks fill, Hyper-V will “Pause-Critical” all the VMs that have disks on that volume. If there was nothing else stored on that volume that you could move or delete, you might find it difficult to restore the VMs to a working state. In addition, Dynamic VHDs can fragment if there are any other files on the drive/partition on which they are located, causing a degradation in performance.

Fixed virtual hard disks will occupy exactly as much space as they are to provide (plus a small bit of extra overhead).  Using fixed drives prevents issues with fragmentation, “Paused-Critical” events with VMs, and slightly improved overall performance. Their very large size though can reduce your ability to rapidly move, copy, or replicate them to another location.

Pass-through disks can be handy for connecting external USB drives. But they can also cause problems if they are removed from the host without being removed from the VM. They also prevent replication and clustering since the disks cannot be replicated in the same way VHDs can. Generally, I recommend the use of pass-through disks only on a temporary basis.

I generally prefer dynamically expanding hard disks. To combat the possible issues with fragmentation, I sometimes partition the VHD storage drive. This can prevent fragmentation while keeping the file small and technically overcommitted in available disk space. In some cases, I’ve used the FSUTIL command to create several large temporary files - fsutil file createnew v:\file1.tmp 10000000000 - that I could delete as necessary, buying time to order and install additional drives to provide the space needed. This can help prevent difficulty in recovering from “Paused-Critical” states due to disk space, though it can also increase the likelihood of having those events.

Finally, NEVER partition your VHDs. There’s no point. Why create a VHD with a C: and D: partition when you can have TWO VHDs which can subsequently be expanded as necessary and easily through the VM’s configuration and internally through disk management. For every partition you want within a VM, create a VHD.
ASKER CERTIFIED SOLUTION
Avatar of Philip Elder
Philip Elder
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cmp119

ASKER

I may actually consider changing the existing virtual disks from dynamically expanding to fixed then.  I generally purchase servers with plenty of disk space, so that I do not need to deal with the hassle of juggling disk space with growth spurts over time.  

So, is it a problem switching from an existing dynamic expanding disks to fixed disks without harming the resident data.  If so, do you have the procedures? I just want to make sure if the change is possible that its done right.  Thanks.
Keep in mind your data transfer if you want to move those systems to another host could take much longer with fixed disks since they are "full size"
Avatar of cmp119

ASKER

I can live with that.  I prefer having virtual disks that are larger, with less overhead, and not have to worry about fragmentation issues.  

So, is it a problem switching from an existing dynamic expanding disks to fixed disks without harming the resident data.  If so, do you have the procedures? I just want to make sure if the change is possible that its done right.  Thanks.
The reason we use the above mentioned method is to avoid fragmentation. Though, in today's multi-disk systems fragmentation is not as much of an issue as it used to be.
Avatar of cmp119

ASKER

I think I will keep everything as is meaning the Guest os drive as fixed, and attached virtual drives as dynamically expanding.  Not sure how much fragmentation will take place within the long term though.  Referencing the new server setup, I may make all disks fixed, even a large 600gb drive for company file storage.
Avatar of cmp119

ASKER

Thank you for your feedback.