Issue creating directories in a VHD volume

David Lee mailtolky@gmail.com
Wed Jun 29 06:32:00 GMT 2016


Hi,

I found some issues while trying to create directories to a volume on
a virtual disk (VHD).

-- SETUP --

* Windows 7 SP1 x64
* Cygwin 2.5.2 x86 installed and run under C:\Cygwin
* 100 MB Virtual Disk on D:\Test.vhd
* VHD has a 100 MB simple volume formatted as NTFS

* Tests were done under an account the joined the Local Administrators group.

-- TEST 1 --

1. I used Disk Management Console (diskmgmt.msc) to:
    a. Attach the VHD using Disk Management Console (GUI) (diskmgmt.msc).
    b. Mount the volume under C:\Cygwin\tmp\mount (Cygwin saw it as /tmp/mount).

2. Then I tried to create a directory in /tmp/mount inside bash:

   mkdir /tmp/mount/12345

3. Result: success (note: elevation was not needed).


-- TEST 2 --

Same procedure but used the diskpart.exe console utility instead.

1. It fired up a UAC prompt and I accepted it.

2. I created another directory: mkdir /tmp/mount/67890.

3. Result: success (note: although diskpart.exe was elevated, the bash
prompt itself wasn't.)


-- TEST 3 --

I wrote a simple utility in C/C++ to attach the VHD (using Win32 API
such as OpenVirtualDisk() and AttachVirtualDIsk()).

Source was attached with this message (demo.c)

1. I fired up an *elevated* Command Prompt.
2. Ran the utility to attach the DISK. Result: success.
3. Mounted the volume under C:\Cygwin\tmp\mount, either diskmgmt.msc
or diskpart.exe
4. Inside a bash prompt (no elevation), typed mkdir /tmp/mount/abcde
5. Result: permission denied (no directory was created).

6. In a Command Prompt (no elevation), the following SUCCEED:

   mkdir C:\Cygwin\tmp\mount\abcde

Any help is appreciated on why I got the 'permission denied' message.

David Lee.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo.c
Type: text/x-csrc
Size: 1161 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20160629/0fcf3b05/attachment.bin>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list