Abstract
Symbolic link works effectively to migrate folders and files from old disk to new one. Typical situation is
- install new storage
- move folders and files from old storage
- make symbolic link to point new location on old storage
User can access data with old paths while data is placed at new location.
This post introduce etcetera about hard link and soft link including symbolic link.
Hard link and soft link
scope | target | example | |
---|---|---|---|
hard link | single volune | file | |
soft link 1 | local | folder | junction |
soft link 2 | local remote |
file folder |
alias shortcut symbolic link |
Hard link
Hard link provides multiple links to a single data. Example,
- multiple paths to a single file
- different callings to a single command
It works only inside a single volume and hard link and its target file must be inside there.
Soft link - junction and symbolic link
scope | privilege | |
---|---|---|
Junction | inside a single PC | user |
Symbolic link | local remote |
administrator |
Soft link provides multiple links to a single data. Although both junction and symbolic link are soft link, their scopes and privileges are different.
Junction works with user privilege but its scope is restricted within a single PC. On the other hands, symbolic link can support both local and remote, but it requires administrator privilege.
Create symbolic link and update its link target
Assuming the following situation,
old location | c:\old-path |
new location | d:\new-path |
the other location | d:\another-path |
Admin needs to move data from the old location to new one, but Admin wants users to access data with the old-path. Then, Admin makes symbolic link after data migration with the next command.
new-item -itemtype symboliclink -path c:\old-path -target d:\new-path
If Admin needs to migrate data to the other location, the target of symbolic link can be updated (overwritten) with "force" option.
new-item -itemtype symboliclink -path c:\old-path -target d:\another-path -force