Ir al contenido principal

Use rclone to mount cloud storage

I realized that the fat clients that allows you to sync your contents are not only wasting CPU cycles but also lots of disk space. Yes, that enables you to have the file opened almost instantly, no matter its size, but for me that use case is almost never needed, I use the cloud storage to save stuff that is in the range of a few MiB.

Here is where rclone comes into play, it allows you to mount your storage as if it were a regular disk, and it handles the communication with the cloud servers on the go.

As there are many different combinations I'll cover only two

Linux w/ Dropbox

curl https://rclone.org/install.sh | bash

# Use rclone config to add a new remote called db for dropbox

MAIN_USER=$SUDO_USER
MAIN_USER_HOME=$(grep ^$SUDO_USER: /etc/passwd | head -1 | cut -d: -f6)

mkdir /media/db

chown $MAIN_USER:$MAIN_USER /media/db

cat <<EOF > /lib/systemd/system/rclone-db.service
[Unit]
Description=Dropbox rclone mount
After=multi-user.targetrclone

[Service]
Type=simple
User=$
MAIN_USER
ExecStart=rclone mount db:/ /media/db --config $MAIN_USER_HOME/.config/rclone/rclone.conf --max-read-ahead 200M --dir-cache-time 5m --acd-templink-threshold 0 --bwlimit 0 --checkers 32 --low-level-retries 1 --quiet --stats 0 --timeout 30s
ExecStop=fusermount -u /media/db
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

EOF

systemctl daemon-reload
systemctl enable rclone-db
systemctl start rclone-db

Windows w/ Drive

:: Download rclone for windows and unzip into %USERPROFILE%\bin\rclone

:: Download WinFSP (https://winfsp.dev) and install it, it is needed for the mounting

:: Use rclone config to add a new remote called gdrive for Google Drive

:: Download SilentCMD (https://github.com/stbrenner/SilentCMD) and unzip into %USERPROFILE%\bin\silentcmd

:: Windows+R then "shell:startup"

:: Create a new file rclone-gdrive.cmd, and add

start %USERPROFILE%\bin\silentcmd\SilentCMD.exe %USERPROFILE%\bin\rclone\rclone mount gdrive:// Z: >> "%TMP%\rclone-gdrive.txt" 2>&1 /LOG+:%TMP%\rclone-gdrive.txt

 

Have fun!

Comentarios

Entradas populares de este blog

Tasker: Profiles with priorities

Hi! If you read Tasker docs, you may find that with Tasker its not possible to establish actions based on profile priorities if you have two of them activated at the same time; in the other hand Setting Profiles is a unmantained old app that can do this, but have no scripting capabilities like Tasker. Here is the solution using Tasker powerful environment. The main idea is to do this: Profiles/Init (44) A1: If [ %Profiles_pactivelast Is Set & %Profiles_pactivelast !~ %PACTIVE ] A2: Perform Task [ Name:Profiles/Profile/Default Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]  A3: Variable Set [ Name:%profile_priority To:Work,Class,Study,Sleep,Low battery, Charging weak,Charging strong Do Maths:Off Append:Off ]  A4: Variable Split [ Name:%profile_priority Splitter:, Delete Base:Off ]  A5: For [ Variable:%profile Items:%profile_priority() ]  A6: [X] Flash [ Text:%profile Long:Off ]  A7: [X] Wait [ MS:0 ...