Shrink a harddrive and then enable a partition

Hi All,
Shrink a harddrive and then enable a partition
I have a 500 Gb HDD new systems. Need help with a script when run shrinks the 500 Gb of C drive to 150 Gb and then creates the unallocated partition to D: Drive 350 GB and format?

Thanks
LVL 11
bsharathAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

noxchoProduct ManagerCommented:
I have used Paragon Partition Manager Server from here: www.partition-manager.com with their script to do this operation. Pretty effective when you need to resize 300 systems.
bsharathAuthor Commented:
Is there no way to use any windows 7 inbuilt way. Rather than any other softwares
noxchoProduct ManagerCommented:
Yes. in DiskPart.exe command line.
Or via Windows Disk Management - right click on volume - shrink - then create new volume.
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

LesterClaytonCommented:
When you do a Shrink Volume operation, it first queries the volume regarding how much you can shrink it by.  This is not defined by how much free space there is, but rather by where the last non-moveable blocks are on the occupied disks.  The Standard Windows Defrag that comes with Windows will not move un-moveable blocks, whereas 3rd party software can.  Un-moveable blocks include files like the Swap file or Hibernation file, and may also include Read-only, Hidden and System files.

You should also do a defrag prior to attempting the shrink, to get the most accurate results.

3rd party software will be your best bet.  I would recommend Acronis Disk Director, or Partition Magic.
bsharathAuthor Commented:
Are Acronis Disk Director, or Partition Magic
Defrag tools or partition tools?

i did try the local defrag before i shrink

What i dont understand is 500 Gb HDD where 30 GB of OS and 470 GB free when shrink allows just 2 GB of shrink

where as in a different system 250 GB HDD could shrink to 150 GB
Windows 7
eagerCommented:
Take a look at Gparted:  http://gparted.sourceforge.net/

This is a stand-alone partition editor which you can boot from a CD or USB.  The interface is different but it has most of the same functionality as Partition Magic.  
noxchoProduct ManagerCommented:
How many machines do you need to shrink? Which OS?
LesterClaytonCommented:
It looks like there is some "unmoveable data" near the end of the disk which is why you can't shrink it more than 2 GB.

The Defrag that comes with windows won't move "unmoveable data" (like the Swapfile) which is why you have no choice but to use 3rd party software.
Rob MinersCommented:
There are three main areas that will contain Immovable files that will need to be addressed before you can shrink your drive.

Temporarily turn off System Restore
Note: Take note of the drives that are being monitored so you can reflect the changes later.
1.      Press the WinKey + Pause
2.      Select Advanced system settings, System Protection       
3.      Untick all radio boxes under Available Disks

Temporarily turn off the PageFile
Note: If you have modified the PageFile settings take note of the settings before making changes.

1.      Select Advanced system settings, Advanced tab and then Performance. Under Virtual memory select Change.
2.      Untick Automatically manage paging file size for all drives.
3.      Click on No paging file for each drive.


The Hibernate function can be turned off temporarily to give you more disk space.
Note: Hibernation can be re-enabled later by using powercfg.exe -h on
1.      From an elevated command prompt type in:
2.      powercfg.exe -h off
3.      Restart your computer for the changes to reflect.



To shrink a basic volume

http://technet.microsoft.com/en-us/library/cc731894.aspx

To shrink a basic volume using the Windows interface
In Disk Manager, right-click the basic volume you want to shrink.

Click Shrink Volume….

Follow the instructions on your screen.

Note  
You can only shrink basic volumes that have no file system or use the NTFS file system.

Additional considerations
When you shrink a partition, unmovable files (for example, the page file or the shadow copy storage area) are not automatically relocated and you can not decrease the allocated space beyond the point where the unmovable files are located. If you need to shrink the partition further, see move the page file to another disk, delete the stored shadow copies, shrink the volume, and then move the page file back to the disk.


If the number of bad clusters detected by dynamic bad-cluster remapping is too great, you cannot shrink the partition. If this occurs, you should consider moving the data and replacing the disk.

Do not use a block-level copy to transfer the data. This will also copy the bad sector table and the new disk will treat the same sectors as bad even though they are normal.


You can shrink primary partitions and logical drives on raw partitions (those without a file system) or partitions using the NTFS file system.


To shrink a basic volume using a command line
Open a command prompt and type diskpart.

At the DISKPART prompt, type list volume. Make note of the number of the simple volume you want to shrink.

At the DISKPART prompt, type select volume <volumenumber>. Selects the simple volume volumenumber you want to shrink.

At the DISKPART prompt, type shrink [desired=<desiredsize>] [minimum=<minimumsize>]. Shrinks the selected volume to desiredsize in megabytes (MB) is possible, or to minimumsize if desiredsize is too large.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob MinersCommented:
I would also Defragment your hard drive while these settingas are disabled, as it will rearrange fragmented data so your hard disk can work more efficiently.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.