Note: By now only root can use OFS, because it uses the
mount command internally.
Now you should be able to mount a remote share.
Start by simply mirroring a directory. For example mount the /usr directory to /mnt. This can be done using the command:
# mount -t ofs file://usr /mnt
You will see the word Starting at the prompt again. If you execute the command
you should see a line similar to the following, indicating that /mnt is now an ofs managed mountpoint
ofs on /mnt type fuse.ofs (rw,nosuid,nodev,allow_other)
Change to /mnt now and see your files.
Now you can try to mount a samba share (we haven't tested OFS with any other filesystem by now).
# mount -t ofs smbfs://some.server/some/share /some/mountpoint
On some systems, you have to use
smb:// instead of
smbfs://. IMPORTANT NOTICE:
Of course this will change in the future.
Example for mounting a SMB share with username and passwort set in the mount command:
# mount -t ofs smbfs://some.server/some/share /some/mountpoint -o username=myuser,password=mypass
To mark a folder (and all its sub-files and folders recursively) available offline, extended attributes are used. Issue the following command:
# setfattr -n ofs.offline /path/to/directory
See Extended attributes for more information about the command line interface.
On Mac OS X use:
$ xattr -w ofs.offline /path/to/directory
To switch to offline mode issue the following command on the root of your mounted filesystem
# setfattr -x ofs.available /mnt
You are now working in disconnected mode. This means, the remote filesystem has been unmounted and you can safely remove you network connection.
When browsing your share you can see only the directories you made offline before. You can edit, add and remove files and directories the same way as if you were online.
On Mac OS X use:
$ xattr -d ofs.available /mnt
Make sure the network connection to your server is restored
Enter the following command on the root of your ofs mountpoint to switch back online
# setfattr -n ofs.available /mnt
Now your remote filesystem will be mounted again and the changes you made during offline mode will be reintegrated to the server.
You can now see your complete share again.
If you change a file on the client and someone edits the same file on the server while you work in disconnected mode this file remains in conflicted state and does not get reintegrated.
To find conflicted files, the attribute ofs.conflict is used. It tells you if
# getfattr -n ofs.conflict /mnt
shows yes if there is a conflicted file below the /mnt directory.
# getfattr -n ofs.conflict /mnt/*
List all files and directories below the /mnt directory and indicates for each one whether it is conflicted or not. In such a way you can go step-by-step from the root to the conflicted file.
When you have found a conflicted file, you can decide if the local should overwrite the file in the server or the other way.
The following command accepts the local file as current and overwrites the file on the server:
# setfattr -n ofs.conflict -v=local /path/to/conflicted/file
To make the remote file current and overwrite the local file execute:
# setfattr -n ofs.conflict -v=remote /path/to/conflicted/file