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.
Create script commands file
- In the directory
C:\Windows\Setupcreate a subdirectory called
Scriptsif it doesn’t already exist.
- Enter the following commands into a new blank text file:
- Save and close the file
diskpart.txtin the directory
select disk 0
select partition 2
Create executable batch file
Next we create an executable batch file, that will automatically run the script on every boot and apply the script.
- Add the following commands to a new text file:
- Save the file with filename
DiskExtension.batin the directory:
(Depending on the text editor you are using, ensure that for
Save as typeyou select as
All Filesand not
Text Documents (*.txt))
diskpart /s C:\Windows\Setup\Scripts\diskpart.txt
del /Q /F C:\Windows\System32\Sysprep\unattend.xml
del /Q /F C:\Windows\Panther\unattend.xml
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:
- Go to
Control Panel -> User -> Change User Account Control settings
- Move the scroll bar to the bottom position labelled
Never notify me
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!
Share this Post