Monday, July 20, 2009

Linux Hard Links vs. Symbolic Links

Today I was looking for a solution for some problem in my website,

A solution of the problem was to use upload a folder X, in each subfolder on my server, the content of the X folder is the same in all subfolders, and if the content changed in one subfolder, it should changed in all the subfolders :O , so now, I need to copy this folder in each subfolder and each new created subfolder should contain this X folder too.

Stupid Idea (was mine) was to copy the folder in each subfolder, and the process of concurrent content checking will be done manually, Imagine the situation when you have about 50 folder and each on contain this X folder, BAAAAAAAAAAAAD

another Idea there was to create the X folder in somewhere on the server, and link it in every where you need it on the server with the same name (X), here, you will ensure that any change in the main X folder will be reflected in the links.

I myself find the Idea Excellent, but the Question was, Which type of file linking?
HardLinking or SoftLinking?

I founds SoftLinking (symbolic linking) better as I can refer to any location on the disk from any other location on the disk, not only the same partition.

My Question Here:
Will the symlinks increase the time of accessing the content from the original (X) folder than accessing it from X folder in the first solution?

Still can't find the answer, but still looking for it!