CloudDrive::Mount() API takes a long time when the drive has millions of files

Windows Azure Drive is in Preview, and we have identified an issue with the CloudDrive::Mount() API where it will take 5 to 20 minutes to mount a drive that contains millions of files.  In these cases, the majority of time used by CloudDrive::Mount is spent updating the ACLs (access control lists) on all the files on the drive.  The Mount() API attempts to change these ACLs on the root of the drive so that lower privileged roles (web and worker roles) will be able to access the contents of the drive after it is mounted.  However, the default setting for ACLs on NTFS is to inherit the ACLs from the parent, so these ACL changes are then propagated to all files on the drive. 

The workaround for this issue is to mount the drive once the slow way, and then permanently break the ACL inheritance chain on the drive.  At that point, the CloudDrive::Mount() API should always take less than one minute to mount the drive.

To break the ACL inheritance chain perform the following steps:

  1. Mount the drive
  2. Open a command shell
  3. Run the following commands (assuming that z: is where the drive is mounted):
    cd \
    icacls.exe * /inheritance:d
  4. icacls.exe will print out a list of files and directories it is processing, followed by some statistics:
    processed file: dir1
    processed file: dir2
    processed file: dir3
    processed file: dir4
    processed file: dir5
    Successfully processed 5 files; Failed processing 0 files
  5. Finally you should unmount the drive. 

Once you have done the above, subsequent calls to CloudDrive::Mount will be faster.

Andrew Edwards

Comments (0)

Skip to main content