LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Hard link file doesn't sync in Dropbox (https://www.linuxquestions.org/questions/linux-newbie-8/hard-link-file-doesnt-sync-in-dropbox-4175588519/)

Gregg Bell 09-01-2016 04:24 PM

Hard link file doesn't sync in Dropbox
 
I have a hard link set up. The original file is in the Documents folder and the other (both with the same file name) in my Dropbox folder. On the same computer the hard link works perfectly. Any change is reflected in the file in both folders. But when I get home and check my Dropbox, the file doesn't have any of the new information I've added to it.

I've tried it with the Mega cloud storage/snyc too. Same result.

Know why this is happening? Any way around it? Thanks.

Hattablinux 09-01-2016 04:49 PM

Btw 68million password accounts leaked today by hackers change ur password

ondoho 09-02-2016 01:53 PM

Quote:

Originally Posted by Gregg Bell (Post 5599470)
I have a hard link set up.

what is this?
please elaborate.
what's a hard link?
show us some output.

jpollard 09-02-2016 02:01 PM

Quote:

Originally Posted by Gregg Bell (Post 5599470)
I have a hard link set up. The original file is in the Documents folder and the other (both with the same file name) in my Dropbox folder. On the same computer the hard link works perfectly. Any change is reflected in the file in both folders. But when I get home and check my Dropbox, the file doesn't have any of the new information I've added to it.

I've tried it with the Mega cloud storage/snyc too. Same result.

Know why this is happening? Any way around it? Thanks.

Sure.

NONE of the cloud storage tools are immediate. It all depends on how often the local tool gets around to copying the updates to the remote storage. There can be delays of minutes or hours - there may even be a configuration option to increase the update rate - but note: increasing the rate will slow down your system, and increase your network load if you are doing something that updates the file - and it makes intermediate copies...

As far as I know, there is no way to make it faster - and still be usable.

jpollard 09-02-2016 02:16 PM

Quote:

Originally Posted by ondoho (Post 5599905)
what is this?
please elaborate.
what's a hard link?
show us some output.

A Linux/UNIX file is represented by an array (stored on disk) of inodes (short for index node). A directory is just a file that has (at a minimum) an inode number, and the file name. When a file name is put in a directory the inode structure has a counter that gets incremented. This is the "link count", and the "hard link" is directory entry.

Since this is a logical structure, nothing prevents another directory from having an entry with the same inode number and a different file name. When this happens, the "link count" gets incremented - thus a second hard link.

A file is never deleted until the "link count" goes to zero. Other things to note is that if a file is open (reading or whatever) it causes the memory resident copy of the inode count to be incremented for each open system call for reading/updating the file. If the file name is deleted, the link count is decremented - but because the process having the open file busy prevents it from being deleted. If the system shuts down, the processes are terminated, and the link count is decremented - and when all processes that have the file open are terminated the count will be zero and the file is deleted.

As a side effect of this logical structure is that hard links cannot cross filesystems. For that purpose use a "symbolic link" which works very similarly (allowing multiple pointers to the same file), but those are implemented by actually creating a file (with a hard link), but the inode is specifically marked as "symbolic link" and the contents of the file are a path to the file being pointed to.

Gregg Bell 09-03-2016 07:01 PM

Quote:

Originally Posted by jpollard (Post 5599906)
Sure.

NONE of the cloud storage tools are immediate. It all depends on how often the local tool gets around to copying the updates to the remote storage. There can be delays of minutes or hours - there may even be a configuration option to increase the update rate - but note: increasing the rate will slow down your system, and increase your network load if you are doing something that updates the file - and it makes intermediate copies...

As far as I know, there is no way to make it faster - and still be usable.

Thanks jpollard but I don't think it's a speed issue. And Dropbox has never been slow to update. I mean, I turn the syncing computer on and I get a window saying: 'Dropbox has updated three files.'

Let's say I'm using a file, say in Documents again, and I'm making changes and then 'saving as' (and let's say there's a copy of that file already in Dropbox) in Dropbox. When I check my other computer both files are synced. When I do the hard link way (as described in my original post) it never syncs.

A friend said that hard links are often not "expected" by other programs, esp. something like Dropbox in Linux. I'm not sure what that means but I figured I'd throw it out there.

ondoho 09-05-2016 12:23 AM

please elaborate on what you think a hard link actually is and how your directory structure is set up, what you did that makes you think that the "hard link" is causing the issue.

and thanks jpollard, but i wanted additional info from op.

maybe the solution IS to use symbolic links instead.

Gregg Bell 09-06-2016 12:07 PM

Quote:

Originally Posted by ondoho (Post 5600814)
please elaborate on what you think a hard link actually is and how your directory structure is set up, what you did that makes you think that the "hard link" is causing the issue.

and thanks jpollard, but i wanted additional info from op.

maybe the solution IS to use symbolic links instead.

Thanks ondoho. I've used hard links. (To me, hard links are working on one file and having the changes show up on another file in another location, as well.) But the problem is with hard linking a file in Dropbox. When I get to my other computer the file is not updated. I guess you could say the hard link failed.

All I'm doing now is saving the file in my Documents folder and then overwriting the same file in Dropbox. It's all good now.

273 09-06-2016 01:14 PM

Quote:

Originally Posted by Gregg Bell (Post 5601531)
I've used hard links. (To me, hard links are working on one file and having the changes show up on another file in another location, as well.)

Then read what a hard link is. I suspect you're using soft links and that is why it is failing.

Gregg Bell 09-07-2016 12:28 PM

1 Attachment(s)
Quote:

Originally Posted by 273 (Post 5601561)
Then read what a hard link is. I suspect you're using soft links and that is why it is failing.

Thanks 273. This is how I made my hard links.

ondoho 09-07-2016 02:10 PM

yep, that creates a hard link.
i never use them.
why are you using them?
the usual recommendation is to use symlinks: ln -s ...

273 09-07-2016 02:30 PM

It creates a hard link on the same physical volume. How does an "ls -la" look in the relevant folder?
Sorry, not doubting this but I can't think of any way for the OS to identify. A hard link in such a way as it doesn't copy it by default using a tool. I suppose, if the tool does have such restrictions, then it must be deliberate and, so, there may be a way to tun it off.

Gregg Bell 09-07-2016 09:03 PM

Quote:

Originally Posted by ondoho (Post 5602031)
yep, that creates a hard link.
i never use them.
why are you using them?
the usual recommendation is to use symlinks: ln -s ...

I'm using them because I read about them in my "Ubuntu Unleashed" book. LOL And I do like the idea of the file being in two places. If I accidentally delete one file, the other will still be there.

Gregg Bell 09-07-2016 09:05 PM

Quote:

Originally Posted by 273 (Post 5602043)
It creates a hard link on the same physical volume. How does an "ls -la" look in the relevant folder?
Sorry, not doubting this but I can't think of any way for the OS to identify. A hard link in such a way as it doesn't copy it by default using a tool. I suppose, if the tool does have such restrictions, then it must be deliberate and, so, there may be a way to tun it off.

Hi 273. I'm just dabbling with them. If they were more important I'd really want to know what's happening with them but I don't even have to use them.

ondoho 09-07-2016 11:54 PM

well have you tried to use symlinks instead???
supposing the dropbox problem still persists.


All times are GMT -5. The time now is 07:34 PM.