[時隔很久,纔來更新本文,因爲遇到了新的情況,並且發現的以前的一些錯誤,特別改正過來](原文鏈接 http://ddbiz.com/?p=120)
vmware server 2.x 中,不能添加物理磁盤,WebUI界面上沒有這麼個選項,不過不用擔心,只是界面上不行,我們可以通過手動操作來達到我們的目標。
注:虛擬機的名字爲 abc
編輯虛擬機的配置文件 abc.vmx, 這個文件通常是放在你的虛擬機存放目錄中的,如 /var/lib/vmwareos/abc/....vmx
#!/usr/bin/vmware
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "4"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
memsize = "256"
scsi0:0.present = "TRUE"
scsi0:0.fileName = "abc.vmdk"
ide1:0.present = "FALSE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"
floppy0.fileName = "/dev/fd0"
Ethernet0.present = "TRUE"
Ethernet0.virtualDev = "e1000"
displayName = "abc"
guestOS = "other26xlinux-64"
priority.grabbed = "normal"
priority.ungrabbed = "normal"
autostart="poweron"
autostart.delay=10
ide1:0.clientDevice = "TRUE"
floppy0.present = "FALSE"
workingDir = "."
gui.powerOnAtStartup = "TRUE"
toolScripts.afterPowerOn = "TRUE"
scsi0:0.redo = ""
scsi0:1.redo = ""
ethernet0.addressType = "generated"
uuid.location = "56 4d bf 48 4a 89 99 f3-9a ea 08 9b ef 7c 2c 83"
uuid.bios = "56 4d 24 4c a4 97 19 f8-3e 36 c6 18 de 94 60 78"
ethernet0.generatedAddress = "00:0c:29:94:60:78"
ethernet0.generatedAddressOffset = "0"
scsi0:1.present = "TRUE"
scsi0:1.fileName = "abc-disk1.vmdk"
scsi0:1.deviceType = "rawDisk"
... ...
如上配置中 scsi0:1 是從vmware server 1.x 升級到vmware server 2.x 時自動加載的配置,我們要做的只是需要模擬這個配置即可。
加入下面的配置:
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1:0.present = "TRUE"
scsi1:0.fileName = "abc-disk2.vmdk"
scsi1:0.deviceType = "rawDisk"
/dev/sdc:multcount = 0 (off)IO_support = 1 (32-bit)readonly = 0 (off)readahead = 256 (on)geometry = 121601/255/63, sectors = 1953525168, start = 0
就是這麼簡單,重新啓動虛擬機,看看新磁盤已經正確加載了
fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 16 128488+ 83 Linux
/dev/sda2 17 2553 20378452+ 83 Linux
/dev/sda3 2554 2610 457852+ 82 Linux swap / Solaris
Disk /dev/sdb: 160.0 GB, 160040803840 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 19457 156288321 83 Linux
Disk /dev/sdc: 320.0 GB, 320069435392 bytes
255 heads, 63 sectors/track, 38912 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 38914 312567808 83 Linux
/dev/dca 是vmware虛擬機中的虛擬此盤;
/dev/sdb 是vmware server 2.x 升級時自動攜帶過來的,:-),並且它的createType = "partitionedDevice";
/dev/sdc 就是我們手動添加的設備,"/dev/sdc"剛巧是和host中設備順序一致而已。
(原文鏈接 http://ddbiz.com/?p=120)
好了,至此完美解決。