Preserving partitions when adding datastores to ESXi

I was recently building out a new ESXi box and bought a Seagate Barracuda 1.5Tb SATA 2 drive to use as the datastore as well as to backup some data from a laptop who’s hard drive was acting up. The hard drive was/is making all sorts of bad sounds, so I wanted to get the data backed up as quickly as possible. As soon as I got the drive home, I started backing up my data, rather than checking how vSphere handles disks with data already on them. When I was sure I had a clean backup, I moved to the ESXi 4.0 host to add the Barracuda, minus the 400 gig backup partition.

To my dismay, when I went to add the datastore through vSphere I was informed that the entire disk would be used and my backup partition would be overwritten. After a quick run through the vSphere interface to make sure I hadn’t missed an option somewhere to allow me to add only the unused space, I moved to the ESXi 4.0 maintenance console to try and create the datastore by hand.

Below are the steps I ended up using to create the vmfs3 partition without losing my backup partition:

  1. Log into the ESXi 4.0 maintenance console as root
  2. Open the new disk with fdisk
  3. Create a new primary partition that uses the remaining space on the disk.
  4. Set the partition type to VMFS (hex: fb)
  5. Use vmkfstools to create  the VMFS3 file system (vmkfstools -C vmfs3 /dev/disks/[yourdevice]:[parition number])*
  6. Exit the ESXi 4.0 maintenance console
  7. Under the vSphere client, again as root, select the “Configuration” tab, then select “storage” and click “refresh” in the upper right-hand corner

Your new datastore has now been added while protecting your backup partition and it’s data. Through the “Configuration” tab you can also rename this datastore to something more friendly than the UUID ESXi assigns it by default.

Footnotes:

* the device name and partition number under ESXi is dynamic, so you’ll need to replace this with whatever is valid for your system. Generally, the partition number is following the device name and a colon (:). The partition number should correspond the the partition number you created with fdisk, not your backup partition.

About samurai

I like computers... A lot. So I tend to spend a lot of time doing varied things with them. Often you'll find me playing with Python or PHP, fighting with operating systems, ranting about some off-the-wall concept, or preparing for zombies.
This entry was posted in Guides and tagged , , , , , , , , , , , . Bookmark the permalink.

One Response to Preserving partitions when adding datastores to ESXi

  1. PManual says:

    Awesome article….I’m just starting to learn ESXi and your post helped a lot to say the least.

    Though I’ve used Unix/Linux before I’m not used to setting up disks/partitions.. Here is an article on FDISK that got me through steps 2, 3,4 that can help other readers..

    http://tldp.org/HOWTO/Partition/fdisk_partitioning.html

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>