gadget Posted November 10, 2005 Share Posted November 10, 2005 Sorry if I am in the wrong place...I am using PE2005 as a primary deployment tool for our puters over here. Most options are fine and covered. Came across a scenario today that has stumped me.I want to split a hard disk into 2 seperate primary partitions. The second partition needs to be 4096mb in size and reside at the end of the disk. The disks are of different sizes so I need to create the partition at the end of the drive first.Previously we used gdisk in dos but the 32 bit version does not create new partitions. As I said, this would be nice to follow our processes and run through winpe, I know about diskpart but I cannot find a way of creating the second partition first unless I work out the exact offset to start the partition from....ANy help would be appreciated... Link to comment Share on other sites More sharing options...
gadget Posted November 10, 2005 Author Share Posted November 10, 2005 Didnt take long.Run a script to locate the size of the hdd in mb, took away 4096 and put in a dos variable %offsetsize% and run the diskpart commandcreate partition primary size=4096 offset=%offsetsize%then created the first partition.... Link to comment Share on other sites More sharing options...
hazard_abio Posted November 12, 2005 Share Posted November 12, 2005 Didnt take long.Run a script to locate the size of the hdd in mb, took away 4096 and put in a dos variable %offsetsize% and run the diskpart commandcreate partition primary size=4096 offset=%offsetsize%then created the first partition....sorry to be a pest, but, could we view this script you used to find the size of the hdd? Link to comment Share on other sites More sharing options...
mats Posted November 12, 2005 Share Posted November 12, 2005 this is one wayConst HARD_DISK = 3strComputer = "."Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colDisks = objWMIService.ExecQuery _ ("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")For Each objDisk in colDisks msgbox "DeviceID: " & objDisk.DeviceID msgbox "Disk Size: " & objDisk.size/1024/1024Next Link to comment Share on other sites More sharing options...
Turge Posted November 16, 2005 Share Posted November 16, 2005 Exactly the way we do it here.Diskpart.txt would look like this:select disk=0cleancreate partition primary size=<main>assign letter=ccreate partition primary size=<data>select volume 0select disk = 0select partition 2assign letter=dremove noerrselect partition 1activeSizepart.vbsConst ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Const OPEN_FILE_FOR_APPENDING = 8 Set fso = CreateObject("Scripting.fileSystemObject") Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive",,48)For Each objItem in colItems HD = int(objItem.Size/1000000000) DATA = 4 MAIN = HD - DATA DATA = ActualSize(DATA*1000) MAIN = ActualSize(MAIN*1000) Exit Fornext Set f = fso.GetFile("z:\diskpart.txt") Set ts = f.OpenAsTextStream(ForReading, Tristatefalse) t = ts.ReadAll ts.Close t = replace(t, "<main>", MAIN, 1, -1, 1) t = replace(t, "<data>", DATA, 1, -1, 1) Set objOutputFile = fso.OpenTextFile("z:\diskpart.txt", ForWriting) objOutputFile.Write t objOutputFile.Close Function ActualSize(Size) ActualSize=int(Size/1.024)End FunctionFunction TheoreticalSize(Size) TheoreticalSize = int(Size*1.024)End FunctionSTARTNET.CMD would then contain:copy x:\files\diskpart.txt z: > nulcscript x:\files\sizepart.vbsdiskpart /s z:\diskpart.txt > nulformat c: /FS:NTFS /V:MAIN /q /y > nulformat d: /FS:NTFS /V:DATA /q /y > nulYou'll have to forgive my code.. I modified it for your scenario. Our situation is a little more complicated since depending on the size of the HD, our 3rd partition can either be 2GB or 40% of the drive. Link to comment Share on other sites More sharing options...
hazard_abio Posted November 16, 2005 Share Posted November 16, 2005 Thank you both for posting. very helpful on both fronts. Link to comment Share on other sites More sharing options...
xponard Posted December 9, 2005 Share Posted December 9, 2005 Hi there!I have exactly the same need,My question is: what is the z:\ drive, how can i create/access it.(the x:\ drive means the CD device / PE source location)Thanks in advance. Link to comment Share on other sites More sharing options...
ChrisBaksa Posted December 9, 2005 Share Posted December 9, 2005 In most cases... Z: is the writeable Ram Disk. since the PE ISO is read only... Most people create a Z: drive for temp write space. It is not there by default. It must be added to your build.Chris Link to comment Share on other sites More sharing options...
mats Posted December 11, 2005 Share Posted December 11, 2005 And the info on how you do that is on this forum. Search for ramdrive and you will score hits Link to comment Share on other sites More sharing options...
xponard Posted December 12, 2005 Share Posted December 12, 2005 (edited) ok, i finally found how to add a writable RAMdisk (and get my own little Z: drive)(customized my PE : adding WMI support + script support + RAM disk support)i am trying to use the vbs script above but i am stuck on the fifth line (GetObject)> sizepart.vbs(5, 1) Microsoft VBScript runtime error: The remote server machine does not exist or is unavailable: 'GetObject'What i have missed...?Forget it I have completely restart the RAMdisk integration with the Johan Arwidmark procedure and now it is ok (with Christiaan Ghijselinck's RAMdisk files) Edited December 12, 2005 by xponard Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now