ckstanley12
Contributor
Contributor

Align Partitions in ESXi 4

Jump to solution

I am installing a new ESXi 4 server on an HP DL380 G5 server with local hard drives and a P400 RAID controller. The OS partition consists of two 146G 15K SAS drives in a RAID 1+0 (mirrored) configuration. I have read that you need to align the partitions in order to get the best I/O performance, but all the instructions I see are for version 3.x. (I am following the document found here: ). Is it necessary to align partitions in version 4 or is that done automatically with the installation now?

Here are the instructions from that document:

*

Instructions for VMware VMFS Partition

Alignment Using fdisk

*

To check that your existing partitions are aligned, issue the command:
fdisk -lu
The output is similar to:
Device boot Start End Blocks Id System
/dev/sdj1 128 167766794 83883333+ fb Unknown
Aligned partitions start at 128. If the Start value is 63 (the default), the partition is not aligned.
If you choose not to use the VI Client and create partitions with vmkfstools, or if you want to
align the default installation partition before use, take the following steps to use fdisk to align
a partition manually from the ESX Server service console:
1. Enter fdisk /dev/sd<x> where <x> is the device suffix.
2. Determine if any VMware VMFS partitions already exist. VMware VMFS partitions are
identified by a partition system ID of fb. Type d to delete to delete these partitions.
Note: This destroys all data currently residing on the VMware VMFS partitions you delete.
Ensure you back up this data first if you need it.
3. Type n to create a new partition.
4. Type p to create a primary partition.
5. Type 1 to create partition No. 1.
6. Select the defaults to use the complete disk.
7. Type t to set the partition's system ID.
8. Type fb to set the partition system ID to fb (VMware VMFS volume).
9. Type x to go into expert mode.
10. Type b to adjust the starting block number.
11. Type 1 to choose partition 1.
12. Type 128 to set it to 128 (the array's stripe element size).
13. Type w to write label and partition information to disk.

Here are the results when I run fdisk -lu:

~ # fdisk -lu

Disk /dev/disks/mpx.vmhba1:C0:T1:L0: 146.7 GB, 146778685440 bytes

255 heads, 63 sectors/track, 17844 cylinders, total 286677120 sectors

Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System

/dev/disks/mpx.vmhba1:C0:T1:L0p1 63 286677119 143338528+ fb VMFS

Disk /dev/disks/mpx.vmhba1:C0:T0:L0: 146.7 GB, 146778685440 bytes

64 heads, 32 sectors/track, 139979 cylinders, total 286677120 sectors

Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System

/dev/disks/mpx.vmhba1:C0:T0:L0p1 8192 1843199 917504 5 Extended

/dev/disks/mpx.vmhba1:C0:T0:L0p2 1843200 10229759 4193280 6 FAT16

/dev/disks/mpx.vmhba1:C0:T0:L0p3 10229760 286677119 138223680 fb VMFS

/dev/disks/mpx.vmhba1:C0:T0:L0p4 * 32 8191 4080 4 FAT16 <32M

/dev/disks/mpx.vmhba1:C0:T0:L0p5 8224 520191 255984 6 FAT16

/dev/disks/mpx.vmhba1:C0:T0:L0p6 520224 1032191 255984 6 FAT16

/dev/disks/mpx.vmhba1:C0:T0:L0p7 1032224 1257471 112624 fc VMKcore

/dev/disks/mpx.vmhba1:C0:T0:L0p8 1257504 1843199 292848 6 FAT16

Partition table entries are not in disk order

~ #

I can't get past the first step in the instructions because they say I should see something like /dev/sd(x) in my output. What I have instead is /dev/disks/mpx.vmhba1.... Even if I try to substitute my output for what is listed in the output, I get an error message from the console.

Can you please provide me some guidance? I understand that once the ESXi is installed and datastores are created using the vClient, everything is well, but I need to know if I have to align the ESXi install first before I get to creating datastores in ESXi.

Thanks in advance for your input,

Chris

0 Kudos
1 Solution

Accepted Solutions
JoJoGabor
Expert
Expert

I jsut re-read your post. If you create the VMFS partition through the VI client, the partition will be aligned automatically so you dont need to use fdisk to align this. If you are using LInux guests, then you should align the partition within the VM. If you are using WIndows guests, then use diskpart to align the partitions.

View solution in original post

0 Kudos
15 Replies
JoJoGabor
Expert
Expert

Yes you should align the partitions to get the best IO performance. This is an OS issue so hasn't changed since moving to ESX4

0 Kudos
JoJoGabor
Expert
Expert

I jsut re-read your post. If you create the VMFS partition through the VI client, the partition will be aligned automatically so you dont need to use fdisk to align this. If you are using LInux guests, then you should align the partition within the VM. If you are using WIndows guests, then use diskpart to align the partitions.

0 Kudos
ckstanley12
Contributor
Contributor

Thank you very much. Do I need to be concerned with making sure that the EXSi installation itself is aligned?

Chris

0 Kudos
Ryan2
Enthusiast
Enthusiast

Bingo. If you format VMFS, there's no need to align the volume inside of the VM. Only caveat is NFS storage where the volume isn't VMFS format. As for the ESX root partition, I wouldn't worry about it.

ckstanley12
Contributor
Contributor

Thanks for your assistance! That's what I needed to know.

Chris

0 Kudos
cookieme
Enthusiast
Enthusiast

Hi

I've read a few posts about aligning and I want to ask if this is necessary if I install ESXi 4 on my internal RAID1 where I will also run my VMs?

It seems from the first post that this should be done, but if I understand correctly I perform the ESXi 4 installation and when I use the vClient the first time to access my host I can see that one large datastore has been created automatically.

So, to do this aligning business all I have to do is delete the datastore and create it manually?

Do I have to do anything when I create VMs with regards to their VMDKs?

Thanks

EDIT: Apparently VMware has deemed the document in the first post obsolete. I had a look at the new document, Performance Best Practices vSphere 4.0 and they talk about aligning, but I'd like some help with this.

0 Kudos
JoJoGabor
Expert
Expert

Hi,

You don't need to worry about the VMFS datastore - that will be aligned autaomatically unless you use vmkfstools to create the datastore. But you should align the partitions within the guest to 64k chunks. Windows 2008 does this autoatically, but for previous versions of Windows you will need to use the following diskpart commands:

diskpart

select disk x

create partition align=64

0 Kudos
cookieme
Enthusiast
Enthusiast

Hi JoJoGabor! Thanks for you reply.

Just to clarify what you are saying is that I do not have to do any additional steps apart from a normal installation of ESXi on my internal RAID1 and that the datastore that it automatically creates I also do not have to modify?

The only thing I need to do with regards to aligning is to run the three commands in each Windows VM (i.e. XP, 2003 Server) after I have installed the OS, correct?

Thank you

0 Kudos
JoJoGabor
Expert
Expert

Correct - you do not have to modify your VMware installation.

But you will need to align partitions BEFORE you install the OS. There is some debate over which partitions to align, some people say aligning the system partition has negligible effect but I always do it anyway for my templates. Always align any non-system partitions. he trick is how to get your partition aligned before installing windows onto it. You can probably use a partitioning tool such as Partition Magic but this is what I do:

Create a new or use an existing Windows Server VM, lets call it TestVM

Attach a second Virtual Hard Disk, this disk will be used as your template VM.

Within TestVM, run the diskpart commands on the newly attached disk (use list disk to see all disk numbers) to create an aligned partition - do not format it

Power Off TestVM and detach disk created above, but do not delete from disk

Create your Template VM without any Virtual Disks

Move the TestVM detached disk VMDK file to the location of the template VM

Modify TemplateVM to add hard disk, select use existing disk and browse to the VMDK in the template VM directory that you just moved

Power on the VM and install the OS using this disk partition - do not create a new partition but format it with NTFS

Once OS is installed, add any more hard disks that are required, then run the diskpart commands on these disks to align the partitions.

0 Kudos
cookieme
Enthusiast
Enthusiast

That was very clear! Unfortunately, I can't give you bonus points, but thank you very much Smiley Wink

0 Kudos
I-Like-VmWare-S
Contributor
Contributor

Hi,

Another way (for Windows 2003 servers) is to create a new VM. BUT! You will need an CD (or ISO) with ServicePack 2 (so, W2K3, SP2). Because the ALIGN parameter only works with DISKPART for Windows 2003 Server with SP2 installed. (so you must intergrate the SP2 in the W2K3 ISO).

During the fresh install, at the moment to create the new partition in de installation GUI, press SHIFT + F10.

A Command Prompt will open and you can use DISKPART to create an aligned partition.

Next, formatting the disk and resuming the installation.

You can also do the same (Shift F10) with an Windows 2008 edtion if you do not want to have the alignment start at 1024 (default for W2K8), but with another value (if your prefere to use exact the same value you are using on your SAN volume).

Works for me.

Greetings,

J.

0 Kudos
dcsmith2000
Contributor
Contributor

I guess I'll jump in on this one.

I have an ESXi 4.0 cluster of three DL380-G5 servers with shared iSCSI storage (NetApp). I have been reading NetApp's "NetApp and vSphere Storage Best Practices" document (TR-3749). I was reading about misaligned partitions and their MBRAlign tool to fix existing VMs. However, you can't copy it to ESXi.

I have read in this thread and other documents that "If you create the VMFS partition through the VI client, the partition will be aligned automatically" (JoJoGabor's post in this thread). If I understand the statement correctly, I have done this. However, when I look at the Partition Starting Offset of a new build VM in msinfo32.exe, it is the Windows default of 32,256 bytes. This is not evenly divisible by 4096 which is NetApp's recommendation.

For new builds, I can use DISKPART. However, for P2V conversions, I can't fix them after the fact.

Suggestions?

0 Kudos
JoJoGabor
Expert
Expert

If you used the VI Client, your VMFS partition is aligned. Now you need to align the NTFS partitions within WIdnows Using Diskpart. Both VMFS and NTFS should be aligned

0 Kudos
dcsmith2000
Contributor
Contributor

How does this help me with a P2V migration or fixing a misaligned Windows partition?

0 Kudos
JoJoGabor
Expert
Expert

I wouldnt bother changing anything on a P2V VM - its not worth the hassle!

If you really wanted to align it, something like Partition Magic might be able to do it for you

0 Kudos