1

I am getting an error while trying to resize System Partition for Windows 2003 Server (this is a VM on a Hyper-v Windows Server 2008) using GParted Live CD ISO.

Followed this tutorial: http://malaysiavm.com/blog/how-to-resize-windows-2003-server-virtual-disk-on-vmware-esx/ and GParted Doc http://gparted.sourceforge.net/larry/resize/resizing.htm (They are very similar)

The VM has a Dynamic VHD file, I have already increased it using Hyper-v. GParted doesn't give any clues or details for the error. Just simply errors when trying to grow the partition. Any ideas what I can do? Thanks!

Using version of Gparted: gparted-live-0.13.1-2

Bret Fisher
  • 3,973
  • 2
  • 21
  • 25
Dina
  • 189
  • 1
  • 9

3 Answers3

2

As @TheCleaner says, use diskpart from a Windows 2008+ install .iso. I always prefer to use Microsoft-supported tools and processes when messing with partitions and disks.

Assuming you've expanded .vhd inside Hyper-V console:

  1. Attach a Vista/win2008 or newer install .iso to the VM settings
  2. Boot to the .iso and once you're at setup prompts, hit shift-f10 to get Command Prompt
  3. diskpart
  4. something similar to:
    1. list disk
    2. select disk 0
    3. list partition
    4. select partition 1
    5. extend
    6. exit
  5. now reboot and windows should have all the space you expanded the .vhd for

P.S. If you have more then one partition in that .vhd and you're wanting to extend any other then the last one, it's a no go with diskpart (TMK).

Bret Fisher
  • 3,973
  • 2
  • 21
  • 25
  • Using a newer version of Windows actually corrupted the VHD file - which has was Windows Server 2003 – Dina Oct 01 '12 at 23:18
  • Not sure why that would happen. Have done this exact thing on a few dozen production servers. It's actually the only Microsoft-supported way to expand a .VHD (that I know of). – Bret Fisher Oct 02 '12 at 04:13
  • Since your answer was the only one that let me expand the drive (even though it corrupted it), I'll mark it as the answer. I think I'm facing some anomaly anyway. – Dina Oct 02 '12 at 14:17
  • Have you tried mounting the .vhd as a 2nd drive on another VM and running chkdsk on it? – Bret Fisher Oct 02 '12 at 20:26
0

I've used the following method with VMware VM"s many times. I'm assuming it will work with Hyper-V VM's as well:

  1. Shut down the VM in question.

  2. Attach the VHD from this VM to a second VM. Extend the volume from within the OS of the second VM.

  3. Detach (do not delete) the VHD from the second VM.

  4. Power on the original VM.

Please make sure you have a recent, reliable backup first. As I said, I've used this method for VMware VM's but never for a Hyper-V VM.

joeqwerty
  • 109,901
  • 6
  • 81
  • 172
  • Sounds interesting & worth a try, does it being a system/boot partition matter? And thanks!! – Dina Sep 13 '12 at 21:20
  • same here but using diskpart and not the gui. System/boot partitions will work this way. Again same as joe, only done it in vmware. – TheCleaner Sep 13 '12 at 21:26
  • @Dina, That's precisley why I did it... because it was the system partition and couldn't be extended in the Disk Management MMC or using diskpart. I've used Gparted before but always wind up getting errors so I gave up on that and have used this method ever since. – joeqwerty Sep 13 '12 at 21:29
  • Well, Windows (2nd VM) is telling me that this is a System disk & cannot be extended. – Dina Sep 13 '12 at 21:42
  • Was that in the GUI or in diskpart? – joeqwerty Sep 13 '12 at 21:43
  • Windows Disk Manager. Going to try remounting VHD as IDE Controller 1 (not sure if makes a difference). – Dina Sep 13 '12 at 21:44
  • Try diskpart. If that doesn't work then I'm wondering if you can P2V (V2V) the machine and extend the disk as part of the conversion. – joeqwerty Sep 13 '12 at 21:47
  • Tried dispart, though it said it was successful, it actually did nothing. Shocking. I cannot believe how complex this is. Going home, resume tomorrow. – Dina Sep 13 '12 at 22:11
  • 1
    You resized the VM disk in hyper-v first right? Then use diskpart (on a 2nd machine like Joe said, and select the volume, extend. – TheCleaner Sep 14 '12 at 00:19
  • @TheCleaner, I guess I assumed that but good point. The VHD needs to be resized first. – joeqwerty Sep 14 '12 at 00:26
  • @TheCleaner & joeqwerty. Yes, I had resized the VM disk in Hyper-v first. This is why when I run diskpart when attaching it to another VM, it shows as having free unallocated space. – Dina Sep 14 '12 at 14:11
  • and then you ran the extend command on that correct volume, correct? I can't tell you for hyper-v but that's always worked for me. – TheCleaner Sep 14 '12 at 14:15
  • Starting to second guess myself. Giving it another try. – Dina Sep 14 '12 at 14:23
  • Tried again with diskpard and VHD attached to another VM. Diskpart tells me that it successfully extended the volume, but when I check the volume again ("detail volume") - it shows the same information & the same amount of free space. So diskpart didn't actually do anything. – Dina Oct 01 '12 at 20:54
  • Tried the same process but using Hyper-v on Windows 2008R2. It extended the disk but corrupted windows on it. – Dina Oct 01 '12 at 23:17
0

By "Hyper-V Windows Server 2008" do you mean Windows Server 2008 with the Hyper-V role installed, or do you mean Hyper-V Server 2008? In case of the former do this:

  • Shut down the VM.
  • Start diskmgmt.msc on the hypervisor.
  • Click Action > Attach VHD and select the VHD file.
  • Right-click the volume, select Extend volume... and click through the wizard.
  • Right-click on the info box left of the volume and select Detach VHD.
  • Start the VM.

On Server 2008 you could attach the VHD file with a couple lines VBScript:

Set wmi = GetObject("winmgmts://./root/virtualization")
Set vhdSvc = wmi.ExecQuery("SELECT * FROM Msvm_ImageManagementService").ItemIndex(0)
vhdsvc.mount("C:\PATH\TO\your.vhd")     ' attach
vhdsvc.unmount("C:\PATH\TO\your.vhd")   ' detach

and then try diskpart to set the disk online and extend the volume.

Ansgar Wiechers
  • 4,247
  • 2
  • 18
  • 26
  • "By "Hyper-V Windows Server 2008" do you mean Windows Server 2008 with the Hyper-V role installed" Yes. The Option "Action > Attach VHD" is not available to me. Using 2008 and not 2008 R2 and therefore I don't think this is available to me. – Dina Sep 14 '12 at 14:37
  • Updated answer. – Ansgar Wiechers Sep 14 '12 at 15:30