ntfs3 icon indicating copy to clipboard operation
ntfs3 copied to clipboard

linux links in root or folder not usable

Open simona70 opened this issue 3 years ago • 15 comments

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?

simona70 avatar Jul 15 '21 15:07 simona70

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".

BachoSeven avatar Jul 18 '21 10:07 BachoSeven

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.

simona70 avatar Jul 18 '21 11:07 simona70

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

BachoSeven avatar Jul 18 '21 11:07 BachoSeven

find -t lwas not ok.... find: predicato unknown "-t"


Simona

Il giorno dom 18 lug 2021 alle ore 13:13 Francesco @.***> ha scritto:

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 -t 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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rmnscnce/ntfs3/issues/3#issuecomment-882040334, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5PBXMVBNFWVA37K2NYV7TTYKZOJANCNFSM5ANZOZ3Q .

simona70 avatar Jul 18 '21 21:07 simona70

Sorry, I meant find -type l

BachoSeven avatar Jul 19 '21 07:07 BachoSeven

Thanks, this is ok, it gives me a very long list of link. You know if exist a way to have this list with link and linked folder?


Simona

Il giorno lun 19 lug 2021 alle ore 09:57 Francesco @.***> ha scritto:

Sorry, I meant find -type l

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rmnscnce/ntfs3/issues/3#issuecomment-882329819, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5PBXODNEPF7LTW3CFO24TTYPLGTANCNFSM5ANZOZ3Q .

simona70 avatar Jul 19 '21 09:07 simona70

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.

BachoSeven avatar Jul 19 '21 09:07 BachoSeven

I did this...

find . -type l -printf 'ln -s "%l" "%p"\n'

helping me looking around

Simona

Il giorno lun 19 lug 2021 alle ore 11:35 Francesco @.***> ha scritto:

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 are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rmnscnce/ntfs3/issues/3#issuecomment-882401769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5PBXO6QU6RTKJCV4MWLWDTYPWWJANCNFSM5ANZOZ3Q .

simona70 avatar Jul 19 '21 13:07 simona70

make_recreate_links () { echo "#!/bin/bash" > recreate_links.sh find . #-maxdepth 1 find . -type l -printf 'ln -s "%l" "%p"\n' >> recreate_links.sh chmod +x recreate_links.sh }

do you think it could be an idea? do you see contraindications? do you see flaws? do you see problems?


Simona

Il giorno lun 19 lug 2021 alle ore 11:35 Francesco @.***> ha scritto:

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 are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rmnscnce/ntfs3/issues/3#issuecomment-882401769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5PBXO6QU6RTKJCV4MWLWDTYPWWJANCNFSM5ANZOZ3Q .

simona70 avatar Jul 19 '21 13:07 simona70

make_recreate_links () { echo "#!/bin/bash" > recreate_links.sh find . #-maxdepth 1 find . -type l -printf 'ln -s -f -v "%l" "%p"\n' >> recreate_links.sh chmod +x recreate_links.sh }


Simona

Il giorno lun 19 lug 2021 alle ore 11:35 Francesco @.***> ha scritto:

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 are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rmnscnce/ntfs3/issues/3#issuecomment-882401769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5PBXO6QU6RTKJCV4MWLWDTYPWWJANCNFSM5ANZOZ3Q .

simona70 avatar Jul 19 '21 13:07 simona70

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

BachoSeven avatar Jul 19 '21 16:07 BachoSeven

yes. thx. a way to "read" absolute path?


Simona

Il giorno lun 19 lug 2021 alle ore 18:29 Francesco @.***> ha scritto:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rmnscnce/ntfs3/issues/3#issuecomment-882688106, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5PBXIHVZI7IZVYWJOCK4DTYRHINANCNFSM5ANZOZ3Q .

simona70 avatar Jul 19 '21 20:07 simona70

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)

BachoSeven avatar Jul 19 '21 21:07 BachoSeven

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


Simona

Il giorno lun 19 lug 2021 alle ore 23:04 Francesco @.***> ha scritto:

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)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rmnscnce/ntfs3/issues/3#issuecomment-882857912, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5PBXNFJVTXZRTPDC2TXW3TYSHOHANCNFSM5ANZOZ3Q .

simona70 avatar Jul 19 '21 22:07 simona70

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>

BachoSeven avatar Jul 20 '21 07:07 BachoSeven