elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: Raspberry Pi -> Google Drive

Mon Oct 06, 2014 12:44 pm

Speed tests at 15GB (50% of free space used).

mounting is fast

Code: Select all

time  google-drive-ocamlfuse /media/google

real    0m0.868s
user    0m0.060s
sys     0m0.050s
ls is a bit slow on first use

Code: Select all

time ls -1 /media/google/test/ >/dev/null #7 folders

real    0m7.565s
user    0m0.000s
sys     0m0.010s
but then it's cached

Code: Select all

raspbnas> time ls -1 /media/google/test/ >/dev/null

real    0m0.058s
user    0m0.010s
sys     0m0.010s
rsync is nice and fast

Code: Select all

time nice rsync -ruv --stats --progress --inplace --size-only --exclude '*recordings*' /media/21TB_encripted/test /media/google/
sending incremental file list

Number of files: 2178
Number of files transferred: 0
Total file size: 7886873751 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 44912
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 45169
Total bytes received: 256

sent 45169 bytes  received 256 bytes  1593.86 bytes/sec
total size is 7886873751  speedup is 173624.08

real    0m28.318s
user    0m0.350s
sys     0m0.560s
It looks like acknowledgement of file upload takes a while:

Code: Select all

time echo "test" > /media/google/test/test.txt

real    0m11.674s
user    0m0.000s
sys     0m0.000s
uploading larger (25MB) files is also slower than it should be:

Code: Select all

time rsync -ruv --stats --progress --inplace --size-only /media/test/test.flac /media/google/
sending incremental file list
created directory /media/google
test.flac
    25829813 100%  649.71kB/s    0:00:38 (xfer#1, to-check=0/1)


Number of files: 1
Number of files transferred: 1
Total file size: 25829813 bytes
Total transferred file size: 25829813 bytes
Literal data: 25829813 bytes
Matched data: 0 bytes
File list size: 35
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 25833052
Total bytes received: 31

sent 25833052 bytes  received 31 bytes  146363.08 bytes/sec
total size is 25829813  speedup is 1.00

real    2m56.147s
user    0m1.500s
sys     0m1.350s
my connection speed is 25/3mbps (or 3125/375KB/s) and file upload is more like 37% of that.


Downloading a tiny file is really slow:

Code: Select all

fusermount -u /media/google
sync
echo 3 > /proc/sys/vm/drop_caches
sleep 1
google-drive-ocamlfuse /media/google
time cp /media/google/test/test.txt ~/

real    0m21.486s
user    0m0.000s
sys     0m0.010s
Larger files (26MB) are also slow (27% of connection speed)

Code: Select all

time cp /media/google/test.flac ~/

real    0m30.205s
user    0m0.000s
sys     0m0.850s
So overall I would say it's useable for backup (especially if that unlimited space for education thing ever happens) but not as a working directory.
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

RudyNutbeij
Posts: 3
Joined: Fri Jul 18, 2014 10:43 pm

Re: Raspberry Pi -> Google Drive

Sun Oct 26, 2014 7:40 pm

Thanks for your extensive report.
Once I've got some extra time I'll re-image one of my raspberries and will perform similar tests for reference material.

The first time I got it working I mounted the full 100gb drive (which happens to be around 99% filled). It contained a _lot_ files of small size. It didn't seem to handle that quite well obviously :lol:

But so far, 'tweaking' it with drive shares on a 2nd account is the only way I've found yet to gain some control on performance.

Perhaps caching on an usb stick or something would be an option?

Or booting from usb, and cache on SD. Whichever is faster..

Keep it up

HKwhyIP
Posts: 7
Joined: Wed Oct 26, 2011 4:04 am

Re: Raspberry Pi -> Google Drive

Tue Mar 03, 2015 4:01 pm

Hi,

I have RPi 2 and using the most update Raspbian. Here is what I tried:

Code: Select all

echo "deb http://www.cl.cam.ac.uk/~lpw25/ocaml-rpi/ wheezy main
deb-src http://www.cl.cam.ac.uk/~lpw25/ocaml-rpi/ wheezy main" >> /etc/apt/sources.list
apt-get update
apt-get install -y ocaml ocaml-native-compilers m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev
cd /opt
git clone https://github.com/OCamlPro/opam.git
cd opam
git checkout 1.1.1
sudo ./configure
But then I got this error message:
configure: error: You must install the Camlp4 pre-processor. On some operating systems, these are separate packages from the main OCaml compiler, such as camlp4-extra on Debian.
Then I tried: sudo apt-get install camlp4-extra. But got
camlp4-extra is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded
.

Now, I am stuck and do not know what to do. Any help is appreciated.

Thanks

Kenneth

HKwhyIP
Posts: 7
Joined: Wed Oct 26, 2011 4:04 am

Re: Raspberry Pi -> Google Drive

Thu Mar 05, 2015 6:43 am

Hi All,

After a full day of labour, I have found the solution to install google-drive-ocamlfuse for RPi 2 under Raspbian. The steps are based on rodhull's, then updated by RudyNutbeij. But for unknown reasons, the code at git for opam (https://github.com/OCamlPro/opam) generates lots of problem for me. Then I discovered http://opam.ocaml.org/doc/Install.html. I used their Binary Installer method, which is to download and excute their opam_installer.sh. This is the only change I made to rodhull's and RudyNutbeij's contributions (commented out 3 lines and added 2 lines).

Below is how I installed google-drive-ocamlfuse:

Code: Select all

#!/bin/bash
OPAMDIR=${HOME}/opam
DRIVEDIR=/mnt/drive
DRIVECFG=~/.gdfuse/default/config
echo -e "enter your client id:"
read CID
echo -e "\n \n enter your client secret:"
read CECRET

sudo apt-get -y --force-yes install ocaml ocaml-findlib sqlite3 camlidl m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev camlp4-extra fuse build-essential ssh make git
cd $HOME
#git clone https://github.com/OCamlPro/opam  
#cd $OPAMDIR
#./configure && make && sudo make install
wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh
sh opam_installer.sh /usr/local/bin 
cd $HOME
opam init --yes && opam --switch=4.01.0dev+trunk --yes
echo "eval \`opam config env\`" >> ~/.bashrc
opam install google-drive-ocamlfuse --yes
sudo usermod -a -G fuse $USER
newgrp fuse
sudo chmod a+rw /dev/fuse
sudo mkdir -p /mnt/drive
sudo chown $USER.fuse /mnt/drive
sudo sed -i 's/\#user_allow/user_allow/g' /etc/fuse.conf #allows other users to allow_other users
google-drive-ocamlfuse -headless -id ${CID} -secret ${CECRET} ${DRIVEDIR} -o allow_other #allows other users as well
Now, I am able to using the 1TB paid storage from Google Drive with my new RPi 2.

Norin
Posts: 1
Joined: Thu Jan 14, 2016 3:17 am

Re: Raspberry Pi -> Google Drive

Thu Jan 14, 2016 3:55 am

Hi HKwhyIP

Your code works great... but after reboot i no longer have the google drive mounted... i have had help to implement it.

What code do i have to write or command to make it permanent on pi... i know i have to write it on a file... but don´t know how.

glo
Posts: 1
Joined: Thu Feb 25, 2016 8:05 pm

Re: Raspberry Pi -> Google Drive

Thu Feb 25, 2016 10:00 pm

I gave up on getting Drive to work (https://github.com/odeke-em/drive) mostly because of the, for me, extremely poor instructions available - then came across this post (about https://github.com/astrada/google-drive-ocamlfuse).
It actually ended out working for me, with some adjustments:

Code: Select all

export OPAMDIR=~/opam
export DRIVEDIR=/mnt/drive
export DRIVECFG=~/.gdfuse/default/config
sudo apt-get -y --force-yes install ocaml ocaml-findlib sqlite3 camlidl m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev camlp4-extra fuse build-essential ssh make git
cd $HOME
git clone https://github.com/OCamlPro/opam 
cd $OPAMDIR
./configure && make && sudo make install
wget https://github.com/ocaml/opam/archive/1.2.2.tar.gz
tar zxf 1.2.2.tar.gz
cd opam-1.2.2
./configure
make lib-ext
sudo make install
opam init
opam install extlib re cmdliner ocamlgraph cudf dose jsonm
sudo apt-get install aspcud
sudo apt-get install etckeeper
echo "eval \`opam config env\`" >> ~/.bashrc
opam install google-drive-ocamlfuse --yes
sudo shutdown --reboot
sudo chmod a+rw /dev/fuse
sudo mkdir -p /mnt/drive
sudo chown $USER /mnt/drive
sudo sed -i 's/\#user_allow/user_allow/g' /etc/fuse.conf
google-drive-ocamlfuse -headless -id 63cutcutcutom -secret Uhcutcutcut1m $DRIVEDIR -o allow_other

Return to “Networking and servers”