20

Is there a way to mount a network location so that it appears as a local physical disk? e.g. \\computer\share as D: (not a network drive)

kasperd
  • 29,894
  • 16
  • 72
  • 122
jwee
  • 311
  • 1
  • 2
  • 5

12 Answers12

48

Yes, this is possible in Windows Vista and in Windows 7.

Open the Command Prompt as an administrator. Then type the following command:

mklink /D C:\LinkName \\NetworkLocation\LocationName

This will create a "symbolic link" on Drive C called LinkName, which will link to LocationName on \\NetworkLocation. Windows will, of course, know that this is a symbolic link, but will treat it as if it were a folder on the local drive. All applications will treat this symbolic link as a local resource.

Hope this helps.

yoniLavi
  • 150
  • 7
Alderbury
  • 481
  • 1
  • 4
  • 2
18

As I said on this (almost) identical question:

Are you sure this is really what you want to do? There's a very good article on why this is a bad bad bad idea over at Joel on Software (see point #3)...

The concluding statement is:

Conclusion: the next time someone tries to sell you a programming product that lets you access network resources the same was as you access local resources, run full speed in the opposite direction.

If you want to know why, read the relevant parts of the article.

And the short answer to your question is: No. Not easilly, and the reason is that a local disk is expected to have all sorts of functionality that a network share does not. A local disk expects a local file system (NTFS/FAT/etc), which a network share does not have (Well, it does, but at the server it's hosted on, not your location), as well as a whole host of other features that just can't be safely or reliably replicated (see the linked artical).

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
  • +1, right answer. you not only answered the question asked, you also qualify for the mind-reader badge for discerning what the OP is really asking. – quack quixote Feb 03 '10 at 23:59
  • 1
    ... and the rest of the story is: what the OP wants is a "network block device", which can be done (and shouldn't, for all the reasons you list), *but can't be applied to an existing Windows network share.* – quack quixote Feb 04 '10 at 00:04
  • The linked article here is now 15 years old and is still relevant. Funny how time flies... – Mark Henderson Jun 03 '15 at 05:43
  • 4
    -1 as does not actually answer the question, just gives your subjective opinion – Mr. Hedgehog Jul 12 '17 at 16:01
  • Hmph. Opinion or not, this answer still has the ring of truth, indeed, it rings true. +1 for being awesome. – JonathanDavidArndt Sep 13 '18 at 12:41
6

You can mount a network drive as a virtual physical disc using the iSCSI protocol to access an iSCSI server - for example, you can set one up using Free NAS - Google it for more info.

  • It should be noted that - with a standard filesystem - you cannot have two clients access the network drive at the same time. A standard filesystem expects a dedicated block device where it has exclusive access. Concurrent access will quickly destroy the filesystem unless you're using a clustering filesystem designed for this. – Zac67 Aug 31 '17 at 11:18
5

I'm assuming you're using Windows, but you don't say which version. In any case, in Windows Explorer in the Tools menu select Map Network Drive. If you're on Vista, for example, which hides the menus, just press and release the Alt key to show the menus.

You can also use the SUBST command:

SUBST M: \\COMPUTERNAME\SHARENAME
Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
  • 1
    Hi, I was thinking more of how to mount it so that windows 7/2008 actually sees it as a physical drive and not a network mapped drive. I don't know if I actually make sense. However there are some software out there that does not see mapped drive as a physical drive (e.g Computer management Start->Run->compmgmt.msc)? Thanks – jwee Feb 02 '10 at 00:22
  • Do you mean you want to fool software that won't work with network drives? If the subst command won't do it you're SOL. – John Gardeniers Feb 04 '10 at 03:36
  • Awesome, needed to fool dropbox. Does this mount persist between reboots etc etc? – Enjoy87 Oct 13 '20 at 15:17
3

If you want to script it, use the NET USE command:

The syntax of this command is:

NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
        [/USER:[domainname\]username]
        [/USER:[dotted domain name\]username]
        [/USER:[username@dotted domain name]
        [/SMARTCARD]
        [/SAVECRED]
        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]
Rick
  • 245
  • 3
  • 8
3

I used Alderbury answer in order to save my microsoft onedrive files to a nas wd my cloud and it works. I have a windows 10 PC. Microsoft onedrive will only save to folders on the c:\ drive and not a network drive.

Yes, this is possible in Windows Vista and in Windows 7.

Open the Command Prompt as an administrator. Then type the following command:

mklink /D C:\LinkName \NetworkLocation\LocationName

This will create a "symbolic link" on Drive C called LinkName, which will link to LocationName on \NetworkLocation. Windows will of course know that this is a symbolic link, but will treat it as if it was a folder on the local drive. All applications will treat this symbolic link as a local resource.

Hope this helps.

chicks
  • 3,639
  • 10
  • 26
  • 36
2

The suggestion of mklink /D C:\LinkName \NetworkLocation\LocationName actually works. This is how I made it work:

I first mapped by network drive as Z:. To do this right click on the network drive and you will see "Map network drive" as an option. If you do not open the network drive and create on it the folder in which you want to store Onedrive for Business. Then right click on the folder and map it to drive Z:, or any other you want.

Next, run CMD as administrator. In the command prompt box that comes up type mklink /D C:\ Z: (the spaces are needed). You will now see a file on c:\ named LinkName.

Open that file and you will see a file with the same name as the directory you mapped as drive Z:. Right click on that and click on Properties. Under the general tab you will see at the bottom attributes. If Read-only, or any other box, is highlighted, or checked, click on it to clear it. Then click apply.

You can now go to Onedrive for Business and choose as the location the folder within C:\Linkname that is the mapped network drive.

I hope this is easy to follow.

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92
Rob
  • 21
  • 1
2

I found a solution using thisDokan

You can mount a network share as a drive, and then share it as usual. Works perfectly.

Andy
  • 21
  • 1
0

None of the existing answers here worked, so I had to continue searching for the solution elsewhere, and I found one! For my usecase, it is Rclone what helped to solve the problem of mounting network drives as local ones. It is free and open source. It works with sftp remote filesystems, so it can mount network drives both on Linux and Windows (running sshd service).

Example command how to run it, assuming remote point "server" is already configured and rclone.exe is in PATH environment variable:

rclone mount server:/ Z: --file-perms=0777 --track-renames --track-renames-strategy=modtime,leaf --metadata --vfs-cache-mode=full --sftp-disable-hashcheck --volname drive_name

For the first time, you need to configure new remote point by running:

rclone config

To find out location of the config file you have just created, run:

rclone config file

Also, you may need to install WinFsp first, if not already intalled. The best thing about it, everything just works the same way like with local disk (assuming if you provide --vfs-cache-mode=writes or --vfs-cache-mode=full option, since without it, many applications will fail to work correctly, please read the documentation to understand why). Option --file-perms=0777 is necessary to allow running .exe files. Even though --vfs-cache-mode=writes may be enough for most applications, but --vfs-cache-mode=full is important for good performance with large files. For the same reason --track-renames-strategy is limited to only modtime and leaf strategies, because if haenter code heresh strategy is used, it will be obviously slow with large files, and --sftp-disable-hashcheck is necessary to prevent rclone from running md5sum, otherwise it will run it even when trying to read a file.

Even software which normally complains about using network drives (MSI files, Adobe Lightroom, and many others), just works with Rclone.

To register Rclone as a system service, edit and run the following command (do not run as is, please see below how you need to edit it first):

New-Service -Name Rclone -BinaryPathName 'C:\Program Files\Rclone\rclone.exe mount server:/ Z: --vfs-cache-mode=full --track-renames --track-renames-strategy=modtime,leaf --metadata --volname drive_name --config="C:\Program Files\Rclone\rclone.conf" --log-file="C:\Program Files\Rclone\rclone.txt" --file-perms=0777 --sftp-disable-hashcheck --no-console'

Obviously, you need to replace "server:/" with your actual remote point name and path, also replace drive_name with any name you like, and of cource you may need to edit paths to rclone.conf, rclone.log and rclone.exe, if you installed it in a different location.

Note: in my case running as a system service caused some permission issues (for example, when trying to save Excel files), and I did not figured out why yet, so I ended up creating startup .bat file to run Rclone as a user, since it works perfectly this way. I will update this answer if and when I figure out how to make running as a service to work as good as running as a user.

0

As of Windows 10, you just have to right click the network and click "connect the drive" (just above "cut").

It will set a letter (D:, E: or else) and it will appear just as a local drive.

Dan Chaltiel
  • 119
  • 5
-1

If you just want your files somewhere else, but don't actually need to access them from many locations simultaneously, you can save a virtual drive in the shared folder and use some software to mount it as a local physical drive.

It will behave as a local drive, all software will recognize it as such, but it won't consume space on your local hard drives. If you actually need to access those files from two or more locations at once, go for hardlink, as others already well explained.

Original text before editing:

I have an application that requires the files to be saved locally, but due to its gigantic space consumption I have to leave it on the server. I simply saved a virtual drive in a shared folder and mapped it using Daemon Tools. Works like a charm, and is recognised as local storage.

*It is fast, because of the gigabit network, but not completely reliable, though. You may lose critical data or corrupt the virtual drive's file. To prevent this, you can use the "Offline folder" option, but as it saves a copy of the files locally, it may consume a lot of space, which makes it impossible to use in cases like mine.

  • Could you rephrase this answer so that it more closely addresses the OP's request? As it stands now, this reads more like an advertisement than like a solution to the OP's issue. – Castaglia Feb 18 '16 at 16:23
  • Thanks @TJSaunders , I will edit the post. Sorry, new to the forum. – TheFatiass Feb 18 '16 at 18:12
-4

The best method is created iSCSI, connect to this iSCSI and indicated the Shadown Copy storage for the local. This post i used to created iSCSI and Be Happy !!!.

http://www.andersonpatricio.org/criando-um-storage-iscsi-com-windows-storage-server-2012-e-configurando-nic-teaming-nas-interfaces-da-rede-san/

  • Could you expand your answer to explain how this provides the result the asker was interested in? It would also be useful if you could summarise the content of the link you provide. – iwaseatenbyagrue Mar 16 '17 at 07:28