VMFS: Unsupported version 5 - How to mount VMFS5 on Ubuntu


Intro


The VMFS is great, but it lacks from the support on Ubuntu and other Linux distributions. We all know the vmfs-tools package and the vmfs-fuse tool and there are a lot of great HowTos regarding its usage however its current official version - 0.2.1-1 - doesn't support VMFS5. The following is an output from my terminal when trying to mount VMFS5 formatted disk (/dev/sda1 in my case):


root@ubuntu:~# vmfs-fuse /dev/sda1 /mnt/
VMFS: Unsupported version 5
Unable to open device/file "/dev/sda1".


According to some various tips I have finally managed to mount the VMFS5 drive on Ubuntu using the manually compiled 0.2.5-1 version anyway, but the support is extremely limited so far (e.g. there's no RW support). What I found is that the goal of the developers is to introduce stable internal API and the mkfs.vmfs tool prior to version 0.5 and the full write support prior to version 1.0. So far, please find the following instruction that will enable you to mount your VMFS5 drives on Ubuntu in RO mode. I was using regural Ubuntu Desktop 12.04 Live CD.


Installation


1) First of all boot the system from Ubuntu Desktop 12.04 Live CD and log in as a root user. Then download and extract the package file:

root@ubuntu:~# cd /tmp
root@ubuntu:/tmp# wget https://launchpad.net/ubuntu/+archive/primary/+files/vmfs-tools_0.2.5-1.tar.gz
root@ubuntu:/tmp# tar -xzf vmfs-tools_0.2.5-1.tar.gz
root@ubuntu:/tmp/vmfs-tools# cd vmfs-tools

2) Install all the prerequisites. For best practice refer to the README file. In general the following should be enough:

root@ubuntu:/tmp/vmfs-tools# apt-get install gcc make uuid-dev pkg-config libfuse-dev

If you need the man pages, you'll need to install asciidoc, xsltproc and docbook-xsl packages too.

3) Configure and compile the package:

