20

Is there a Linux utility that can create NTFS symbolic links? That is, a link on an NTFS partition that points to another NTFS folder - one that will work within Windows 7, specifically.

I wish to relocate a folder that is normally in-use while Windows is running. This machine can already dual-boot into Ubuntu, so I'd like to leverage that.

EDIT: To keep this from potentially turning into "which Windows Live CD is best", I will limit this question to "Is it possible with Linux, yes or no?"

3
  • 1
    Create the symbolic link on the drive slaved up in another Windows machine?
    – user3914
    Jul 29, 2010 at 19:17
  • That's definitely an alternative, but I'm more likely to go with a boot CD than to pull the drive in this case.
    – rymo
    Jul 29, 2010 at 20:16
  • As of today, an actual ntfs-3g on linux creates links that work fine under linux, but windows(7) does not identifies them correctly. However, links created using mklink under windows work properly under linux.
    – liwin
    May 4, 2017 at 8:46

5 Answers 5

12

By using NTFS-3G Advanced, it appears possible to treat existing junctions/NTFS links as if they were Linux symlinks, but my actual goal of creating new ones that work within Windows is a no-go:

Dereferencing junction points and symbolic links created by Windows is thus made possible, so are hard linking, renaming and deleting, but creating new ones is not.

6

I know this thread is pretty outdated, but lately I've had the same problem (I needed to move some windows system folders to another drive) and here is simple solution.

In Windows, copy (not move) the folder into new location and create symlink to it with slightly different name (so no collision occurs) and then in Linux simply delete original folder and rename symlink to original folder name. Restart and it's working. Used systems were Windows 8.1 and Ubuntu 14.04.

Lubo

4

How to make a symbolic link (aka: junction point or reparse point) on an NTFS drive from Linux. Taken from: http://www.tuxera.com/community/ntfs-3g-advanced/extended-attributes/

If needed: sudo apt-get attr

# Display the reparse data of the file source-file
getfattr -h -e hex -n system.ntfs_reparse_data source-file

# Copy the reparse data of the file source-file
# to the file target-file
REPARSE=`getfattr -h -e hex -n system.ntfs_reparse_data source-file | \
         grep '=' | sed -e 's/^.*=//'`
setfattr -h -v $REPARSE -n system.ntfs_reparse_data target-file
2
  • 1
    Could you improve this anwser? You have not mentioned it requires sudo apt-get attr first. What is the source-file and target-file? If I want to create a link from /home/xxx/Music to /media/Storage/Music which one is the source and which is the target?
    – loostro
    Jun 24, 2014 at 13:36
  • Also, the first part (getfattr) returns "No such attribute" no matter in I run it on /home/xxx/Music or /media/Storage/Music
    – loostro
    Jun 24, 2014 at 13:38
0

Just mounting the partition under Linux and creating the link with ln -s should work. This doesn't give you access to the full complexity of NTFS links, but should be enough for your purpose.

There are two different implementations of NTFS for Linux: NTFS-3g (filesystem name ntfs-3g, Ubuntu package ntfs-3g) and Linux-NTFS (filesystem name fuse.ntfs, Ubuntu package ntfsprogs). If one of them doesn't do what you want, try the other one.

1
  • 2
    I'm already mounting the partition with ntfs-3g, and it neither follows existing links/junctions, nor creates Windows-compatible links with ln
    – rymo
    Jul 29, 2010 at 21:16
-1

It appears that the documentation for NTFS-3G is outdated, I'm using the Ubuntu version 2011.4.12AR.4-2ubuntu3 and I was successfully able to create symbolic links inside of a virtual partition. Here's the procedure I used to test this:

dd if=/dev/zero of=ntfs.image bs=1024 count=20480
mkfs.ntfs -F ntfs.image
mkdir ntfs
sudo mount ntfs.image ntfs
cd ntfs
mkdir target
ln -s ./target symlink
ls -alF
cd -
rmdir ntfs
sudo umount ntfs
rm ntfs.image
4
  • 1
    The question is, would your symlink function properly if that ntfs.image were mounted under an actual Windows installation? The whole point was that I wanted to use Linux to rearrange a physical Windows partition's directory structure.
    – rymo
    Jun 20, 2012 at 4:49
  • I don't know for sure, but I would guess that NTFS-3G would not have added this feature of Windows did not recognize the link. It's important to note that you would need to load the "ntfs-3g" package if you booted to a live disk to try this, no distribution that I'm aware of includes NTFS-3G on the disk.
    – Compholio
    Jun 21, 2012 at 14:32
  • 1
    ln -s "worked" for me in that it didn't fail, but the resulting link was not usable when mounted under Windows. If you can actually test this, let us know what happens.
    – rymo
    Jun 21, 2012 at 16:14
  • Yeah, I tried at work and these links are not recognized. It also doesn't recognize the Junction Points made on Windows though, so it's possible that I just need to upgrade my OS (currently using 11.10).
    – Compholio
    Jun 22, 2012 at 17:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .