Vagrant: Trouble Using Linked Clones with VMware Workstation

Created on 29 Dec 2015  路  19Comments  路  Source: hashicorp/vagrant

Hello,
I just installed Vagrant 1.8.1 and I am trying to use linked clones with VMware Workstation, but it seems to only be doing full clones. I saw in this article that it isn't enabled by default. Any suggestions on how to turn it on?

Here are my installed plugins:

PS C:\> vagrant plugin list
winrm-fs (0.2.3)
vagrant-share (1.1.5, system)
vagrant-vmware-workstation (4.0.5)
vagrant-winrm (0.7.0)

Thank you for your help.

bug hoswindows providevmware

All 19 comments

Hi @PrahlM93

Do you have VMware Workstation or VMware Workstation Pro? Linked clones are only available in the pro versions of the VMware products.

Hi @sethvargo, I am running VMware Workstation Pro 12.1

Hi @PrahlM93

Can you please share the Vagrantfile and gist the output of the command in debug mode?

@sethvargo, here is the Vagrant file in my Vagrant Box


# The contents below were provided by the Packer Vagrant post-processor


# The contents below (if any) are custom contents provided by the
# Packer template during image build.
# The contents below (if any) are custom contents provided by the
# Packer template during image build.
# -*- mode: ruby -*-
# vi: set ft=ruby :

current_version = Gem::Version.new(Vagrant::VERSION)
windows_version = Gem::Version.new("1.6.0")

Vagrant.configure("2") do |config|

    if current_version < windows_version
      if !Vagrant.has_plugin?('vagrant-windows')
        puts "vagrant-windows missing, please install the vagrant-windows plugin!"
        puts "Run this command in your terminal:"
        puts "vagrant plugin install vagrant-windows"
        exit 1
      end

      # Admin user name and password
      config.winrm.username = "vagrant"
      config.winrm.password = "vagrant"

      config.vm.guest = :windows
      config.windows.halt_timeout = 15
      config.vm.boot_timeout = 420

      # Port forward WinRM and RDP
      config.vm.network :forwarded_port, guest: 5985, host: 85985, id: "winrm", auto_correct: true
      config.vm.network :forwarded_port, guest: 3389, host: 83389
    else
      config.vm.guest = :windows
      config.vm.communicator = "winrm"
    end

    if ENV['VAGRANT_SCRIPT']
        config.vm.provision "shell", path: ENV['VAGRANT_SCRIPT']
    end

    config.vm.provider :virtualbox do |v, override|
        v.customize ["modifyvm", :id, "--memory", 2048]
        v.customize ["modifyvm", :id, "--cpus", 2]
    end

    config.vm.provider "vmware_workstation" do |v|
        v.vmx["memsize"] = "2048"
        v.vmx["numvcpus"] = "2"
        v.vmx["tools.upgrade.policy"] = "manual"
    end
end

Here are the debug logs prior to the cloning:
https://gist.github.com/PrahlM93/4c7e25e66bca6b4a018b

I have the same issue. Vagrant does not create linked clone, but copies all the box files.

I use VMware庐 Workstation 12 Pro version 12.1.0 build-3272444.

vagrant up --debug
 INFO global: Vagrant version: 1.8.1
 INFO global: Ruby version: 2.2.3
 INFO global: RubyGems version: 2.4.5.1
...
 INFO handle_box: Machine already has box. HandleBox will not run.
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::PrepareClone:0x475e2d0>
 INFO warden: Calling IN action: VMware Middleware: Import
 INFO import: VMX file not in metadata, attempting to discover...
DEBUG import: Cloning into: c:/dev/vagrant/.vagrant/machines/vagrant-windows-7/vmware_workstation/322c4ec7-be24-43d2-86eb-63b15d42b161
 INFO import: VMX file: C:/Users/Jozef/.vagrant.d/boxes/windows_7_pro_x64/0/vmware_desktop/packer-vmware-iso.vmx
 INFO interface: info: Cloning VMware VM: 'windows_7_pro_x64'. This can take some time...
 INFO interface: info: ==> vagrant-windows-7: Cloning VMware VM: 'windows_7_pro_x64'. This can take some time...