root@ubuntu:/tmp/vmfs-tools# ./configure 
Checking for pkg-config...yes
Checking for uuid...yes
Checking for fuse...yes
Checking for asciidoc...no
Checking for xsltproc...no
Checking for docbook.xsl...no
Checking for strndup...yes
Checking for dlopen in -ldl...yes
Checking for posix_memalign...yes
echo "#if 1" > version
echo "#define VERSION \"v0.0.0.0.\"" >> version
echo "#else" >> version
echo VERSION := v0.0.0.0. >> version
echo "#endif" >> version
make: `config.cache' is up to date.
root@ubuntu:/tmp/vmfs-tools# make
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Idebugvmfs -Ilibvmfs -I/usr/include/uuid -Ilibreadcmd  -include version   -c -o debugvmfs/debugvmfs.o debugvmfs/debugvmfs.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Idebugvmfs -Ilibvmfs -I/usr/include/uuid -Ilibreadcmd     -c -o debugvmfs/variables.o debugvmfs/variables.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/scsi.o libvmfs/scsi.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/utils.o libvmfs/utils.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_bitmap.o libvmfs/vmfs_bitmap.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_block.o libvmfs/vmfs_block.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_dirent.o libvmfs/vmfs_dirent.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_file.o libvmfs/vmfs_file.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_fs.o libvmfs/vmfs_fs.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_heartbeat.o libvmfs/vmfs_heartbeat.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_host.o libvmfs/vmfs_host.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_inode.o libvmfs/vmfs_inode.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_lvm.o libvmfs/vmfs_lvm.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_metadata.o libvmfs/vmfs_metadata.c
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibvmfs -I/usr/include/uuid    -c -o libvmfs/vmfs_volume.o libvmfs/vmfs_volume.c
ar -r libvmfs/libvmfs.a libvmfs/scsi.o libvmfs/utils.o libvmfs/vmfs_bitmap.o libvmfs/vmfs_block.o libvmfs/vmfs_dirent.o libvmfs/vmfs_file.o libvmfs/vmfs_fs.o libvmfs/vmfs_heartbeat.o libvmfs/vmfs_host.o libvmfs/vmfs_inode.o libvmfs/vmfs_lvm.o libvmfs/vmfs_metadata.o libvmfs/vmfs_volume.o
ar: creating libvmfs/libvmfs.a
ranlib libvmfs/libvmfs.a
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ilibreadcmd     -c -o libreadcmd/readcmd.o libreadcmd/readcmd.c
ar -r libreadcmd/libreadcmd.a libreadcmd/readcmd.o
ar: creating libreadcmd/libreadcmd.a
ranlib libreadcmd/libreadcmd.a
gcc -o debugvmfs/debugvmfs debugvmfs/debugvmfs.o debugvmfs/variables.o libvmfs/libvmfs.a libreadcmd/libreadcmd.a   -ldl -luuid 
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ifsck.vmfs -Ilibvmfs -I/usr/include/uuid -include version   -c -o fsck.vmfs/vmfs_fsck.o fsck.vmfs/vmfs_fsck.c
gcc -o fsck.vmfs/fsck.vmfs fsck.vmfs/vmfs_fsck.o libvmfs/libvmfs.a   -luuid
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Iimager     -c -o imager/imager.o imager/imager.c
imager/imager.c: In function ‘skip_zero_blocks’:
imager/imager.c:165:13: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
gcc -o imager/imager imager/imager.o   
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ivmfs-fuse -Ilibvmfs -I/usr/include/uuid -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse    -c -o vmfs-fuse/vmfs-fuse.o vmfs-fuse/vmfs-fuse.c
gcc -o vmfs-fuse/vmfs-fuse vmfs-fuse/vmfs-fuse.o libvmfs/libvmfs.a   -luuid -pthread -lfuse -lrt -ldl
gcc  -Wall -O2 -g -D_FILE_OFFSET_BITS=64  -Ivmfs-lvm -Ilibvmfs -I/usr/include/uuid -Ilibreadcmd  -include version   -c -o vmfs-lvm/vmfs-lvm.o vmfs-lvm/vmfs-lvm.c
gcc -o vmfs-lvm/vmfs-lvm vmfs-lvm/vmfs-lvm.o libvmfs/libvmfs.a libreadcmd/libreadcmd.a   -ldl -luuid 
(echo "*.tar.gz"; \
echo "*.[ao]"; \
echo "*.xml"; \
echo "*.8"; \
echo "version"; \
echo "config.cache"; \
echo debugvmfs/debugvmfs; echo fsck.vmfs/fsck.vmfs; echo imager/imager; echo vmfs-fuse/vmfs-fuse; echo vmfs-lvm/vmfs-lvm; \
) > .gitignore
root@ubuntu:/tmp/vmfs-tools# make install
install -s -m 0755 debugvmfs/debugvmfs /usr/local/sbin/
install -s -m 0755 fsck.vmfs/fsck.vmfs /usr/local/sbin/
install -s -m 0755 vmfs-fuse/vmfs-fuse /usr/local/sbin/
install -s -m 0755 vmfs-lvm/vmfs-lvm /usr/local/sbin/
make: *** No rule to make target `debugvmfs/debugvmfs.8', needed by `/usr/local/share/man/man8/debugvmfs.8'.  Stop.

4) Now you should be able to mount the VMFS5 disk in RO mode without any issues:

