INTERACT FORUM

Devices => PC's and Other Hardware => Topic started by: Matt on September 22, 2012, 09:02:50 am

Title: Any way to make a virtual drive from various folders?
Post by: Matt on September 22, 2012, 09:02:50 am
I organize my hard drive into several top-level folders, like:
Documents
Archive
Media
Temporary
Share
etc.

These folders are often on different drives, depending on the performance I need and the free space available.

I'm wondering if there's some way to merge the folders to a virtual drive, so I could for example have:

A:\
   Documents
   Archive
   Media
   Temporary
   Share
   etc.

Remember that each folder might be on a different drive.  Also, I'd like to be able to share the structure on the network and control permissions per folder.

One way I was thinking that might work would be to:
1) Create a folder C:\Data
2) Under that folder, create junction points for Documents, Archive, etc. that point where I want
3) Share C:\Data
4) Map the network share to a drive, say A:\

I also looked at Drive Bender, but it doesn't really let me control where in a pool things go.  And I need that since C:\ is my fast SSD and I want certain folders (like my Media Center library) to always be on the SSD.  It also didn't seem to want me to use my C:\ drive as part of the pool.

Any advice?
Title: Re: Any way to make a virtual drive from various folders?
Post by: InflatableMouse on September 22, 2012, 12:03:31 pm
mklink does what you want. Create directory junctions.

http://technet.microsoft.com/nl-nl/library/cc753194%28v=WS.10%29.aspx

Code: [Select]
mklink [[/d] | [/h] | [/j]] <Link> <Target>

/d ........... Creates a directory symbolic link. By default, mklink creates a file symbolic link.
/h ........... Creates a hard link instead of a symbolic link.
/j ........... Creates a Directory Junction.
<Link> ....... Specifies the name of the symbolic link that is being created.
<Target> ..... Specifies the path (relative or absolute) that the new symbolic link refers to.
/? ........... Displays help at the command prompt.

Let's say you have d:\documents, e:\backup and f:\media. You want that those under c:\data\*.

Open a command prompt as admistrator, CD into c:\data and type:
Code: [Select]
mklink /j c:\data\documents d:\documents
mklink /j c:\data\backup e:\backup
mklink /j c:\data\media f:\media

If your real foldernames contain spaces, put them between quotation marks.
Title: Re: Any way to make a virtual drive from various folders?
Post by: InflatableMouse on September 22, 2012, 12:06:12 pm
Ah I just read "virtual drive".

I never tried it and the last time I used subst was under DOS 6.22 :).

complementing the above, type after mklink cmd's:

Code: [Select]
Subst A: C:\data

Just for the giggles I'll give it a shot too see it that works.
Title: Re: Any way to make a virtual drive from various folders?
Post by: InflatableMouse on September 22, 2012, 12:11:10 pm
That was quick, it works  8).

You'd have to create a CMD file with the commands and place it in Start Menu\Startup.
Title: Re: Any way to make a virtual drive from various folders?
Post by: MrC on September 22, 2012, 12:15:23 pm
Use PSUBST for persistent drive letter mapping.
Title: Re: Any way to make a virtual drive from various folders?
Post by: InflatableMouse on September 22, 2012, 12:18:58 pm
Yeah the problem with subst is you can't share the drive or folder. I'll look into psubst.
Title: Re: Any way to make a virtual drive from various folders?
Post by: MrC on September 22, 2012, 12:20:58 pm
Windows Libraries also accomplish this.  Create a library that includes all the folders.  You can share that too.
Title: Re: Any way to make a virtual drive from various folders?
Post by: InflatableMouse on September 22, 2012, 12:23:20 pm
Libraries are only a collection of folders in Windows Explorer. They don't work in a command prompt.

But subst isn't needed. Enthusiasm got the better of me :P. You can simply share (following the example above) "C:\DATA" and map a drive to it.
Title: Re: Any way to make a virtual drive from various folders?
Post by: Matt on September 22, 2012, 12:31:14 pm
Hey, this is neat.  I'm glad I asked.

I think it might work well to create a root 'Data' folder on each drive.  Inside 'Data', I'd put one or more of the root folders I mentioned.

Then somewhere I'd define the virtual data folder, say 'C:\Data Virtual', add all the junctions, then make it appear as a network share or drive letter (with PSUBST or mapping).

Then I just need to be smart enough to always use the virtual drive instead of digging around on C:\, D:\, etc.  But I've been doing this with media and a mapped M:\ drive for a long time, so hopefully that won't be too hard.

I haven't quite figured out how sharing permissions on the network work, but this gives me a good start.

Thanks.
Title: Re: Any way to make a virtual drive from various folders?
Post by: InflatableMouse on September 22, 2012, 12:55:50 pm
Honestly I don't see any benefit of using SUBST or PSUBST. Like I said that was just my nerdy enthusiasm taking over. Forget about it :). You can map a network drive to a locally shared folder too, which is persistent (if you check the option).

If your home network is running Windows 7, you can go the easy way with a Home Group (my suggestion). Otherwise you'd have to create shares manually and add permissions. I recommend not sharing the root of a drive but individual folders.

Sharing and accessing shares at home gets a lot easier if you have the same accounts and passwords on each pc, because if you create a share on your pc and add your own account 'matt' with full control, you can access that share from another pc if you have an account there called 'matt' with the same password as the pc the share lives on.