Skip to content

Instantly share code, notes, and snippets.

@ApprenticeGC
Created January 24, 2012 04:13
Show Gist options
  • Save ApprenticeGC/1667753 to your computer and use it in GitHub Desktop.
Save ApprenticeGC/1667753 to your computer and use it in GitHub Desktop.
Partial script to show how to create hd in VirtualBox
commandVBoxManage = 'VBoxManage'
hdSuffixNames = ['boot',
'root',
'tmp',
'var',
'usr',
'usr-local',
'swap',
'home']
def createHDHelper(vmName, suffixName, hdSize):
actionCommand = 'createhd'
hdName = vmName + '-' + suffixName + '.vdi'
hdFile = os.path.join(vmName, hdName)
command = [commandVBoxManage,
actionCommand,
'--filename',
hdFile,
'--size',
str(hdSize)]
subprocess.call(command)
def createHD(vmName):
index = 0
for hdSuffixName in hdSuffixNames:
if index == 0:
createHDHelper(vmName, hdSuffixName, 2048)
else:
createHDHelper(vmName, hdSuffixName, 2048)
index += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment