topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 3:43 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: keeping/saving cloned files  (Read 27980 times)

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #25 on: October 10, 2006, 03:05 PM »
Darwin-
did you ever have another go?
Tom

Darwin

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,984
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #26 on: October 10, 2006, 08:58 PM »
Hi Tomos,

No, I never did try it again. I'll do it now and report back...

Darwin

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,984
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #27 on: October 10, 2006, 09:05 PM »
So far so good... So far I've managed to create a couple of hard links. I'll keep playing with it.
That's pretty cool - I've made a couple of hard links and moved the files to different drives, and the hard links still work! Well, I guess that's what they're supposed to do, but I'm still impressed  8)
« Last Edit: October 10, 2006, 09:13 PM by Darwin »

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #28 on: October 19, 2007, 11:54 PM »
Just bumped on that thread again. Thought maybe I could add my little experience. IMO ntfs links' hard links : a bit unreliable.

I used it for a while (in the past), but had to give up on it -- except for a couple of softlinked folders i'm still keeping (Cthorpe discussed the idea behind doing that at some point in another thread).

I don't know about Directory Opus with NTFS Links (Tomos, Darwin ?), but even with explorer, hard links didn't seem to work with all kinds of files. How can that be?

e.g. : no problem with txt or pdf files, but *.doc were another story. Weird, I had no idea why -- could be a certain character related problem?? I didn't explore all possibilities at the time. Life is too short?

mwang

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 205
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #29 on: October 20, 2007, 01:01 AM »
Same experience here. I believe it has something to do with how an application modify a file. Word, e.g., create a temp file and rename it to the original after renaming the original to a wbk, hence breaking the hardlink.

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #30 on: October 20, 2007, 01:07 AM »
Same experience here. I believe it has something to do with how an application modify a file. Word, e.g., create a temp file and rename it to the original after renaming the original to a wbk, hence breaking the hardlink.

Makes sense, mwang!  :up:
(I don't see any other explanations.)
That would also probably explain why the file collections feature in Directory Opus was not working that well either when I tried it.
Too bad.

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #31 on: October 20, 2007, 01:29 AM »
Semi-Confirmation : elsewhere on the net :
Quote: "However, with .doc files and .htm files, I ran into problems. I can create the hardlink (same setup as above). However, when I open the real file and make changes and then try to open the file from the hardlink, the changes don't show. If I open the file from the hardlink, I can make and save changes there, but they won't show up when I open the real file.

Am I off base here to think I can do this? Can someone point me in the right direction? THANKS!"


The reason for this is that when saving a file in MS Word, Word will create a new file, delete the original and rename te newly created file. Because of this the hardlink will point to the original and not the newly created file.


http://shell-shocked...g/article.php?id=284

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #32 on: October 20, 2007, 04:37 AM »
after the unpredictability of hard-links I gave up - have new computer now but havent tried hard links yet.
Could give it a go again...

I have tried Junction Points though:
From thread     
soft and hard links in ntfs :
Re problems deleting folders in Junction Points:
From http://en.wikipedia..../NTFS_junction_point

Observed effects
Windows Explorer:

...
# Whilst walking through the directory with explorer, it seems impossible to delete folders, however files can be deleted.
# A solution for these issues is installing NTFS Link, which makes Windows Explorer handle junctions correctly. One can also use the fsutil application to delete and query reparse points (administration privileges are required).
-http://en.wikipedia.org/wiki/Windows_Explorer

will try this nfts link & see how I get on
tried a few different apps - no success deleting folders so think I'll probably give up on that idea too :(
Tom

mwang

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 205
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #33 on: October 20, 2007, 06:46 AM »
I've used junction points in XP for years, as well as softlinks in Vista. Both work well here, never having trouble deleting folders.

Darwin

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,984
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #34 on: October 20, 2007, 08:04 AM »
I didn't have any trouble with hard links - I just never really warmed to them...

mwang

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 205
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #35 on: October 21, 2007, 01:06 AM »
I do like hardlinks, IF they work. I reorganize my files and folders quite often, so softlinks/junctions break all the time. Unfortunately, hardlinks on NTFS just don't work as reliably as expected.

To be fair, I work mostly with text files on Linux, so I'm not sure if files created by Open Office, e.g., have the same problem as MS Office files on Windows.

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #36 on: October 21, 2007, 01:57 AM »
Hardlinks would be ideal for me if their behavior was consistent.
Unfortunately, because they don't always work, I've had to find other ways of achieving similar results.

I didn't have any trouble with hard links - I just never really warmed to them...

Try them with word documents : you should have problems.

namsupo

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: keeping/saving cloned files
« Reply #37 on: October 21, 2007, 02:46 PM »
Hard links do work quite reliably on NTFS, the problem is the way Word is saving files.

All files are hard links. A filename in a directory is just a record in the file system of a bunch of data located somewhere on the disk. When you create a hard link to an existing file, all you are doing is creating another filename entry to the same block of data. The two entries are indistinguishable. There is literally no way to tell which one was the original and which one is the hard link.

The problem described above arises because of the way Word saves files. Instead of opening the existing file, clearing out its contents and then writing new data, Word does what is called a "safe save". That is, it write the new document to a temporary file first. Once the file has been safely written to disk, it deletes the original file, and renames the temporary file.

This causes a problem when you have two hard links pointing to the same chunk of data, as deleting one of the links does not delete the data. All it does is delete the duplicate filename record. It is only when the last hard link to a file is deleted that the actual data is removed.

So in the above scenario with Word, one of the hard links is deleted during the safe save process, but the other one is not (since Word doesn't know anything about it.) Word then renames its temporary file back to the name of the original, but this is now a new filename record pointing to a new chunk of data. The remaining hard link to the old data is still present, still works, and still points to the old data.

I think it's reasons like this that explain why Microsoft draw such little attention to the linking abilities of NTFS - it's not that they don't work, it's just that they can easily cause confusion when you don't quite understand how it works.

Nudel

  • Member
  • Joined in 2007
  • **
  • Posts: 74
    • View Profile
    • << Pretentious Name >>
    • Donate to Member
Re: keeping/saving cloned files
« Reply #38 on: October 21, 2007, 02:51 PM »
I guess namsupo already covered most of this and his reply got in before mine, but here's mine anyway in case the little ASCII diagrams are helpful. :-)


Hardlinks would be ideal for me if their behavior was consistent.
Unfortunately, because they don't always work, I've had to find other ways of achieving similar results.
Their behaviour is consistent. If it wasn't it would be very worrying for a filesystem feature! :-)

What isn't consistent is how you (indirectly, via the programs you use on your files) are interacting with the hardlinked files. A hardlink to a file is simply an additional filename which points to the same data that the original filename pointed to.

When you create a file normally you are, without knowing it, effectively creating a hardlink which associates a filename with some data (the file contents):

FilenameA -> [Data1]

If you then create a hardlink you will have two names both pointing to the same data:

FilenameA -> [Data1] <- FilenameB

Hardlinks point to data and not to filenames! FilenameB is pointing to the same data as FilenameA but it is not actually pointing to FilenameA. (That would be a symbolic link.) If the meaning of FilenameA changes it has no effect whatsoever on FilenameB.

If you delete FilenameA but leave FilenameB then you're left with this:

FilenameB -> [Data1]

If you now create a new file and happen to call it FilenameA then it's a completely separate file. There is no connection at all between FilenameA and FilenameB:

FilenameA -> [Data2]
FilenameB -> [Data1]

So when Word deletes the old file and then saves a new file with the same name that's what happens. If Word instead overwrote the old data with the new data, without deleting or creating any files, then the problem would not occur.

Of course, you often cannot change how a program saves its files. (Sometimes you can, sometimes it's out of your hands.) So using links like this isn't a good idea and can lead to confusion. Links in general can lead to confusion and shouldn't be used gratuitously. (Symbolic links and shortcut files are less of an issue). But while I recommend that people don't use the things when it isn't necessary, the way hardlinks work is completely consistent and well-defined.
« Last Edit: October 21, 2007, 03:00 PM by Nudel »