windows auto-expand partition

Create a Script for Windows to Auto Expand your Partition after you Increase your Virtual Drive Size

At CloudSigma our infrastructure provides unbundled resources which gives a lot of flexibility. It means you can increase a drive’s size as you need to. The problem for the most people is however that when the drive size is increased at the infrastructure layer in the cloud, the filesystem is not expanded automatically and you have to do this manually which takes time and is inconvenient.

For this reason we have implemented a script in our pre-installed Windows OS library images which checks the drive size on every boot and expands the filesystem to fit the actual size. To take advantage of this and other little neat time saving tricks just use our Windows images available from the drives library.

In this blog post we share with you how the script works and is built so you can implement this against any Windows systems you might have including those you may have uploaded yourself.

Windows Partition

Create script commands file

    1. In the directory C:\Windows\Setup create a subdirectory called Scripts if it doesn’t already exist.
    2. Enter the following commands into a new blank text file:
  1. Save and close the file diskpart.txt in the directory C:\Windows\Setup\Scripts

Create executable batch file

Next we create an executable batch file, that will automatically run the script on every boot and apply the script.

    1. Add the following commands to a new text file:
  1. Save the file with filename DiskExtension.bat in the directory: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
    (Depending on the text editor you are using, ensure that for Save as type you select as All Files and not Text Documents (*.txt))

Disable warning pop-up alerts

If you wish to disable the warning pop-up alerts that run on every boot up of the server (i.e. “Are you sure to run this script?”), please follow the steps below:

  1. Go to Control Panel -> User -> Change User Account Control settings
  2. Move the scroll bar to the bottom position labelled Never notify me

User Settings
We hope that this post was useful for you and will make your computing easier. In general if you need multiple partitions and drives we recommend doing this by creating separate virtual drives for your cloud server rather than partitioning a single virtual drive. As such this expansion script shouldn’t pose an issue for such a data management strategy.

We hope you find this script useful and happy computing in our infrastructure!

Ab27a77eba8d9f6ee711a5b6d99212fa?s=80&r=g

About Stoyan Dyakov

Technical Support Representative @ CloudSigma. He is interested in computers, new technologies,snooker and video games. Windows geek hungry to master it all.