Azure File Share - How to mount to subdirectory? - azure-storage

I have a lot of File Shares (NOT Blob) which I usually mount like so:
net use <drive-letter>: \\<storage-account-name>.file.core.windows.net\<share-name>
The thing is, I do not want to have to use a different drive letter for each File Share...
I tried doing this:
net use C:\data\<share-name> \\<storage-account-name>.file.core.windows.net\<share-name>
but I just get an error:
The network name cannot be found
How can I mount multiple shares to a single drive on Windows 10 server?

I don't think that is possible. as Windows "Map network drive" itself works this way. It takes network location and map to a new Drive in your machine.

Related

AzureFileShareConfiguration mount drive disconnected

I am trying to create a Pool using Azure Batch . I have uploaded content to Azure Storage using File Shares.
I would like my Pool to mount this Azure File Share as virtual file system (ref: https://learn.microsoft.com/en-us/azure/batch/virtual-file-mount#mount-a-virtual-file-system-on-a-pool ).
I am creating AzureFileShareConfiguration object using code:
mount_configuration=batchmodels.MountConfiguration(azure_file_share_configuration=batchmodels.AzureFileShareConfiguration(
account_name="mystorage",
azure_file_url="https://mystorage.file.core.windows.net/my-share1",
account_key="mystorage/key==",
relative_mount_path="S"
)
)
Using this, I get "CMDKEY: Credentials added successfully" in fsmounts. But when I RDP to the node in the pool, the S drive appears "Disconnected".
My Azure batch package versions are:
azure-batch==8.0.0
azure-common==1.1.24
Can you please help diagnose the issue or suggest the right usage?
Thanks in Advance!
I think this is windows VM you are trying?, just by looking at the drive letter : ).
Here is the key issue with RDP permissions is different then your Batch level model when your code runs and mount.
At Batch level when you mount your Drive: and you can see it via your Start task then it is working. i.e. that a Batch level permissioning model and when you RDP into Node it will be as a "user" you are logged-in. If you want to see via UI RDP user you should re-run the command from your RDP login to update that you have key to see that drive.
Although having said that try it with /persistent:Yes as mount_options.
The best test is going to be -- You mount the drive and from your start task go to the mounted directory via : S:\\Whatever_file.txt or read the mounted file which will add the result in your stdout.txt of batch node or might be just dir it or something.
Rest extra stuff below
try with this mount_options value
Also specifically this will help for various SMB version et. al. support: https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows and I think this you already know : https://learn.microsoft.com/en-us/azure/batch/virtual-file-mount#azure-files-share
In order to use an Azure file share outside of the Azure region it is
hosted in, such as on-premises or in a different Azure region, the OS
must support SMB 3.0.
So add this to your API and give it a try:
MountOptions = "/persistent:Yes" i.e. mount_options = "/persistent:Yes"
Also: key needs to be Storage account Key, i.e. it should not start with mystorage/key :) but it could be you hiding it, so just a mention and fyi.
Sample code:
I think SDK you have is python?
mount_configuration=batchmodels.MountConfiguration(azure_file_share_configuration=batchmodels.AzureFileShareConfiguration(
account_name="mystorage",
azure_file_url="https://mystorage.file.core.windows.net/my-share1",
account_key="mystorage/key==",
relative_mount_path="S",
mount_options = "/persistent:Yes"
)
hope this helps!
relative_mount_path: The relative path on the compute node where the file system will be mounted. All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.
Azure Files is the standard Azure cloud file system offering. To learn more about how to get any of the parameters in the mount configuration code sample, see Use an Azure Files share.

How to get local sync folder of one drive sync?

I have installed OneDrive on my local machine. Is there any way to get root folder/sync path of one drive ? I am looking for a programmatic way to fetch the root folder of one drive. Is there any API or interfaces through which I can access these details ? I want this API or interface for MacOS platform.
the information is in the registry.
Find the key HKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts, you'll see your accounts as sub-keys. In them, look for the string value named UserFolder.

Objective-C: Reach a file on samba url

I have a mapped samba network drive in Finder (for example "smb://192.168.15.119/public/ptest/test.rtf") and would like to copy a file from that drive to my desktop.
Do you guys know how would one go about achieving this? It's not mandatory to connect to that url through the mapped drive, if you have a solution that simply takes that url and copies the file from it, that's totally OK too.
EDIT: Based on Bastian's answer, the solution was to use NSFileManager's copyItemAtPath method with the source path being:
NSString *sourcePathx1 = [NSString stringWithFormat:#"/Volumes/public/ptest/test.rtf"];
when you connect to a network drive finder will mount it to /Volumes ... you can then access the share over this mountpoint.
If the share is not connected you can connect it by executing
mount_smbfs //host/share /some/temp/folder
If you want to access the file directly you would need some kind of samba library like http://nicolas.brodu.numerimoire.net/common/programmation/libsmb/archived_site/index.html but I don't know any active one.

TrueCrypt mounting drive on network

My question is related to TrueCrypt drive created on a server. I want to mount this drive on few computers on network with write access. In order to do so, I installed TrueCrypt on a network computer and mounted the drive.
Problem
It mounts the drive after asking the password but triggers write error. In other words, it is read only.
What I have tried so far
I have looked in the documentation at truecrypt.com and it shows there are two methods of mounting
TrueCrypt Mounted Drive (Mounts drive on a local computer with read only access)
Unmounted Drive (Drive is mounted on the server and shared across the network)
What I want
Option 2 seems to be solving the problem with exception to it doesn't ask for password. It is same as any shared folder on network which makes it less secure. So is it possible to to mount drive on network with write access but after authenticating with TrueCrypt login credentials.
Any help will be greatly appreciated.
Based on what I have read (I haven't tried it myself) when you download the truecrypt file to your local machine, you should be able to mount it there and would be prompted for password. Once mounted, you should be able to write to or modify to your hearts content and then save to the encrypted volume you local machine. You will not be able to save the changes into the original server-based volume as that file is 'read only'. However, you should be able to save your modified volume to the server under a different file name.
What I did:
mounted the TrueCrypt Drive and a TrueCrypt-Container with VeraCrypt
created a windows (samba) and mac (afp) share of the drive and container with a password in the share settings (whatever software you use)
Mounting the container prevented it from being overwritten from some one else opening the container directly.

Listing mapped network directories in VB.NET

How do I get all of the mapped network drives (shared ones) like the ones that a person would see in Windows Explorer?
That is,
Network Places
Computer 1
Shared Folder
Computer 2
Shared Folder 1
Shared Folder 2
Is there a command or an API function that I can use to get at least the names of the computers and its folders?
You can find a good ready-to-use solution in Network Shares and UNC paths (at The Code Project).
If you want to do it yourself, I think using WMI would be the way to go.
Also check Mapped network drives cannot be listed in C# for more information.