root@ubuntu:/tmp/vmfs-tools# /usr/local/sbin/vmfs-fuse /dev/sda1 /mnt
root@ubuntu:/tmp/vmfs-tools# mount
/cow on / type overlayfs (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
/dev/sr0 on /cdrom type iso9660 (ro,noatime)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
/dev/fuse on /mnt type fuse (rw,nosuid,nodev,default_permissions)

Don't be confused with the rw option. The disk is mounted in RO mode.



10 comments:

  1. Thank before anything, I have been looking for detail post from last 2 days.

    I will really appreciate if you could help me. It is very simple, remove vmfs5 storage from one ESXi5.1 to attach to new one but first can't add without formatting either to new or old. I have tried many options. Here is what i see

    root@root-virtual-machine:/tmp/vmfs-tools$ vmfs-fuse
    VMFS: Unable to read FS information
    Unable to open filesystem
    root@root-virtual-machine:/tmp/vmfs-tools$ vmfs-fuse /dev/sda1 /mnt
    open: Permission denied
    Unable to open device/file "/dev/sda1".
    Unable to open filesystem
    root@root-virtual-machine:/tmp/vmfs-tools$ sudo vmfs-fuse /dev/sda1 /mnt
    VMFS VolInfo: invalid magic number 0x8d51c03a
    VMFS: Unable to read volume information
    Trying to find partitions
    Unable to open device/file "/dev/sda1".
    Unable to open filesystem
    root@root-virtual-machine:/tmp/vmfs-tools$ sudo vmfs-fuse /dev/sda3 /mnt
    Error stat()ing '/dev/sda3'
    root@root-virtual-machine:/tmp/vmfs-tools$ sudo vmfs-fuse /dev/sda1 /mnt
    VMFS VolInfo: invalid magic number 0x8d51c03a
    VMFS: Unable to read volume information
    Trying to find partitions
    Unable to open device/file "/dev/sda1".
    Unable to open filesystem
    root@root-virtual-machine:/tmp/vmfs-tools$ sudo fdisk -l

    Disk /dev/sda: 600.1 GB, 600124170240 bytes
    255 heads, 63 sectors/track, 72960 cylinders, total 1172117520 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x409cf129

    Device Boot Start End Blocks Id System
    /dev/sda1 63 8386622 4193280 6 FAT16
    /dev/sda2 8386623 8611902 112640 fc VMware VMKCORE

    Disk /dev/sdb: 1000.2 GB, 1000202273280 bytes
    255 heads, 63 sectors/track, 121601 cylinders, total 1953520065 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x409cf129

    Device Boot Start End Blocks Id System
    /dev/sdb1 63 8386622 4193280 6 FAT16
    /dev/sdb2 8386623 8611902 112640 fc VMware VMKCORE

    Disk /dev/sdc: 21.5 GB, 21474836480 bytes
    255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000c1ffe

    Device Boot Start End Blocks Id System
    /dev/sdc1 * 2048 39796735 19897344 83 Linux
    /dev/sdc2 39798782 41940991 1071105 5 Extended
    /dev/sdc5 39798784 41940991 1071104 82 Linux swap / Solaris
    root@root-virtual-machine:/tmp/vmfs-tools$

    ReplyDelete
  2. @George:

    Aren't /dev/sda2 or /dev/sdb2 the devices that you want to mount instead? That's at least what the output from fdisk command claims. That these are those containing the VMFS on them.

    ReplyDelete
  3. Exactly what I needed, nice write up, worked flawlessly.

    ReplyDelete
    Replies
    1. Worth noting, I used this to connect to a snapshot on my Dell Equallogic PS6100 SAN from an Ubuntu 12.04 box.

      Delete
  4. This worked great - THANK YOU! I was able to mount and view files from a .DD of a v5 VMFS that i could not otherwise access. (Ubuntu 12.04)

    ReplyDelete
  5. thanks, but have a quick question, can i mount two vmfs 5 storage luns and also will the speeds be slow if i make this ubuntu server as a nfs server

    ReplyDelete
    Replies
    1. I have never tried that. Would be happy to hear some feedback from your side.

      Delete
  6. Hi, thanks to this post i had the chance to install vmfs-tools on ubuntu 10.04 and successfully cloned VMFS5, using ddrescue, all my disk to a disk raw .img file.
    I would ask if anyone knows any recovery software to restore deleted VMs once mounted .img file locally.

    Any help is appreciated

    ReplyDelete
  7. Worked perfectly for me, thanks so much. I saw some of the warning messages on my side and was uncertain it had been successful, but after reading this I realized it was as installed as it would be.

    Thanks!

    ReplyDelete
  8. what about vmfs version 6? still unsupported?

    ReplyDelete