Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux links in root or folder not usable #3

Open
simona70 opened this issue Jul 15, 2021 · 15 comments
Open

linux links in root or folder not usable #3

simona70 opened this issue Jul 15, 2021 · 15 comments

Comments

@simona70
Copy link

simona70 commented Jul 15, 2021

I have some ntfs partition. inside it i have linux links. but with ntfs3 instead fuse ntfs links to folders and files are not available.
must i do a screen?

@BachoSeven
Copy link

BachoSeven commented Jul 18, 2021

Probably a duplicate of #1; see https://aur.archlinux.org/packages/ntfs3-dkms/?O=60&PP=10 for explanations: basically ntfs-3g creates its own fake versions of a symlink which are not even supported by Windows, so their use is limited. I suggest you replace them by re-creating them using ntfs3 if you wish to have properly working, cross-platform(meaning both on linux and windows), "symlinks".

@simona70
Copy link
Author

yes, but it's an annoying thing :-)
I'd like to switch from one driver to another in a "transparent" way without having to change the contents of the disc from time to time.
but thanks for reply.

@BachoSeven
Copy link

BachoSeven commented Jul 18, 2021

If you wanted to "convert" all of the symlinks in the ntfs partition from the "fake" ntfs-3g type to the ntfs3 type, all you would need to do is:

  • Mount your NTFS partition using ntfs-3g (i.e. mount -t ntfs)
  • cd /root/of/your/ntfs/partition
  • find -type l, which will tell you all the symlinks present in the partition
  • run realpath SYMLINK on all of them, and save both the path and realpath of the symlink in a file for later
  • unmount the NTFS partition, and re-mount it using mount -t ntfs3 for the paragon fs
  • recreate the symlinks :)
    just leaving this here for anybody who is looking to do what I needed to do for this

@simona70
Copy link
Author

simona70 commented Jul 18, 2021 via email

@BachoSeven
Copy link

Sorry, I meant find -type l

@simona70
Copy link
Author

simona70 commented Jul 19, 2021 via email

@BachoSeven
Copy link

BachoSeven commented Jul 19, 2021

you can do something like that using the -exec flag for find; which combined with -print will give you a list with two lines for each symlink, where each second line is the real path:

find -type l -print -exec realpath {} \;

You could then redirect this to a file using > script, and then make it into a script by editing the file, prepending #!/bin/sh, chmod +x script and then formatting the lines like
ln -sf realpath symlinkpath
for each entry; this way, once you re-mount it, you can automatise the process(-f is needed to overwrite the "fake" pre-existing links)

P.S. in order for the script to work you might want to have absolute paths; you can achieve this easily by running the above find command from /, like:

cd /
find /PATH/TO/ROOT/OF/NTFS (other flags)

P.P.S. you might want to quote ("path") all the paths as well in order for the script to work correctly

Edit: I was planning on doing everything manually, but since I took the time to try and automatise it for you I went ahead and tried the above, and can confirm it will work; i.e. I successfully recreated all the symlinks automatically. Might be useful if you have many; if you know how to use vim it will be helpful in formatting the script; for reference here is my script so you see how it should look.

@simona70
Copy link
Author

simona70 commented Jul 19, 2021 via email

@simona70
Copy link
Author

simona70 commented Jul 19, 2021 via email

@simona70
Copy link
Author

simona70 commented Jul 19, 2021 via email

@BachoSeven
Copy link

That should be fine, as long as you stay in that directory, since the "%p" part is only a relative path. Although, you might have to add the -f flag to ln as I was saying earlier, since those symlinks already exist, so you need to -force re-creating them

@simona70
Copy link
Author

simona70 commented Jul 19, 2021 via email

@BachoSeven
Copy link

realpath PATH gives you the absolute path; as for returning directly the absolute path from the output of find, you can use the trick I suggested above of launching the command from /:

P.S. in order for the script to work you might want to have absolute paths; you can achieve this > easily by running the above find command from /, like:

cd /
find /PATH/TO/ROOT/OF/NTFS (other flags)

@simona70
Copy link
Author

simona70 commented Jul 19, 2021 via email

@BachoSeven
Copy link

BachoSeven commented Jul 20, 2021

With / do not give only links for this only mounted partition but entire system

Not if you give the "base path" as the first argument to find; i.e. find BASEPATH <Other Flags>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants