Monday, October 17, 2011

boxfs: 50G from the cli

Box.net has 50G's worth of free space!

Here's how you can get the most of it from via FUSE. Totally awesome!

This was all executed on DISTRIB_DESCRIPTION="Ubuntu 11.04"

http://code.google.com/p/boxfs/wiki/Compiling

First fetch the code:
jcuff@shuttle:~/box$ svn checkout http://boxfs.googlecode.com/svn/trunk/ boxfs-read-only
A    boxfs-read-only/boxopts.c
A    boxfs-read-only/boxfs.c
A    boxfs-read-only/mkrel.sh
A    boxfs-read-only/boxapi.c
A    boxfs-read-only/boxopts.h
A    boxfs-read-only/boxpath.c
A    boxfs-read-only/COPYING
A    boxfs-read-only/boxapi.h
A    boxfs-read-only/boxhttp.c
A    boxfs-read-only/boxpath.h
A    boxfs-read-only/README
A    boxfs-read-only/Makefile
A    boxfs-read-only/boxhttp.h
U   boxfs-read-only
Checked out revision 84.

First off some simple prereqs:
jcuff@shuttle:~/$ sudo apt-get install libxml2-dev libfuse-dev libcurl4-gnutls-dev libzip-dev

and libapp:

jcuff@shuttle:~/$ git clone http://github.com/drotiro/libapp.git
jcuff@shuttle:~/$ sudo make install

Then simply add this to your Makefile:
FLAGS = -D_FILE_OFFSET_BITS=64

Remember to run ldconfig or you will get:
jcuff@shuttle:~/$ boxfs --help
boxfs: error while loading shared libraries: libapp.so: cannot open shared object file: No such file or directory

Then make a config file:
jcuff@shuttle:~/$ cat config
username = you@youremail.org
mountpoint = /home/jcuff/boxed
verbose = yes
secure = yes
password = secritpasscodez
largefiles = yes

Then you are pretty much all set to fire it up:
jcuff@shuttle:~/$ boxfs -f ./config

Tada!
jcuff@shuttle:~/$ ls -ltra ~/boxed
total 4
drwxr-xr-x  3 root  root  21390149 1969-12-31 19:00 .
-r--r--r--  1 root  root  19023676 2011-10-17 12:41 Box App Overview.mp4
-r--r--r--  1 root  root    439630 2011-10-17 12:41 Box Overview.pdf
-r--r--r--  1 root  root   1563857 2011-10-17 12:41 Box for iPhone.pdf
drwxr-xr-x  2 root  root    362986 2011-10-17 12:46 Private

jcuff@shuttle:~/$ df -H ~/boxed
Filesystem             Size   Used  Avail Use% Mounted on
boxfs                  2.2G    22M   2.2G   1% /home/jcuff/boxed

The system uses delayed writes, but works nicely!
jcuff@shuttle:~/$ time dd if=/dev/zero of=~/boxed/test.dat bs=1024k count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.178957 s, 58.6 MB/s

jcuff@shuttle:~/$ ls -ltra ~/boxed/test.dat 
-r--r--r-- 1 root root 10485760 2011-10-17 13:12 /home/jcuff/boxed/test.dat

And as they say "wooph, there it is!"

update! remember box.net is a webdav provider!

jcuff@shuttle:~$ sudo apt-get install davfs2

jcuff@shuttle:~$ sudo mount -t davfs https://www.box.net/dav ./tt
Please enter the username to authenticate with server
https://www.box.net/dav or hit enter for none.
  Username: you@youremail.com
Please enter the password to authenticate user you@youremail.com with server
https://www.box.net/dav or hit enter for none.
  Password:  

jcuff@shuttle:~$ df -H /home/jcuff/tt
Filesystem             Size   Used  Avail Use% Mounted on
https://www.box.net/dav
                        28G    14G    14G  50% /home/jcuff/tt

It is even easier on OSX, or windows!

Top menu - > "Go" -> "Connect to Server":

https://www.box.net/dav



[any opinions here are all mine, and have absolutely nothing to do with my employer]
(c) 2011 James Cuff