If you are installing Windows Server 2000, 2003 or Windows XP on a physical server or desktop, you cannot fix disk alignment at the time of installation with the Windows media. (This is not a problem with Windows 2008 or Windows 7). Once Windows has been installed, there is no way to fix the alignment, it must be done at the time the partition is created. You won't have the proper tools until after Windows is installed.
Fortunately with a Virtual Machine disk alignment can be performed before the OS is ever installed. You simply mount the disk to another VM and from within that VM run disk part. Or use a 3rd party tool to align the disk.
- Attach the disk to another window VM and from within that VM use DISKPART lets see if the disk is aligned or not. You can also do this in a running VM to discover if the disks are aligned or not.
DISKPART list disk Select Disk 0 List partition
My output shows the following, you can see from the Offset, that the system is NOT disk aligned. Since this a running system with an installed OS, I am going to have to make sure that I don't destroy data.
DISKPART> list partition Partition ### Type Size Offset ------------- ---------------- ------- ------- Partition 1 Primary 148 GB 31 KB
If this is your very first VM, then there is a catch-22, you won't able to Disk Align the system disk without using a 3rd party tool and you won't have another VM to mount the disk and do the alignment. I use the Linux iso with the gparted application to create an aligned partition, this will work to align disks that have data (this does not work with the OS System disk).1 You can also use the Partition Alignment Tool from Paragon ($30).
So, build a small VM initially,and toss it later. Or use one of the above tools. gparted is an excellent tool to align data disks that already contain data. Make sure you have a backup, any time to manipulate disk structures. If you don't have backups don't do this.
- Mount the disk in another VM. Run diskpart
- list disk.
DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- * Disk 0 Online 149 GB 301 MB Disk 1 Online 20 GB
- select disk #
DISKPART> select disk 1 Disk 1 is now the selected disk.
- list partition -- you should not have any partitions. If you do, then running the next command will destroy data. I do this only as a double check to make sure I have an empty disk.
- Create the primary partition with an alignment of 1024. I use 1024 because this is the default block sizing for NTFS when the disk is formatted.
DISKPART>create partition primary align=1024 DiskPart succeeded in creating the specified partition. DISKPART>
Congratulations, you have now "disk aligned" your disk. Remove this disk from the VM used in step 1 and use it now with your template, or a VM build. The disk is aligned. This is the system I will use as my template and build all my other VMs. You can proceed now to build your VM as you would in the past. If you used GPARTD or the Paragon Partition Alignment Tool then you should be good to go, unmount the CD and being your OS install, you won't have to remove this disk from the VM that you mounted.
1 It is possible to do this, but you will likely corrupt the boot sector, and that will require a reinstall of the boot loader. I consider this an expert procedure, beyond what I am explaining here. If the interest is there I will write an article about reinstalling the boot loader after disk-alignment of the OS partitions.