如果你想改變vbox裡某個vdi的uuid檔,你會發現vbox會出現uuid衝突而無法直接使用,這種情形最常發生在更改了vdi檔名然後想重新安裝os。在google上找更改uuid的方法,其參數似乎已經不適用,4.0.x以上的版本應該改用sethduuid參數而不是舊的setvdiuuid。
我寫了一個shell script方便自己更改vdi的uuid:
- #!/bin/bash
- #############################################################
- # Filename: changeVDIuuid.sh
- # Date: 2011/05/29
- # Purpose: change uuid of vdi file
- # Usage:
- #
- # Description:
- # Author: maxsolar(Jim T. Tang@IES, Academia Sinica)
- #############################################################
- ###########################
- ## pre-defined variables
- ###########################
- [ "$1" == "" ] && {
- ls *vdi
- read -p "please specify a vdi file: " vdi
- [ -e "$vdi" ] && {
- VBoxManage internalcommands sethduuid $vdi
- } || {
- echo "$vdi doesn't exist. program terminated."
- }
- } || {
- [ -e "$1" ] && {
- VBoxManage internalcommands sethduuid $1
- } || {
- echo "$1 doesn't exist. program terminated."
- }
- }
沒有留言:
張貼留言