Mount VMFS on Centos 7

Using a VMware VMFS filesystem in Linux
Tags: vmware centos linux |

Why VMFS on CentOS 7?

I was running a VMware ESXi server since 4 years. In VMware ESXi the options for local storage are limited, especially when you like redundant storage. The option is to buy a Raid adapter. I decided to move to CentOS with ZFS storage. Moving the VM’s to a Linux disk can be done by moving all the files to a NFS share, but an another option is to mount the VMFS filesystem. This is not natively available in Linux, but with fuse and vmfs-tools you can make it available. In this article I will describe how I did the installation and movement of the VM’s.

My baseline tools

I did a plain CentOS 7 installation, after the installation finished succesfully I connected my harddrive with the VMFS file system to the Linux box. The VMFS driver is not natively available, so you need to compile it yourself. Glandium programmed a userspace VMFS driver for linux, more about this can be found here: http://glandium.org/blog/?p=2539

Howto compile VMFS for CentOS 7?

Enable the EPEL repository for additional packages

1wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
2sudo rpm -Uvh epel-release-7*.rpm

Install the following packages for userspace filesystems

1yum install libuuid-devel
2yum install fuse fuse-devel

Download the VMFS sourcecode

1wget http://glandium.org/projects/vmfs-tools/vmfs-tools-0.2.5.tar.gz
2tar -xvzf vmfs-tools*

Unpack and compile

1cd vmfs-tools-0.2.5
2./configure
3make
4make install

The programs will be installed in /usr/local/sbin

To mount a VMFS file system:

./vmfs-fuse /dev/sdb1 /mount

*When you recognize that vmfs-fuse command is not available on you’re system make sure that fuse, fuse-devel and libuuid-devel is installed before compiling.

Files can now be accessed from /mount

Thin-provisioned VMDK’s are copied as Pre-Allocated VMDK’s

I copied all the vm’s to my local Linux file system, but had some issues with the thin-provisoned vmdk’s. The become pre-allocated vmdk’s which uses a lot of space. With the following command you can convert them back to growing disks:

vmware-vdiskmanager -r sourceDisk.vmdk -t 0 targetDisk.vmdk

Conclusion

Installing the VMFS drives on Linux / CentOS can be usefull in case of migrations, but also in case of an emergency. It is realative easy to browse you’re VMFS filesystem from a non-VMware host.