config.vm.provider "virtualbox" do |v|
unless File.exist?(disk)
v.customize ['createhd', '--filename', disk, '--variant', 'Fixed', '--size', 40 * 1024]
end
v.customize ['storageattach', :id,
'--storagectl', 'SCSI',
'--port', 2, '--device', 0,
'--type', 'hdd', '--medium', disk]
v.memory = 1024 * 12
v.cpus = 8
end
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/xenial64"
ubuntu@ubuntu-xenial:~$ sudo fdisk /dev/sdc
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xba0f14ad.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-83886079, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-83886079, default 83886079):
Created a new partition 1 of type 'Linux' and of size 40 GiB.
Command (m for help):
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
ubuntu@ubuntu-xenial:~$ sudo mkfs.ext4 /dev/sdc1
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 10485504 4k blocks and 2621440 inodes
Filesystem UUID: 6ac968f6-0dde-4702-bf31-cc0a5f4fb770
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
/dev/sdc1 /gopath ext4 defaults 0 0
config.vm.provision "docker"
I’d suggest to use this in Vagrantfile; otherwise, you have to config docker group and so on.