==> vagrant-windows-7: Cloning VMware VM: 'windows_7_pro_x64'. This can take some time...
 INFO vmware_driver: Cloning VM to c:/dev/vagrant/.vagrant/machines/vagrant-windows-7/vmware_workstation/322c4ec7-be24-43d2-86eb-63b15d42b161

@sethvargo Any update to this for you paying customers?

FWIW: I'm having the same problem on OS X 10.11.6, VMware Fusion Pro 8.5.0, vagrant 1.8.5.

@LogicalChaos have you added something like this in your (global) Vagrantfile?

  config.vm.provider "vmware_fusion" do |v|
    v.linked_clone = true if Vagrant::VERSION =~ /^1.8/
  end

Yes, I was just working on updating my note to indicate this.

  config.vm.provider "vmware_fusion" do |vm|
    vm.gui = false
    vm.linked_clone = true if Vagrant::VERSION =~ /^1.8/
    vm.vmx["numvcpus"] = 6
    vm.vmx["memsize"] = 1024*3
  end

ok. It works in my setup and I'm really happy. OSX 10.11.6, Fusion Pro 8.5.0, Vagrant 1.8.1, vagrant-vmware-fusion (4.0.11)

I was fooled by the great size difference between virtualbox and vmware linked clones (and forgot the size of my VM). The virtualbox linked clone of a 12GB vm starts as 'empty', and after full typical usage, goes to 4GB. The vmware linked clone starts as 'empty', jumps to 4GB immediately during boot, and increases to 7GB after full typical usage. Is vmware that poor with their linked clones? Something odd about my vm?

It's odd, I can't create a linked clone through the vmware gui for vagrant images, it indicates it "Could not find the file". I wonder if there is an issue with the master vm coming from ~/.vagrant.d/...

As for the vmware size of a linked clone, it's the vmem file that makes it appear so large when the vm is running. The vmdk diff file is a reasonable size.

Hi there,

Thanks for reporting this bug. I'm sure this was a real issue when originally reported (our fault for not looking sooner!) but there have been multiple Vagrant releases since the original report. I'm going to close this issue now and request you reopen the issue if you're still experiencing this problem. I'm sorry this wasn't looked at earlier :frowning_face:

Cheers!

@chrisroberts Although it's an old issue, it's still there in Vagrant 1.9.1. I think it has more to do with the vagrant-vmware-workstation plugin. It works on Mac, but doesn't work on Windows.

Video of vagrant up on Mac / Windows

vagrant-up-linked-clone-mac-windows

Mac

~/code/test
$ cat Vagrantfile 
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box          = "windows_2016_docker"
  config.vm.communicator = "winrm"

  ["vmware_fusion", "vmware_workstation"].each do |provider|
    config.vm.provider provider do |v, override|
      v.gui = true
      v.memory = 2048
      v.cpus = 2
      v.linked_clone = true
      v.vmx["vhv.enable"] = "TRUE"
      v.enable_vmrun_ip_lookup = false
    end
  end
end
~/code/test
$ vagrant version
Installed Version: 1.9.1
Latest Version: 1.9.1

You're running an up-to-date version of Vagrant!
~/code/test
$ vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Cloning VMware VM: 'windows_2016_docker'. This can take some time...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Fixed port collision for 3389 => 3389. Now on port 2208.
==> default: Fixed port collision for 22 => 2222. Now on port 2209.
==> default: Fixed port collision for 5986 => 55986. Now on port 2210.
==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: WinRM address: 192.168.254.133:5985
    default: WinRM username: vagrant
    default: WinRM execution_time_limit: PT2H
    default: WinRM transport: negotiate
==> default: Machine booted and ready!
==> default: Forwarding ports...
    default: -- 3389 => 2208
    default: -- 22 => 2209
    default: -- 5985 => 55985
    default: -- 5986 => 2210
==> default: Configuring network adapters within the VM...
==> default: Configuring secondary network adapters through VMware 
==> default: on Windows is not yet supported. You will need to manually
==> default: configure the network adapter.
==> default: Enabling and configuring shared folders...
    default: -- /Users/stefan/code/test: /vagrant
