如何系统准备VMware映像并保留我的附加硬盘驱动器

我正在创build一个基本VM,作为我希望成为我经常使用的所有机器configuration的VM树的开始。

在这个基础机器上,我有一个10GB的小型系统驱动器和一个40GB的大型数据驱动器。 当我sysprep虚拟机,它删除了额外的硬盘驱动器。 那么它仍然会出现,但服务器pipe理器报告它离线。

我在答案文件中有以下内容

<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ComputerName></ComputerName> <RegisteredOrganization>XXXXXX</RegisteredOrganization> <RegisteredOwner>XXXXXX</RegisteredOwner> <ShowWindowsLive>false</ShowWindowsLive> </component> <component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SkipAutoActivation>true</SkipAutoActivation> </component> <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <IEHardenAdmin>false</IEHardenAdmin> <IEHardenUser>false</IEHardenUser> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <InputLocale>0809:00000809</InputLocale> <SystemLocale>en-GB</SystemLocale> <UILanguage>en-GB</UILanguage> <UserLocale>en-GB</UserLocale> </component> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RegisteredOrganization>Company Name</RegisteredOrganization> <RegisteredOwner>Company Name</RegisteredOwner> <UserAccounts> <AdministratorPassword> <Value>cwBoAEAAcgBlAHAAbwAxAG4AdABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFAAYQBzAHMAdwBvAHIAZAA=</Value> <PlainText>false</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value>cwBoAEAAcgBlAHAAbwAxAG4AdABQAGEAcwBzAHcAbwByAGQA</Value> <PlainText>false</PlainText> </Password> <Domain>WORKGROUP</Domain> <Enabled>true</Enabled> <LogonCount>2</LogonCount> <Username>Administrator</Username> </AutoLogon> <OOBE> <HideEULAPage>true</HideEULAPage> <NetworkLocation>Work</NetworkLocation> <ProtectYourPC>3</ProtectYourPC> </OOBE> <Display> <ColorDepth>32</ColorDepth> <HorizontalResolution>1440</HorizontalResolution> <VerticalResolution>900</VerticalResolution> </Display> <TimeZone>GMT Standard Time</TimeZone> </component> </settings> <settings pass="generalize"> <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> </component> <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> </component> </settings> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk wcm:action="add"> <ModifyPartitions> <ModifyPartition wcm:action="modify"> <Active>true</Active> <Letter>D</Letter> <PartitionID>1</PartitionID> <Label>Data</Label> <Order>1</Order> </ModifyPartition> </ModifyPartitions> <DiskID>1</DiskID> <WillWipeDisk>false</WillWipeDisk> </Disk> </DiskConfiguration> </component> </settings> <cpi:offlineImage cpi:source="catalog:c:/users/chalee/desktop/install_windows server 2008 r2 serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> </unattend> 

我假设ModifyPartition部分将我的第二个驱动器设置为在线,但没有骰子!

有人能帮忙吗? 应该如何configuration应答文件来启用第二个驱动器?

我通过编写一个diskpart脚本解决了这个问题。

剧本非常简单:

 select disk 1 online disk 

我把它保存为c:\ windows \ setup \ scripts \ partdisk.txt

然后我创build了一个像这样的cmd脚本:

 partdisk /sc:\windows\setup\scripts\partdisk.txt 

这已添加到c:\ windows \ setup \ scripts中的Setupcomplete.cmd文件(如果不存在,请创build它),在第一次启动sysprepped计算机时,在Windows安装完成后执行此脚本。

这解决了这个问题,但它将成为在可用和有用的虚拟机镜像的顺利树上的道路上的许多问题的第一个。

如果我是你,我会在没有第二个磁盘的虚拟机上创build安装,closures它,然后复制.vmdk(普通的和平面的)。 在一个文本编辑器如vi中,在顶部(前5行左右)编辑它们(只能在一个上完成,我不记得是哪一个),你应该find虚拟机的名字。 将此和vmdk的名称更改为新VM的名称,然后在vSphere客户端中创build一个虚拟机。

在select要使用的硬盘时,只需select现有的硬盘,指向刚刚编辑和重命名的文件,然后选中“完成前的编辑选项”。 然后添加一个新的,任何大小的空HD。 之后,你可以启动它,sysprep虚拟机,一切都应该没问题。