Google Drive backup on Linux Mint 19

บน OS อื่น Google มี Official App สำหรับช่วย Backup และ Sync ข้อมูลใน Google Drive ตามนี้ https://www.google.com/drive/download/backup-and-sync/ แต่ฝั่ง Linux ยังไม่มี จึงต้องอาศัยตัวช่วยอย่างไม่เป็นทางการได้แก่ rclone (https://rclone.org/) ซึ่งไม่จำกัดแค่ Google Drive เพราะคุณสมบัติของเขาคือ rsync for cloud storage  รองรับ cloud หลายยี่ห้อมาก

1.ติดตั้ง
1.1 App หลัก : apt install rclone
1.2 GUI : https://www.ubuntuupdates.org/package/webupd8/bionic/main/base/rclone-browser

2.ใช้งาน
2.1 เรียกใช้งานผ่าน Rclone Browser โดยเริ่มจากการ config ซึ่งจะเรียก CLI ขึ้นมาอีกที ดังนี้
n) New remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
n/r/c/s/q> n
name> Google Drive
Type of storage to configure.
Choose a number from below, or type in your own value
 1 / Amazon Drive
   \ "amazon cloud drive"
 2 / Amazon S3 (also Dreamhost, Ceph, Minio)
   \ "s3"
 3 / Backblaze B2
   \ "b2"
 4 / Dropbox
   \ "dropbox"
 5 / Encrypt/Decrypt a remote
   \ "crypt"
 6 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
 7 / Google Drive
   \ "drive"
 8 / Hubic
   \ "hubic"
 9 / Local Disk
   \ "local"
10 / Microsoft OneDrive
   \ "onedrive"
11 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
12 / SSH/SFTP Connection
   \ "sftp"
13 / Yandex Disk
   \ "yandex"
Storage> 7

2.2 เลือก n เพื่อสร้าง config ใหม่ แล้วเลือก 7 สำหรับ Google Drive
2.3 โปรแกรมจะให้ระบุ client_id กับ client_secret ซึ่งปล่อยว่างก็ได้ (โปรแกรมจะใช้ id ของตัวเองซึ่งมี limit อยู่ กรณีจะ backup ข้าม account ถ้าจะให้ดีก็สร้าง id ของตัวเองได้ตามนี้ https://rclone.org/drive/#making-your-own-client-id)
Google Application Client Id - leave blank normally.
client_id> 
Google Application Client Secret - leave blank normally.
client_secret> 
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine or Y didn't work
y) Yes
n) No
y/n> 
2.4 โปรแกรมจะเปิด browser ให้ authen account ที่จะใช้แล้วเอาผลลัพธ์มาบันทึกเป็น config

2.5 Double Click เข้าไปเรียกใช้งาน account ที่สร้างขึ้น ดังรูป


3.สั่งงานผ่าน CLI เพื่อทำงานแบบ remote processing ได้ เช่น
rclone sync config_name1: config_name2:
- เป็นคำสั่ง sync ข้อมูลทั้งหมดของ account ที่ 1 ไป account ที่ 2

rclone sync --drive-auth-owner-only config_name1: config_name2:
- กรณีที่เรามีข้อมูลซึ่ง share มาจากคนอื่นอีกที (อาจจะเยอะมาก ๆ ) แล้วไม่อยากจะ backup ก็เพิ่ม parameter ได้
- ถ้าจะ backup แค่บาง folder ก็ป้อนชื่อ folder หลังเครื่องหมาย : 

Comments

Popular posts from this blog

Artillery Hornet + OctoPrint + Klipper

ย้ายบ้าน

ใต้ร่มกาสาวพัตร