I'm trying to setup a batch file to map and unmap a volume to my server quite regularly. It is for the purpose of backing up. I have an external storage array that supports snapshots, which essentially copies the data from the volume you select to a new volume, then you back up that volume and unmap the drive letter once the backup is done.
The problem I have noticed is that when using DISKPART, the volume # does not stay static. An example:
Volume ### Ltr Label FS Type
Volume 0 H New Volume NTFS Partition
Volume 1 C NTFS Partition
Volume 2 D New Volume NTFS Partition
This is how it appears when I first run my batch file to mount the volume to the server. I then unmount and run the command again and Drive H will no longer be Volume 0, but Volume 2, Drive C is now Volume 0 and Drive D is now Volume 1. The Volume number to Drive letter mapping always changes which causes inconsistencies with my batch file.
It seems that Windows will assign whatever number it wants to a volume each time you run a rescan. Anyone who can shed light on this is greatly appreciated.
Thanks
The problem I have noticed is that when using DISKPART, the volume # does not stay static. An example:
Volume ### Ltr Label FS Type
Volume 0 H New Volume NTFS Partition
Volume 1 C NTFS Partition
Volume 2 D New Volume NTFS Partition
This is how it appears when I first run my batch file to mount the volume to the server. I then unmount and run the command again and Drive H will no longer be Volume 0, but Volume 2, Drive C is now Volume 0 and Drive D is now Volume 1. The Volume number to Drive letter mapping always changes which causes inconsistencies with my batch file.
It seems that Windows will assign whatever number it wants to a volume each time you run a rescan. Anyone who can shed light on this is greatly appreciated.
Thanks