# synchronized to google drive ###### tags: `NTUToolmenLab` ## put data to local ### nfs `sudo mount -t nfs 192.182.1.1:/volume1/Flower` ### rsync `rsync sync -zavh -e 'ssh -p 10000' linnil1@192.168.1.1:/volume1/Flower --exclude-from ~/exclude.txt .` if the remote cpu is not stronge enough, do not add `-z` in options ## rclone https://rclone.org/ `docker run -it --rm --name backup_rclone -v $PWD:/app debian:9` ``` apt update apt install -y curl zip sudo curl https://rclone.org/install.sh | sudo bash cd /app ``` and if you have config file `cp rclone.conf ~/.config/rclone/` check your directionary `rclone lsd gdrive:/Flower --max-depth=1` and sync `rclone sync Flower/ gdrive:/Flower --exclude-from exclude.txt -P --transfers 16` where `exclude.txt` ``` Thumbs.db @eaDir/** ``` for google drive, you neet to de duplicated after sync. ``` rclone dedupe gdrive:/Flower ``` ### rcolne with google drive goto https://console.developers.google.com/apis/dashboard to create a api client and secret key for google drive then follow this guide https://rclone.org/drive/ ## Auto rsync ``` sh arr=( Personal/linnil1 ) for i in "${arr[@]}" do j=$(dirname $i) if [ "$j" = "." ]; then j="" fi echo $i, $j sshpass -f /tmp/pass rsync -avh -e 'ssh -p 22' "user@192.168.1.1:/volume1/304nas/$i" "/backup/$j" --exclude-from=/home/server/exclude.txt --delete ``` rclone `~/upload.sh` ``` sh arr=( Personal/linnil1 ) for i in "${arr[@]}" do rclone sync "/home/$i" "gdrive:/$i" --exclude-from /app/exclude.txt -P --transfers 16 done ``` Docker ``` dockerfile FROM debian:9 RUN apt update && \ apt install -y curl zip sudo && \ curl https://rclone.org/install.sh | sudo bash && \ mkdir -p /root/.config/rclone && \ mkdir -p /app COPY rclone.conf /root/.config/rclone/rclone.conf WORKDIR /app ``` `sudo docker run -it --rm -v /home/nas:/nas -v $HOME:/app linnil1/rclone` `bash ~/upload.sh`