Windows 7 Thread, Script repartitioning of drive in Technical; I messed up the first 30 laptops of this batch that i did to day, in that I somehow had ...
-
22nd June 2010, 05:04 AM #1 Script repartitioning of drive
I messed up the first 30 laptops of this batch that i did to day, in that I somehow had ghost use the whole drive rather than make a partition the size of the image.
Rather than go round all 30, is there some way I can script a startup script that will repartition everyting after, say, 85gb into another drive?
-
-
IDG Tech News
-
22nd June 2010, 07:31 AM #2 I'm assuming Windows 7 so run diskpart and type
list volume
this will show you the volumes on your machine (for Windows 7, vol 0 is probably the boot volume - about 100Mb in size - vol 1 is the rest of the disc and vol 2 is the DVD but check; the volume number really matters!)
In a batch file use these commands:
Code:
diskpart
select volume 1
shrink desired=85000
where the volume you select is the one you found.
-
Thanks to srochford from:
RabbieBurns (23rd June 2010)
-
22nd June 2010, 07:42 AM #3 Aye, windows 7..
Thanks, I will give it a try in the morning. I dont have any 100mb boot volume though.. (although interestingly a x64 install Im doing jsut now insisted on creating a 100mb partition..)
-
-
22nd June 2010, 08:36 AM #4 Oh god I've done that before on 30 laptops and gone round with several copies of GPARTED Live!
-
-
22nd June 2010, 08:53 AM #5 
Originally Posted by
RabbieBurns
Aye, windows 7..
Thanks, I will give it a try in the morning. I dont have any 100mb boot volume though.. (although interestingly a x64 install Im doing jsut now insisted on creating a 100mb partition..)
isnt that 100mb partition win7 creates incase you ever decide to use bitlocker rather than a boot partition?
-
-
22nd June 2010, 12:05 PM #6 
Originally Posted by
sted
isnt that 100mb partition win7 creates incase you ever decide to use bitlocker rather than a boot partition?
no idea.. not a single one of my 400 32bit win7 machines have a 100mb partition. Is it a x64 thing?
-
-
22nd June 2010, 02:34 PM #7 
Originally Posted by
RabbieBurns
no idea.. not a single one of my 400 32bit win7 machines have a 100mb partition. Is it a x64 thing?
it does it on x64 ive not done a single x86 install and wont as far as im concered 32bit = xp 64=win7 the only use i have for win7 x86 is for the boot.wim files i use to make a custom winpe
-
-
22nd June 2010, 03:32 PM #8 Oops! Just realised that what I typed earlier is garbage!
Save this as a text file (eg resize.txt)
Code:
select volume 1
shrink desired=85000
and then put
Code:
diskpart /s resize.txt
in the batch file - ie you create a script of the commands you want and then call that from diskpart with the /s switch.
-
Thanks to srochford from:
RabbieBurns (23rd June 2010)
-
23rd June 2010, 01:06 AM #9 Awesome, that works well, cheers.
Any way I can create a new simple volume ausing all the new space and then format it from the CLI as well?
Last edited by RabbieBurns; 23rd June 2010 at 01:12 AM.
-
-
23rd June 2010, 01:32 AM #10 Yeap, if you want multiple partitions then in your text file specify the following
Code:
Select disk 0
clean
Create partition primary size=100
Select partition 1
Active
Format fs=ntfs quick
assign letter=S
Create partition primary
Select partition 2
Format fs=ntfs quick
assign letter=c
Exit
this will select the first har drive, wipe its partitions etc (clean) then make a 100mb partition, set it to active (marked as bootable), format it to NTFS then assign it a drive letter (s). Next it creates a patition using the rest of the space avalible (by not specifying the size), formats it to ntfs and assigns it the drive letter of C.
You can script all sorts of drive configurations with diskpart and extend/shrink partitions too.
-
Thanks to SYNACK from:
RabbieBurns (23rd June 2010)
-
23rd June 2010, 01:46 AM #11 Im not wanting to lose the existing windows installation. I cant be bothered ghosting them all again. So I want to shrink the 500gb drive to 1 80gb partition (c) and the rest just a (d) drive with the remaining free space.
Using Srochford method above, and tweaking the numbers, Ive got now an 82gb C Drive, and just unassigned free space after it. I just want to assign that free space to D:
-
-
23rd June 2010, 02:36 AM #12 In which case you can simply use something like (assuming one hard drive)
Code:
diskpart
select disk 0
Create partition primary
list partition
- to find the number of the new partition if you don't know it -
Code:
select partition x
Format fs=ntfs quick
assign letter=k
exit
or just use the disk managment snapin inside the computer managment app, right click on the empty space on the drive and make a new partition from there. You could also have done the shrink operation from there too if you had wanted to as there is a GUI for it in Vista and above.
-
Thanks to SYNACK from:
RabbieBurns (23rd June 2010)
-
23rd June 2010, 07:16 PM #13 As far as I know the 100MB is for bit-locker, didn't they have problems with bit-locker failing to load on Vista and there wasn't any way of recovering it. So they made the 100MB for bit-locker to live in so it can be repaired? GOOGLE!
Ok, got a bit mixed up, its not to repair bit-locker, but contains boot and recovery files stored outside of bit-locker. So if you need to repair your installation it can boot in to recovery without needing bit-locker to unlock the C drive. By the sounds of it it will only effect you if you use bit-locker, and if you don't have the 100MB partition it will just mean the recovery and boot files are on the main partition.
Correct me if I'm wrong on that.
-
-
23rd June 2010, 07:48 PM #14 Wish I had spotted this earlier and saved you some grief....
The extra little partition you discuss is for the files required to boot Windows when Bitlocker is enabled. When you enable Bitlocker, your system drive is shrunk automagically (if required). It doesn't take long either!
I found this out by accident after much grief with extra drive letters and faffing in SCCM!
-
SHARE:
Similar Threads
-
By cookie_monster in forum Scripts
Replies: 1
Last Post: 12th October 2009, 09:02 PM
-
By Andie in forum Scripts
Replies: 2
Last Post: 6th October 2008, 09:05 AM
-
By ctote in forum Windows
Replies: 19
Last Post: 18th April 2008, 07:49 AM
-
By googlemad in forum Windows
Replies: 3
Last Post: 25th October 2007, 09:14 AM
-
By Samson in forum Scripts
Replies: 5
Last Post: 10th May 2007, 03:29 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules