Google-drive-ocamlfuse: Failing to mount but returning successful

Created on 14 Mar 2014  路  11Comments  路  Source: astrada/google-drive-ocamlfuse

Hi,

I'm currently writing a script to automatically mount Google drive, sync relevant files, and then dismount Google drive (or leaving it mounted if it was already). I do not like leaving Google drive mounted because it causes the parent folder to load very slowly (and any process which access information of the mounted file system, such as the system monitor), but that could be a separate issue.

The issue here is that I'd like to ensure that google-drive-ocamlfuse has successfully mounted Google drive and to check that, I thought I'd just look at the exit code; however, it sometimes exits with 0 even if it failed to mount Google drive. In particular, I have noticed this happening if the folder being mounted to is non-empty.

In the mean time, I can parse mount -l to check that it has been mounted, but google-drive-ocamlfuse should probably not exit with 0 if it failed. This would also allow the use of && and ||.

Cheers

question

Most helpful comment

google-drive-ocamlfuse gives you a view of your Drive. It doesn't download your files locally. If you need to copy your remote files you could use rsync from the mountpoint to a local directory. Or you can switch to a sync app (e.g.: https://github.com/Grive/grive).

All 11 comments

I haven't tried google-drive-ocamlfuse, but I follow the project. Have you considered pausing the thread's process itself instead of turning it on and off (at least when you are opening the folder to peruse your documents)?

I don't understand how that would change the exit code (which is the issue at hand).

If you are actually referring to the slow down in the parent directory, no I haven't tried, though I don't see why pausing would be more advantageous then simply mounting/dismounting when required.

In theory, any exception is caught and an exit 1 is used to signal the abnormal termination. Could you please post the error message you obtain when it fails to mount?

So the error which causes google-drive-ocamlfuse to exit successfully occurs when the folder being mounted to is non empty. It then displays:

fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option

OK, I see. That error is returned by the library I'm using, so it's not easy to fix. As a workaround, could you use the -o nonempty option?

Although I can use this, I did not actually read up under which conditions it is safe to use the -o nonempty parameter and thus have avoided it. As this is a script run by cron, I do not want it to run a possibly unsafe command in circumstances which the script may not know exactly.

Instead, I have opted to check it if the mount was successful as follows:

if mount -l | grep "${HOME}/gdrive type fuse.google-drive-ocamlfuse"&>/dev/null; then
    echo "Successful mount"
else
    echo "Failed mount"
fi

If you use the -o nonempty option, FUSE will hide the files already present in that directory, so they won't be available until you unmount your filesystem. Therefore, if those are files used by the system or by some application, the system or that application won't work as expected. This is the risk associated with that option. But your script is just fine as a workaround.

@astrada but what I always want to mount it on start up like Dropbox linux client, it also will show the error I guess.

I have a google account that I mounted & that is not empty after syncing now I added google-drive-ocamlfuse ~/gdrive in my start up application but it doesn't mount & when running google-drive-ocamlfuse ~/gdrive it prints this error.

Now if I run command as you mentioned google-drive-ocamlfuse -o ~/gdrive it will hide the files already synced & again download the files I guess.

Sorry, but this is not a sync app like the Dropbox one. When you unmount your Drive, you cannot access your files anymore.

@astrada so do I have to again delete the folder then again using access token again sync all the file

Also can you explain the workflow or how it works

google-drive-ocamlfuse gives you a view of your Drive. It doesn't download your files locally. If you need to copy your remote files you could use rsync from the mountpoint to a local directory. Or you can switch to a sync app (e.g.: https://github.com/Grive/grive).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abrambailey picture abrambailey  路  7Comments

Stadtschreck picture Stadtschreck  路  3Comments

kevinjpickard picture kevinjpickard  路  3Comments

meszape picture meszape  路  6Comments

acardona picture acardona  路  3Comments