|
It is possible to mount your rsync.net filesystem as a local filesystem on your FreeBSD
6.x (or newer) system using sshfs (part of the Filesystem in Userspace, or FUSE package).
FUSE and sshfs are not available on FreeBSD 4.x or 5.x - only FreeBSD 6.x or later can
use this functionality. Further, out of the box, FreeBSD 6.0-RELEASE does not contain
the /usr/ports/sysutils/fusefs-sshfs port. You will need to cvsup this yourself.
This document will describe in detail the process of obtaining the fusefs-sshfs port,
installing it, and using it to mount your rsync.net filesystem locally.
Step 1: Obtain the fusefs-sshfs port with cvsup
If you already have cvsup installed on your system, simply run these commands:
cvsup -g -L 2 /usr/share/examples/cvsup/ports-supfile -h cvsup2.freebsd.org -i ports/sysutils/fusefs-sshfs
cvsup -g -L 2 /usr/share/examples/cvsup/ports-supfile -h cvsup2.freebsd.org -i ports/sysutils/fusefs-libs
cvsup -g -L 2 /usr/share/examples/cvsup/ports-supfile -h cvsup2.freebsd.org -i ports/sysutils/fusefs-kmod
If you do not already have cvsup installed, you will need to:
# cd /usr/ports/net/cvsup-without-gui
# make install
Step 2: Port cleanup
Unfortunately, the fusefs-libs port, which is installed by fusefs-sshfs, has an error in the Makefile. This
error has been confirmed in both the standard ports of 6.0-RELEASE and 6.1-RELEASE.
First, edit the file /usr/ports/sysutils/fusefs-libs/Makefile, and replace all occurances of ${REINPLACE_CMD} with
the word sed
So, this block of Makefile:
post-patch:
${REINPLACE_CMD} -e 's,-lpthread,${PTHREAD_LIBS},' \
-e 's,-D_FILE_OFFSET_BITS=64,-D_FILE_OFFSET_BITS=64 ${PTHREAD_CFLAGS},' \
${WRKSRC}/fuse.pc.in
${REINPLACE_CMD} -e 's,-lpthread,${PTHREAD_LIBS},' \
${WRKSRC}/lib/Makefile.in \
${WRKSRC}/example/Makefile.in
Should look like:
post-patch:
sed -e 's,-lpthread,${PTHREAD_LIBS},' \
-e 's,-D_FILE_OFFSET_BITS=64,-D_FILE_OFFSET_BITS=64 ${PTHREAD_CFLAGS},' \
${WRKSRC}/fuse.pc.in
sed -e 's,-lpthread,${PTHREAD_LIBS},' \
${WRKSRC}/lib/Makefile.in \
${WRKSRC}/example/Makefile.in
Second, be prepared for your first attempt at `make install` in /usr/ports/sysutils/fusefs-sshfs to
bomb out at the very end complaining of package registration failure for fusefs-libs.
Third, be prepared for your second attempt at `make install` to bomb out for the same reason, this
time for registration failure for fusefs-kmod.
Step 3: Install
# cd /usr/ports/sysutils/fusefs-sshfs
# make install
(will possibly bomb out on package registration failure for fusefs-libs, if so, simply
run `make install` again)
You will be asked, via an option checkbox, whether to use AUTOSETUP - check that box by pressing
the space bar, then tab down to OK, and hit enter.
(will possibly bomb out again on package registration failure for fusefs-kmod, if so, simply
run `make install` again)
Step 4: Check for loaded kernel module
The installation of the port will load the fuse.ko kernel module. You can verify this by issuing
the command:
# kldstat
and seeing:
3 1 0xc3865000 b000 fuse.ko
in the output. In the future, you can load or unload the kernel module with these commands:
# kldload fuse.ko
# kldunload fuse.ko
Step 5: Mount your rsync.net filesystem locally
First, create a mount point:
# mkdir /mnt/rsync.net
Then issue the sshfs command:
# sshfs -o idmap=user 1004@usw-s017.rsync.net: /mnt/rsync.net
NOTE: the sshfs command _must be_ run as root. Not as any other user, not through sudo. sshfs calls
the mount system call, which must be run by root. Once your sshfs filesystem is mounted, however, it
can be accessed by any user.
You will then be asked for your rsync.net password. After entering your password, the command
will complete with no messages or indication of success, however, issuing the mount command with
no arguments:
# mount
Will show you that your filesystem is indeed mounted:
/dev/fuse0 on /mnt/rsync.net (fusefs, local, synchronous)
Later, you can unmount the filesystem with:
# umount /dev/fuse0
Step 6: Alternate usage
Another way you can mount your rsync.net filesystem with sshfs is to run:
# mount_fusefs auto /mnt/rsync.net sshfs -o idmap=user 1004@usw-s017.rsync.net:
|