IPB

Google Frontpage Forums Unattended CD/DVD Guide
 Forum Rules Unattended CD/DVD Guide Homepage · MSFN Forum Rules
 
Reply to this topicStart new topic
> Diskpart recognizes disks differently
jmueske
post Apr 7 2008, 04:52 PM
Post #1





Group: Members
Posts: 2
Joined: 7-April 08
Member No.: 185823
OS: XP Pro x86
Country Flag


I'm using a UFD (USB Flash Drive) with WinPE 2.0 and ImageX to deploy an XPe image. Here's what I'm doing:

1) Install UFD and SATA hard disk into system with power off.
2) Power on and boot PC to BIOS boot drive menu with F12, select UFD with WinPE 2.0 (both SATA drive and UFD are considerd hard drives by the BIOS).
3) Use diskpart to prepare hard disk:
diskpart /s d:\script.txt

select disk 0
clean
create partition primary
select partition 1
active
exit

4) format c: /fs:ntfs /y /v:harddisk
5) d:\imagex.exe /apply d:\filename.wim 1 c:

I run into a problem when using a brand new harddisk compared to a previously initialized harddisk. Diskpart sees a previously initialized harddisk as "drive 0" and the UFD is "drive 1". Diskpart sees only the UFD as a "drive 0" when a brand new empty harddisk is installed. As you can imagine this messes up my diskpart script because it wipes my UFD clean when a new hard disk is installed.

Can I get diskpart to look at both drive states the same way without externally initializing each harddisk? Ideally my scripts can "autosense" the harddisk in both drive conditions and work properly accordingly. Any ideas?

Regards,
John

This post has been edited by jmueske: May 21 2008, 02:54 PM
Go to the top of the page
 
+Quote Post
zorphnog
post Apr 8 2008, 07:11 AM
Post #2


Advanced Member
***

Group: Members
Posts: 427
Joined: 25-July 06
From: Charleston, SC
Member No.: 105938
Country Flag


This has been covered many times. Search: +diskpart +script
Go to the top of the page
 
+Quote Post
jmueske
post May 21 2008, 01:23 PM
Post #3





Group: Members
Posts: 2
Joined: 7-April 08
Member No.: 185823
OS: XP Pro x86
Country Flag


Thanks for the tip. I've literally searched for hours and while I can find other diskpart issues, I cannot find one similar to my own. Can someone point me in the right direction, perhaps with a specific post?

Regards,
John

This post has been edited by jmueske: May 21 2008, 01:27 PM
Go to the top of the page
 
+Quote Post
WreX
post May 22 2008, 09:45 AM
Post #4


Junior
*

Group: Members
Posts: 56
Joined: 26-October 07
Member No.: 159852
OS: none
Country Flag


You could use a batch or similar file to utilize diskpart scripting to find what disk # your hard drive or UFD device is and create your clean and partition script accordingly. The easiest way is if you know the size of your UFD device will always be the same. Then you could:

1. Run a diskpart script that runs the "list disk" command and read the output
2. Look for the line with the size value of your UFD device, and find the "Disk #" value for that device
3. Create the diskpart script to clean and partition using the other disk #

Here's an example of a batch file for a 256MB UFD that shows up as 246MB in diskpart:
CODE
echo list disk > X:\ListDisk.txt
FOR /F "tokens=2,4" %%i IN ('diskpart /s X:\ListDisk.txt') DO @IF /i %%j == 246 SET UFDDISK=%%i
IF DEFINED UFDDISK IF %UFDDISK%==0 SET THEDISK=1
IF DEFINED UFDDISK IF %UFDDISK%==1 SET THEDISK=0
IF DEFINED UFDDISK echo select disk %THEDISK% > X:\PartHD.txt
IF DEFINED UFDDISK echo clean >> X:\PartHD.txt
...
IF DEFINED UFDDISK diskpart /s X:\PartHD.txt
Go to the top of the page
 
+Quote Post

Google Frontpage Forums Unattended CD/DVD Guide

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 8th January 2009 - 11:53 PM
All trademarks mentioned on this page are the property of their respective owners
MSFN is not affiliated with Microsoft
Copyright © 2001-2008 msfn.org
Privacy Policy