Index: vagrant-mount-disk.sh |
diff --git a/vagrant-mount-disk.sh b/vagrant-mount-disk.sh |
new file mode 100755 |
index 0000000000000000000000000000000000000000..379a3cbdd901a52a954b82528fc8d9dbe4dbea25 |
--- /dev/null |
+++ b/vagrant-mount-disk.sh |
@@ -0,0 +1,30 @@ |
+#!/bin/sh |
+ |
+set -e |
+set -x |
+ |
+if [ -f /home/vagrant/disk_added_date ] |
+then |
+ echo "Disk already added, exiting" |
+ exit 0 |
+fi |
+ |
+# create partition |
+sudo fdisk -u /dev/sdb <<EOF |
+n |
+p |
+1 |
+ |
+ |
+w |
+EOF |
+ |
+# format and mount |
+sudo mkfs.ext4 /dev/sdb1 |
+mkdir -p /home/vagrant/build |
+sudo mount -t ext4 -o rw /dev/sdb1 /home/vagrant/build |
+sudo chown vagrant:vagrant /home/vagrant/build |
+sudo echo "/dev/sdb1 /home/vagrant/build ext4 defaults 0 0" >> /etc/fstab |
+ |
+date > /home/vagrant/disk_added_date |
+sudo chown vagrant:vagrant /home/vagrant/disk_added_date |