Search code examples
windowsmount

creating a filesystem in a file in windows


In linux we can create a filesystem in single file and mount it. Is there any way to create a filesystem in a file in windows and mount the filesystem created in a file?


Solution

  • In Windows 7 you can use diskpart to do this.

    Save the command lines to a text file, such as c:\newdisk.txt. This example will create a 500 MB virtual disk and mount it:

     create vdisk file=c:\test.vhd maximum=500 type=fixed
     sel vdisk file=c:\test.vhd
     attach vdisk
    

    Execute the script with diskpart:

     diskpart /s c:\newdisk.txt
    

    You can also format the volume, assign a drive letter, etc with diskpart.