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\Setup
create a subdirectory calledScripts
if it doesn’t already exist. - Enter the following commands into a new blank text file:
- In the directory
1 2 3 |
select disk 0 select partition 2 extend |
- Save and close the file
diskpart.txt
in the directoryC:\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.
-
- Add the following commands to a new text file:
1 2 3 4 |
@echo off 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 |
- 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 forSave as type
you select asAll Files
and notText 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:
- Go to
Control Panel -> User -> Change User Account Control settings
- Move the scroll bar to the bottom position labelled
Never notify me
We hope you find this script useful and happy computing in our infrastructure!