~/code/test
$ ls ~/Desktop/
Bildschirmfoto 2016-12-09 um 07.12.14.png giving-up-stack-overflow.png
MSTS2016                                  vagrant-up-linked-clone-mac-windows.mov
~/code/test
$ du -h .
  0B    ./.vagrant/machines/default/virtualbox
4.0K    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/564dd74f-4dce-2fa3-998f-bc15b280774d.vmem.lck
1.2M    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/appListCache/appData
8.0K    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/appListCache/appsToPublish
8.0K    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/appListCache/fixedItems
 16K    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/appListCache/launchMenu
8.0K    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/appListCache/recentDocuments
1.2M    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/appListCache
4.0K    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/disk-cl1.vmdk.lck
4.0K    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b/WindowsServer2016Docker.vmx.lck
2.4G    ./.vagrant/machines/default/vmware_fusion/8f57977f-47f1-4d60-b7e5-02ea17f6298b
2.4G    ./.vagrant/machines/default/vmware_fusion
2.4G    ./.vagrant/machines/default
2.4G    ./.vagrant/machines
2.4G    ./.vagrant
2.4G    .

Only the memory is stored in the ./.vagrant folder on Mac, so there is a linked clone.

Windows

PS C:\test> cat .\Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box          = "windows_2016_docker"
  config.vm.communicator = "winrm"

  ["vmware_fusion", "vmware_workstation"].each do |provider|
    config.vm.provider provider do |v, override|
      v.gui = true
      v.memory = 2048
      v.cpus = 2
      v.linked_clone = true
      v.vmx["vhv.enable"] = "TRUE"
      v.enable_vmrun_ip_lookup = false
    end
  end
end
PS C:\test> vagrant version
Installed Version: 1.9.1
Latest Version: 1.9.1

You're running an up-to-date version of Vagrant!
PS C:\test> vagrant up
Bringing machine 'default' up with 'vmware_workstation' provider...
==> default: Cloning VMware VM: 'windows_2016_docker'. This can take some time...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Fixed port collision for 3389 => 3389. Now on port 2200.
==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: WinRM address: 192.168.219.131:5985
    default: WinRM username: vagrant
    default: WinRM execution_time_limit: PT2H
    default: WinRM transport: negotiate
==> default: Machine booted and ready!
==> default: Forwarding ports...
    default: -- 3389 => 2200
    default: -- 22 => 2222
    default: -- 5985 => 55985
    default: -- 5986 => 55986
==> default: Configuring network adapters within the VM...
==> default: Configuring secondary network adapters through VMware
==> default: on Windows is not yet supported. You will need to manually
==> default: configure the network adapter.
==> default: Enabling and configuring shared folders...
    default: -- C:/test: /vagrant
PS C:\test> du -h .
1.0K    ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c/564d38c1-8df0-b10e-423b-08a5
eb12c028.vmem.lck
2.6M    ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c/caches/GuestAppsCache/appDat
a
17K     ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c/caches/GuestAppsCache/launch
Menu
2.6M    ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c/caches/GuestAppsCache
2.6M    ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c/caches
1.0K    ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c/disk.vmdk.lck
1.0K    ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c/WindowsServer2016Docker.vmx.
lck
18G     ./.vagrant/machines/default/vmware_workstation/54986625-1374-404a-af37-87c538620c9c
18G     ./.vagrant/machines/default/vmware_workstation
18G     ./.vagrant/machines/default
18G     ./.vagrant/machines
18G     ./.vagrant
18G     .
PS C:\test>

As you can see the Windows ./.vagrant folder is 18GByte, so there is no linked clone, but a complete copy of the fat basebox.

I'm using vagrant-vmware-fusion / vagrant-vmware-workstation plugin version 4.0.15. I think you have to look in the plugin code to fix that.

@StefanScherer Okay, great. Thanks for confirming!. I'll open this back up and have a look on windows.

Thanks. Forgot to mention that my Windows setup is Windows 7 Enterprise with VMware Workstation Pro 12.5.

Hi! Linked clone support is now available on VMware Workstation in the latest plugin release (4.0.17)

Cheers!

Thank you. 馃憤

Was this page helpful?
0 / 5 - 0 ratings