Want to move from two partitions to one as part of your OS deployment?


In the Microsoft Deployment Toolkit refresh scenario (back up user state from current OS, boot to PE, wipe old OS from disk, install new OS image, boot into new OS, restore user state) we normally don't support any type of disk repartitioning or reformatting because we are actively running from the disk.  But there is a scenario that can be done successfully: remove a second partition and go back to having a single-partition setup.  So how would you do that?  It's really not too difficult:

  • Add a new custom task sequence "Run Command Line" step that executes DISKPART.EXE to process a script such as this:

    SELECT DISK 0
    SELECT PARTITION 2
    DELETE PARTITION
    EXIT
  • Ensure that the sysprep.inf is configured to specify ExtendOemPartition=1 (we do this by default in MDT 2008), or if deploying Windows Vista ensure that unattend.xml specifies ExtendOSPartition in the Microsoft-Windows-Deployment component, specialize phase:

    <ExtendOSPartition>
    <Extend>true</Extend>
    </ExtendOSPartition>

The custom DISKPART script removes the second partition (make sure there's nothing on it you want to keep first), and then the Windows XP mini-setup or Windows Vista specialize process takes care of extending the OS partition to take up the remainder of the disk.

On a slightly-related topic, it's actually this extension process that causes the issues described in KB 931760 (the uberbug).  If you deploy Windows XP with a sysprep.inf that doesn't specify ExtendOemPartition=1 you probably won't see any issues and won't have to do any of the workarounds described in the KB article.

If you want to move the other direction (from a single partition to two partitions) let me try to talk you out of it 🙂  (I'm not a big fan of multiple-partition configurations, e.g. one partition for the OS and one partition for user data.)  It is possible to move from one to two, but it is more difficult.  The basic process would be to defragment the disk (in case there is something at the end of the partition), boot into Windows PE 2.0 (running from a RAMdisk so that the existing partition isn't in use), and then run DISKPART to shrink the current partition:

SELECT DISK 0
SELECT PARTITION 1
SHRINK QUERYMAX
SHRINK DESIRED=10000 MINIMUM=5000

In this case, the "QUERYMAX" statement would tell you how much you can shrink the partition, while the DESIRED and MINIMUM parameters specify how much to actually do (in MB).  (The SHRINK command was added in the Windows Vista/Windows PE 2.0 version of DISKPART, in case you missed it.)


Comments (8)
  1. Anonymous says:

    Moving to a single partition in MDT 2008 refresh scenario

  2. Anonymous says:

    Moving to a single partition in MDT 2008 refresh scenario

  3. Jacob says:

    I’ve extended the idea slightly with a script to remove all partitions after the C: partition.

    http://blog.project84.net/2008/06/17/MovingToASinglePartitionInMDT2008RefreshScenario.aspx

  4. Anonymous says:

    I’ve not tested this script, but I see a really bad possibility happening.

    On my most recent machine I installed by booting from the Vista64 CD and telling it to remove the existing partitions and then install on all the free space.

    Now if I bring up diskpart, I see the following:

    DISKPART> select disk 0

    Disk 0 is now the selected disk.

    DISKPART> list partition

     Partition ###  Type              Size     Offset

     ————-  —————-  ——-  ——-

     Partition 1    OEM                 39 MB    32 KB

     Partition 2    Primary            466 GB    40 MB

    If I look at the partitions in the graphical disk manager, Partition 1 is described as EISA Configuration.

    I just wanted to point out that deleting partition 2 in my cse would delete the partition that has all of my system on it.

  5. True.  The example assumes that you had two partitions and wanted to go to one.  If you had an OEM/EISA config partition, then the sample should be three partitions to two.

    Regardless, please test carefully before trying this on a machine with valuable data.  I’m focusing on the concepts, not the nuances for your particular machines 🙂

    -Michael

  6. Bearing in mind that MDT deploys server’s as well, multiple partitions are usually desireable.

    I agree with the single parition approach on the desktop though.

    Cheers

    Adam

  7. Anonymous says:

    Dears,

    I’m seeking for your kind support to help me in such case, my company uses a standard formatting and partitioning size to the hard disk, that to say the C drive is of 25 GB size, and the D drive is of 124 GB size,i have a question:

    – how can i only format the c drive(OS partition) and install my custom image on it ( as if we are making a REFRESH deploymnet)while booting from the DVD

    i tried to add the following to the customsettings.ini

    SkipDeploymentType=YES

    DeploymentType=REFRESH ,

    but it ignored and started with a NEW COMPUTER deployment type and formatted the whole disk.

    if you please, i’m waiting for your kind feed back asap

    thanks and best regards

  8. showbox says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings. Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android.
    The above all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.

Comments are closed.

Skip to main content