Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've recently become aware of a neat feature of Windows file systems called a reparse point. My understanding is that they are files whose contents when read are not the contents on the actual disk, but whatever the application they request says they are.

The most striking use of this I am aware of is in Skydrive: All of your Skydrive files can be made to appear to be on disk even when they're not. When you access them they are actually streamed from the internet by Skydrive, because determining the true contents of the file is delegated to it.

Is there any mechanism in the Linux world to provide this kind of functionality? I've stumbled across Device Files and Named Pipes, but they both seem tailored to having a single file represent the interface to an application, rather than having several files and folders all appearing to be regular files but being "translated" by an application when accessed.

share|improve this question
1  
I think FUSE filesystems are the feature you're looking for. –  Joseph R. Jan 16 at 7:05
    
What exactly do you want to do with this functionality? If you explain your end goal we might be able to help. –  terdon Jan 16 at 13:10
    
Accomplishing this skydrive-like functionality would be the end-goal. Being able to present remote files as local files in arbitrary locations (e.g. more flexible than mounting an enitre SMB/NFS share to some directory), but being able to replace them with actual local files once they've been downloaded once. Ideally it would be agnostic to the actual FS the user has installed. –  Alexis Beingessner Jan 16 at 15:36
    
I'm basically doing research into this for the possibility of adding this functionality to owncloud. I've provided a fairly detailed use-case in their issue tracker: github.com/owncloud/core/issues/6760 –  Alexis Beingessner Jan 16 at 15:41
    
As a first step, having all the files under one directory would likely be adequate, however it should be the case that some of those files are remote (need to be "translated" by being streamed from elsewhere), and some are local (do not need to be translated). Ideally the local files should remain available even if the application crashes, though again this may not be necessary as a proof-of-concept. –  Alexis Beingessner Jan 16 at 16:03

1 Answer 1

up vote 1 down vote accepted

There is no exact equivalent to Windows reparse points. I'm not familiar with them (I only have a vague idea of what they do), but from what I can tell, they are a sort of hybrid between hard links, mount points and symbolic links.

A hard link is a file that is in multiple locations on the same filesystem. As this is not very useful to most users I don't dwell on them further.

A symbolic link is a special file that says “look over there instead”. All programs that affect the content of the file see the actual underlying file instead. Only programs that manipulate files as directory entries (e.g. renaming files) or give special treatment to symbolic links see the symbolic links as such. You can have symbolic links to any type of files: regular files, directories, etc. A symbolic link is purely textual. The target may or may not exist at any point in time. If the target moves, the symbolic link doesn't follow — the flip side of the coin being that you can transparently replace the target of a symbolic link.

A mount point is a directory at which the filesystem driver changes. For example, if a CD drive is mounted at /media/cdrom, then the file /media/cdrom/wibble is the file called wibble at the root of the CD. For more background and examples, see

There are plenty of filesystems that do not correspond to files on a storage medium. They can be files accessed over the network, pseudo-files served by the kernel, alternate views of other parts of the filesystem, archives seen as directories, and countless other possibilities.

I think that Windows's junction points are closer to symbolic links (but with some tracking of the target), and reparse points are about as general as mount points.

FUSE (Filesystem in Userspace) is a general programming framework to build filesystems where an application has entire control over what is seen as a file. All requests to manipulate files (read, write, list, rename, etc.) on a FUSE filesystems are handled by a user process. In other words, these are precisely “files whose contents when read are not the contents on the actual disk, but whatever the application they request says they are”. There are hundreds of FUSE filesystems around (if not more).

Files from Skydrive appearing as files on a mounted filesystem has been done, with FUSE: skydrive-fuse-fs. I have no idea about the code maturity, the project doesn't look very active, however it has official backing. See also mounting skydrive as a folder and How do I mount a Windows Live SkyDrive account as a partition?.

If you want to mix local files and remote files in the same directory, the general concept is a union mount. You can make a union mount of a local filesystem (or a directory tree in a local filesystem) and a Skydrive filesystem. There are several union filesystems using FUSE, including unionfs-fuse, Unionfs and AUFS.

What a union mount won't give you is automatically making a local copy of files the first time you access them. For that, you need a caching filesystem. Possibilities include pcachefs and MCachefs; I don't know how mature they are.

share|improve this answer
    
Awesome answer! Looking into these links now. I'll mark this as the answer assuming there isn't something better posted and/or a fatal problem with your suggestions. –  Alexis Beingessner Jan 17 at 3:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.