Search code examples
vagrantvagrantfile

how to import vagrant without going through 'vagrant add box'


I have the vagrant 'virtualbox' virtual machine, however I can no longer access vagrant with another pc to retrieve my information contained in the virtual machine.

'ubuntu/focus'

how can I proceed?


Solution

  • In your project directory (the one where you have the Vagrantfile) vagrant will create . .vagrant folder. The content of this folder has the Virtalbox vm information

    for example:

    ls -all .vagrant/machines/default/virtualbox/
    total 72
    drwxr-xr-x  11 fhenri  staff   352 Aug 28 22:20 .
    drwxr-xr-x   3 fhenri  staff    96 Aug 27 22:38 ..
    -rw-r--r--   1 fhenri  staff    40 Aug 28 22:20 action_provision
    -rw-r--r--   1 fhenri  staff    10 Aug 28 22:18 action_set_name
    -rw-r--r--   1 fhenri  staff   148 Sep  6 09:42 box_meta
    -rw-r--r--   1 fhenri  staff     3 Aug 28 22:18 creator_uid
    -rw-r--r--   1 fhenri  staff    36 Aug 28 22:18 id
    -rw-r--r--   1 fhenri  staff    32 Aug 28 22:18 index_uuid
    -rw-------   1 fhenri  staff  1679 Aug 28 22:18 private_key
    -rw-r--r--   1 fhenri  staff   316 Sep  6 10:18 synced_folders
    -rw-r--r--   1 fhenri  staff    63 Aug 28 22:18 vagrant_cwd
    

    the name of the vagrant machine is default and provider is virtual box in this case.

    If you copy the virtual box VM into another PC, you also need to copy this folder or need to recreate it. It contains the id of virtual box VM which helps vagrant to map and link with the VM.