Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #AUTHOR: Erwin Iosef
- #Date:08/12/2024
- The workaround works in three recurring tasks, one being in Linux.
- You may adapt this strategy to your particular use case or as an inspiration.
- Objective: Make a Windows symlink pointing from "C:/Users/admin/Documents/My Games" to "E:/My Games" drive work in both Linux and Windows.
- Workaround:
- So, First things:
- I) In Windows:
- 1)Create a mount directory called C:/Edrive for E:/ via Windows: Computer Management-> Storage.
- 2)Create a symlink from "C:/Users/admin/Documents/My Games" to "C:/Edrive/My Games" using relative paths, for that we'd use om cmd:
- mklink /D "C:\Users\admin\Documents\My Games" "..\..\..\Edrive\My Games"
- Since the mount directory will be rendered invalid by Linux and it's not going to turn into a regular folder when you turn off Windows either,
- the best thing to do is to create tasks that would mount and unmount the Edrive directory mount when you startup and shutdown Windows, respectively.
- II)In Windows
- 1)So you'll have to create two .bat files. One for mounting the mount directory when you startup Windows and the other to unmount when you shutdown Windows:
- i)For Mount_Edrive.bat
- @echo off
- mountvol C:/Edrive \\?\{Your VolumeGID}\
- ii)For Unmount_Edrive.bat
- @echo off
- mountvol C:/Edrive /D
- NOTE: To see the volume GID for your drive, simply run 'mountvol' in cmd.
- Save these files in your preferred directory(preferably in C:/ ,in a folder)
- 2)In Run, enter gpedit.msc and create two tasks in Computer Configuration->Windows settings->Scripts(startup/shutdown) each corresponding to the two bat files.
- These scripts will run regardless of who's the user at startup and shutdown. If you want it for only your user there's User Configuration.
- Final step:
- III)In Linux: You will have to create a 'bind mount' directory from /path/to/C:/Edrive to /path/to/E:
- for the symlink to finally work in two OSes without much hindrance.
- 1)Enter a line in /etc/fstab, preferably as the last:
- /path/to/Edrive /path/to/E:/ auto, none bind,nofail 0 0
- 2) Write changes.
- Reboot and test changes in Linux and Windows.
Advertisement
Comments
-
- EDIT: Line 46 should be path/to/E:/ /path/to/Edrive
Add Comment
Please, Sign In to add comment