/build/static/layout/Breadcrumb_cap_w.png

Diskpart script to create 2 partitions

I'm at a loss here and need help creatiing a script that will create two partitions and assign a size to the first. The diskpart script used in the Kbox for creating one partition is:

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

How can I modify this to create two and assign a size to the first partition?

Thanks.
Russ

0 Comments   [ + ] Show comments

Answers (2)

Posted by: dunnpy 12 years ago
Red Belt
0
You need to specify the size on your 'create par pri' line, otherwise the full size of the disk is used.

See here for further information from Microsoft.

Thanks,

Dunnpy
Posted by: dchristian 12 years ago
Red Belt
0
Here's a template you can follow.

select disk 0
clean
create partition primary size=20480
select partition 1
active
assign letter=c
create partition primary
select partition 2
assign letter=Z
exit

This create a partition of 20 gigs.

To find the size 1024 * (number in gigs)

Comments:
  • I am trying to do a similar thing but I want a small partition of 4000 and the second partition, the rest of the size. Here is my script

    select disk 0
    clean
    create partition primary size=4000
    select partition 1
    assign letter="D"

    create partition primary
    select partition 2
    assign letter="C"
    active
    exit

    My results are
    DiskPart succeeded in cleaning the disk
    DiskPart succeeded in creating the specified partition
    Partition 1 is not the selected partition
    Virtual Disk Service error:
    The specified drive letter is not free to be assigned. - jfrasier 12 years ago
  • I bet you the CD-ROM mounted as D: (it happens to me all the time!).

    What i usually do is assign a letter like Z (since i know its not being used).

    You can reassign the drive letter when you get into windows, using a post-install task. - dchristian 12 years ago
  • after
    create partition primary (for the second partition)
    i get
    "No usable free extent could be found. It may be that there is insufficient free space to create a partition at the specified size and offset. Specify different size and offset values or don't specify either to create the maximum sized partition. It may be that the disk is partitioned using the MBR disk partitioning format and the disk contains either 4 primary partitions, (no more partitions may be created), or 3 primary partitions and one extended partition, (only logical drives may be created)."
    there are still 10GB in the disk so i suppose i have mbr. Any idea how to circumvent this ? - c01d4x 10 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