Last active
May 19, 2019 03:50
-
-
Save andreafortuna/69a075440037db9d0dcbb4c6f751d378 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Simple script for VirtuaBox filesystem bodyfile creation | |
# Usage: vbfilesystembodyfile.sh <VM name> | |
disk=`echo $( sudo VBoxManage showvminfo $1|grep "vdi\|vmdk"|head -n 1|cut -d ":" -f 2|cut -d "(" -f 1)|xargs` | |
VBoxManage clonemedium $disk ./$1.raw --format=raw | |
offset=$(mmls $1.raw -a | grep `mmls $1.raw -a | grep "000:" | cut -d " " -f 9 | sort -r | head -1` | cut -d " " -f 6 | bc) | |
fls -o $offset -r -m / $1.raw > $1.bodyfile | |
rm $1.raw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment