|
VMware Disk Alignment - Aligning VMFS and Linux using fdisk |
|
|
|
|
Written by Tom Hirt
|
|
Thursday, 09 April 2009 14:13 |
|
Page 3 of 4
Aligning VMFS and Linux using fdisk
The alignment procedure for VMFS and the Linux file system (whether it be ext3, ext2, riser, xfs etc.) is much the same as any other Linux file system. We’ll use fdisk’s expert mode to create a new partition with an aligned starting block and then format the file system. You should use this procedure for not only VMFS, but for your Linux virtual machines as well (changing the type in step 7 to 83.)
- If you’re not already on the service console as the root user, begin by becoming root
$ whoami thirt $ su - root Password: |
- Run fdisk on the device you would like to align. Depending on your configuration, this device will be different. Use the ‘fdisk –l’ to list all available devices; replacing ‘/dev/disks/vmhba32\:0\:0\:0’ in the command below with your device.
| $ fdisk /dev/disks/vmhba32\:0\:0\:0 |
Note that a ‘:’ is a special character in the Linux shell and must be escaped with a ‘\’
- Create a new partition
- Choose ‘p’ for a new primary partition
Command action e extended p primary partition (1-4) p
|
- When asked for the partition number, enter ‘1’
Partition number (1-4): 1
|
- Use all the defaults by pressing enter at the prompts
First cylinder (1-1088, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1088, default 1088): Using default value 1088
|
- The VMFS file system uses the type fb. Change the type to ‘fb’ on the new partition.
Command (m for help): t Selected partition 1 Hex code (type L to list codes): fb Changed system type of partition 1 to fb (Unknown) |
Note: If you were working with a traditional Linux partition, you would use type ‘83’ – the Linux file system.
- Enter expert mode
- Change the start block to a value that aligns with your stripe element size. I like to use a start block of 2048 (2048 = 1024KB), ESX v3.x and later default to 128 (128 = 64KB) or as we have already said, you could use a value provided by your storage admin.
Expert command (m for help): b Partition number (1-4): 1 New beginning of data (63-8385929, default 63): 2048
|
- Commit the changes to disk
Expert command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks. |
- If you are formatting a VMFS for VMware, you should use vmkfstools to format your file system. If you are formatting a Linux file system, you should use mke2fs or a similar tool to format your file system. It goes without saying that formatting a file system will destroy any existing data on the device so make absolute certain your working with the correct disk!
- To format a newly created VMFS, use the following syntax replacing ‘/dev/disks/vmhba32\:0\:0\:0\:1’ in the command below with your device and partition number.
| # vmkfstools –C vmfs3 –b 4m /dev/disks/vmhba32\:0\:0\:0\:1 |
Note that ‘:’ is a special character in the Linux shell and must be escaped with a ‘\’
- The formatting of a Linux file system can be slightly more complex due to the many different file systems and parameters offered like journaling. We cannot cover all the different file systems and their options, but for most, ext3 is an excellent choice (includes journaling.) The following syntax will format a file system as ext3, replace '/dev/sda1' with the device and partition you would like formatted.
|
|
Last Updated on Wednesday, 03 February 2010 20:19 |