Symbolic Links and What They Do

derekullo

Distinguished
Just a small recap of where i'm coming from.

At work we have hundreds of computers that staff use.

Normally we say any data that is important to you, schedules, music, videos of corporate events, ... goes on the H drive which is mapped to that user's name on our 100+ Terabyte Tegile SAN with compression and Deduplication which for all intents and purposes is infinite.

Sometimes staff doesn't place important stuff on the H drive and instead puts it on the C drive which eventually dies.

I say something like;
"YOUR DATA IS GONE! IT'S JUST GONE! GAME OVER!"

And then I remembered something from years ago called Symbolic links.

And so here is the actual question of what i want to do.

mklink /J "C:\Users\awest\Documents" "H:\Documents_Backup"

If I were to type that would it create a copy/backup of everything in Adam West's Documents on the H:\Document_Backup ?

Did I discover the holy grail of easy backups or did I misread what a "symbolic directory junction" is?

I could script up something easy with robocopy, but was just curious of the above would work

I could test this tomorrow, but Tom's forum is omnipresent.
 

USAFRet

Titan
Moderator
Mar 16, 2013
114,654
2,136
157,290
18,667


Without training, users would fail that, and save stuff outside of "Documents".
Make it fool proof, and the universe grows bigger fools.

Policy and Training.

Save anything you want to keep to the H drive.
Done.




GAH!!!
 

Colif

Win 10 Master
Moderator
What Are Symbolic Links?
Symbolic links are basically advanced shortcuts. Create a symbolic link to an individual file or folder, and that link will appear to be the same as the file or folder to Windows—even though it’s just a link pointing at the file or folder.

For example, let’s say you have a program that needs its files at C:\Program. You’d really like to store this directory at D:\Stuff, but the program requires that its files be at C:\Program. You could move the original directory from C:\Program to D:\Stuff, and then create a symbolic link at C:\Program pointing to D:\Stuff. When you relaunch the program, it will try to access its directory at C:\Program. Windows will automatically redirect it to D:\Stuff, and everything will just work as if it were in C:\Program.

This trick can be used for all sorts of things, including syncing any folder with programs like Dropbox, Google Drive, and OneDrive.

There are two type of symbolic links: Hard and soft. Soft symbolic links work similarly to a standard shortcut. When you open a soft link to a folder, you will be redirected to the folder where the files are stored. However, a hard link makes it appear as though the file or folder actually exists at the location of the symbolic link, and your applications won’t know any better. That makes hard symbolic links more useful in most situations.

Note that Windows doesn’t actually use the terms “hard link” and “soft link”. Instead, it uses the terms “hard link” and “symbolic link”. In the Windows documentation, a “symbolic link” is the same thing as a “soft link”. However, the mklink command can create both hard links (known as “hard links” in Windows) and soft links (known as “symbolic links” in Windows).
Use /J to create a hard link pointing to a directory, also known as a directory junction:

mklink /J Link Target

So, for example, if you wanted to create a hard link at C:\LinkToFolder that pointed to C:\Users\Name\OriginalFolder, you’d run the following command:

mklink /J C:\LinkToFolder C:\Users\Name\OriginalFolder
You’ll need to put quotation marks around paths with spaces. For example, if the folders are instead named C:\Link To Folder and C:\Users\Name\Original Folder, you’d use the following command instead:

mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"
https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

they just shortcuts, they don't move the folders contents, they would however let you have their documents on another server and have a link to it so it appears to be on current PC, then just backup the folders on the server on a schedule
 

derekullo

Distinguished
Is there a way to mirror writes to another network storage device on the fly as I was trying to do?

I'm familiar with Synctoy and File History, but was hoping for a more instant and elegant solution.

 

USAFRet

Titan
Moderator
Mar 16, 2013
114,654
2,136
157,290
18,667
"At work we have hundreds of computers that staff use."

Active Directory, mapped drives, and GPO designating a shared save location.
This location is on a server, and that server is......BACKED UP.

The H drive, and each person gets their own subfolder.
Policy and training.
"If you save something in other than the H drive, and you lose it...Too Bad So Sad."

symlinks simply fakes out the OS into thinking a file is in one location when it is actually in another.
It does not make a copy.
 

James Mason

Titan
Moderator
I use Symlinks to sync my game saves between computers using one drive. But yeah it doesn't actually move the files. (the save games are actually in the one drive folder, and the game looks to the folder it thinks they're in and pulls them from the one drive folder, which is still technically on the computer) It'd also be a bit impractical to deploy that to an entire organization.

This is a way to have cloud backups of saved games without having actual cloud backups.

 
You could set up a scheduled task to mirror their Documents folder with robocopy - but I guess that's not elegant either. Free though and built into windows.

incidentally nothing to do with your problem but it bugs me "for all intensive purposes..." you've mis heard that, the phrase is "for all intents and purposes"
 

USAFRet

Titan
Moderator
Mar 16, 2013
114,654
2,136
157,290
18,667


Without training, users would fail that, and save stuff outside of "Documents".
Make it fool proof, and the universe grows bigger fools.

Policy and Training.

Save anything you want to keep to the H drive.
Done.




GAH!!!
 

derekullo

Distinguished


My bad.

DARN SPELLCHECK

Fixed

 

derekullo

Distinguished


Most users are "cooperative" enough to save to the H drive but I get the occasional person who doesn't.

My original goal was to copy Desktop, Documents, Music and Videos libraries to our SAN to make this as fool proof as possible.

They could always save data to c:\windows, but there is no hope for them lol.

I guess what I am describing would have to be a feature of the file system or at least an upgrade to the Windows Disk Management utility.

"A raid 1 like configuration that was configurable to only backup certain folders/files to a network share when that folder/file was written."

Now that I think about this it would be just like a raid 1 and as it has been mentioned many times raid 1 isn't back up.

Any file deletions/alterations would be mirrored instantly to the backup share location limited of course by your network connection speed.

The saving grace here is that our backup share uses snapshots so any deletes or changes could be undone if needed.
 

USAFRet

Titan
Moderator
Mar 16, 2013
114,654
2,136
157,290
18,667
Group Policy, and you can have the "Documents" folders actually ON the SAN.
The user knows no difference, except for maybe a slightly slower response.

Now, if a user saves something to C:\MyStuff and their drive dies....Too Bad, So Sad.
 

derekullo

Distinguished


I did think about that too, just move the save location to the actual SAN and done.

But if the link goes down between the SAN and that branch then they are unable to access any files.

We have a stable enough connection between most branches for the above to actually be feasible, although one branch is about 200 miles away from the main office on a 150 megabit link.

This issue may not have an optimal solution besides having common sense.

Having something like the feature I mentioned would be nice, although its a bit too advanced for most users due to the need to have the backup storage device having a snapshotting ability to turn this from a most likely slower performing raid 1 into an actual back up solution.

I didn't realize how vital the snapshotting part would be when I first asked the question.

Thank you for the insight.


 

USAFRet

Titan
Moderator
Mar 16, 2013
114,654
2,136
157,290
18,667
True.
If you're talking about long distance connection to the SAN, that is not optimal.

And eventually, that link WILL go down.

Ideally you have a local server for each geographic location branch, and then that works and syncs with the SAN.
 

ASK THE COMMUNITY

TRENDING THREADS