여러분이 사용하고 계신 브라우저는 HTML5를 지원하지 않기 때문에 몇몇 요소가 제대로 보이도록 JScript를 사용하고 있습니다. 하지만 여러분의 브라우저 설정에서 스크립트 기능이 꺼져있으므로, 현재 페이지를 제대로 확인하시려면 스크립트 기능을 켜주셔야 합니다. rclone 1.61.1 - Synology에 rclone vfs로 Google Drive 연결
rclone 1.61.1 – Synology에 rclone vfs로 Google Drive 연결
1년전 작성
1년전 수정

다른 버전에 대해 알아보고 싶으면 rclone 1.57.0 버전은 이 링크 클릭 하고 rclone 1.58.1 버전은 이 링크 클릭 하자.

rclone 1.61.1 설치

1. SSH 접속
– 나는 Windows를 사용하므로 Putty 프로그램을 이용하여 SSH에 접속 한다.

login as: [사용자 이름 입력]
test@192.168.0.3’s password: [암호 입력]
Synology strongly advises you not to run commands as the root user, who has the highest privileges on the system. Doing so may cause major damages to the system. Please note that if you choose to proceed, all consequences are at your own risk.
test@synology:~$

 

2. 관리자 권한 얻기

sudo -i
test@synology:~$ sudo -i
Password: [암호 입력]
root@synology:~#

 

3. /(root)로 이동

cd /
root@synology:~# cd /
Password: [암호 입력]
root@synology:/#

 

4. tmp 폴더로 이동

cd tmp
root@synology:/# cd tmp
root@synology:/tmp#

 

5. https://downloads.rclone.org/ 접속 후 최신 버전의 rclone 다운로드 URL 확인

https://downloads.rclone.org/rclone-current-linux-amd64.zip

 

6. ssh에서 명령어 입력, rclone 다운로드 URL 복사 붙여넣기 후 다운로드 받기

wget https://downloads.rclone.org/rclone-current-linux-amd64.zip
root@synology:/tmp# wget https://downloads.rclone.org/rclone-current-linux-amd64.zip
Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at ‘/root/.wget-hsts’. HSTS will be disabled.
–2023-02-02 23:19:32– https://downloads.rclone.org/rclone-current-linux-amd64.zip
Resolving downloads.rclone.org… 95.217.6.16, 2a01:4f9:c012:7154::1
Connecting to downloads.rclone.org|95.217.6.16|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 17468564 (17M) [application/zip]
Saving to: ‘rclone-current-linux-amd64.zip’
 
rclone-current-linu 100%[===================>] 16.66M 1.05MB/s in 20s
 
2023-02-02 23:19:53 (860 KB/s) – ‘rclone-current-linux-amd64.zip’ saved [17468564/17468564]
root@synology:/tmp#

 

7. 압축 해제

7z x rclone-current-linux-amd64.zip
root@synology:/tmp# 7z x rclone-current-linux-amd64.zip
 
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,4 CPUs x64)
 
Scanning the drive for archives:
1 file, 17468564 bytes (17 MiB)
 
Extracting archive: rclone-current-linux-amd64.zip
Path = rclone-current-linux-amd64.zip
Type = zip
Physical Size = 17468564
 
Everything is Ok
 
Folders: 1
Files: 5
Size: 55021274
Compressed: 17468564
 
root@synology:/tmp#

 

8. 압축 해제된 폴더로 이동

cd rclone-v1.61.1-linux-amd64
root@synology:/tmp# cd rclone-v1.61.1-linux-amd64
root@synology:/tmp/rclone-v1.61.1-linux-amd64#

 

9. rclone을 실행 폴더인 /usr/bin으로 이동

mv rclone /usr/bin
root@synology:/tmp/rclone-v1.61.1-linux-amd64# mv rclone /usr/bin
root@synology:/tmp/rclone-v1.61.1-linux-amd64#

 

10. 폴더 권한 변경

chmod +x /usr/bin/rclone
root@synology:/tmp/rclone-v1.61.1-linux-amd64# chmod +x /usr/bin/rclone
root@synology:/tmp/rclone-v1.61.1-linux-amd64#

클라이언트 ID 정보 확인

1. https://console.cloud.google.com/ 접속

 

2. API 및 서비스 » 사용자 인증 정보 » + 사용자 인증 정보 만들기 » OAuth 클라이언트 ID

 

3. 생성 완료되면 클라이언트 ID와 클라이언트 보안 암호 기억하기

 

⭐ 자세한 사항은 rclone – Google Drive API 설정 참고하자.

rclone 설정

1. SSH 접속
– 나는 Windows를 사용하므로 Putty 프로그램을 이용하여 SSH에 접속 한다.

login as: [사용자 이름 입력]
test@192.168.0.3’s password: [암호 입력]
Synology strongly advises you not to run commands as the root user, who has the highest privileges on the system. Doing so may cause major damages to the system. Please note that if you choose to proceed, all consequences are at your own risk.
test@synology:~$

 

2. 관리자 권한 얻기

sudo -i
test@synology:~$ sudo -i
Password: [암호 입력]
root@synology:~#

 

3. /usr/bin 으로 이동

cd /usr/bin
root@synology:~# cd /usr/bin
root@synology:/usr/bin#

 

4. rclone config 입력 » Enter

rclone config
root@synology:~# rclone config

 

5. rclone 설정 생성을 위해 ‘n’ 입력 » Enter

2023/02/02 23:31:45 NOTICE: Config file “/root/.config/rclone/rclone.conf” not found – using defaults
No remotes found, make a new one?
n) New remote : 새로운 리모트 만들기
s) Set configuration password
q) Quit config
n/s/q> n

 

3. 드라이브 이름 입력. 예 : ‘gdrive’ » Enter

Enter name for new remote.
name> gdrive

 

4. Google Drive를 찾는다 : 18번으로 확인 » ’18’ 입력 » Enter

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
1 / 1Fichier
\ (fichier)
2 / Akamai NetStorage
\ (netstorage)
3 / Alias for an existing remote
\ (alias)
4 / Amazon Drive
\ (amazon cloud drive)
5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Liara, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
\ (s3)
6 / Backblaze B2
\ (b2)
7 / Better checksums for other remotes
\ (hasher)
8 / Box
\ (box)
9 / Cache a remote
\ (cache)
10 / Citrix Sharefile
\ (sharefile)
11 / Combine several remotes into one
\ (combine)
12 / Compress a remote
\ (compress)
13 / Dropbox
\ (dropbox)
14 / Encrypt/Decrypt a remote
\ (crypt)
15 / Enterprise File Fabric
\ (filefabric)
16 / FTP
\ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
18 / Google Drive : 구글 드라이브
\ (drive)
19 / Google Photos
\ (google photos)
20 / HTTP
\ (http)
21 / Hadoop distributed file system
\ (hdfs)
22 / HiDrive
\ (hidrive)
23 / In memory object storage system.
\ (memory)
24 / Internet Archive
\ (internetarchive)
25 / Jottacloud
\ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
27 / Local Disk
\ (local)
28 / Mail.ru Cloud
\ (mailru)
29 / Mega
\ (mega)
30 / Microsoft Azure Blob Storage
\ (azureblob)
31 / Microsoft OneDrive
\ (onedrive)
32 / OpenDrive
\ (opendrive)
33 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ (swift)
34 / Oracle Cloud Infrastructure Object Storage
\ (oracleobjectstorage)
35 / Pcloud
\ (pcloud)
36 / Put.io
\ (putio)
37 / QingCloud Object Storage
\ (qingstor)
38 / SMB / CIFS
\ (smb)
39 / SSH/SFTP
\ (sftp)
40 / Sia Decentralized Cloud
\ (sia)
41 / Storj Decentralized Cloud Storage
\ (storj)
42 / Sugarsync
\ (sugarsync)
43 / Transparently chunk/split large files
\ (chunker)
44 / Union merges the contents of several upstream fs
\ (union)
45 / Uptobox
\ (uptobox)
46 / WebDAV
\ (webdav)
47 / Yandex Disk
\ (yandex)
48 / Zoho
\ (zoho)
49 / premiumize.me
\ (premiumizeme)
50 / seafile
\ (seafile)
Storage> 18

 

5. 클라이언트 ID 입력 » Enter

Option client_id.
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a value. Press Enter to leave empty.
client_id> [클라이언트 ID 입력]

 

6. 클라이언트 보안 암호 입력 » Enter

Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> [클라이언트 보안 암호 입력]

 

7. ‘1’ 입력 » Enter

Option scope.
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Full access all files, excluding Application Data Folder. : 모든 파일에 액세스 할 수 있음
\ (drive)
2 / Read-only access to file metadata and file contents.
\ (drive.readonly)
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ (drive.file)
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ (drive.appfolder)
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ (drive.metadata.readonly)
scope>

 

8. 아무것도 입력하지 않기 » Enter

Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file>

 

9. ‘n’ 입력 » Enter

Edit advanced config?
y) Yes
n) No (default) : 고급 설정 하지 않음
y/n> n

 

10. ‘n’ 입력 » Enter

Use web browser to automatically authenticate rclone with remote?
* Say Y if the machine running rclone has a web browser you can use
* Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
 
y) Yes (default)
n) No : 자동 설정 하지 않음
y/n> n

 

11. config_token 얻기위한 명령어 복사해놓기.

Option config_token.
For this to work, you will need rclone available on a machine that has a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone version recommended):
복사할 범위
Then paste the result.

Windows에서 컴퓨터에서 rclone 설치

1. https://rclone.org/downloads/ 접속 후 Windows용 rclone 최신 버전 설치

 

2. 압축 파일을 d:에 저장 해놓고 압축 풀기

 

3. 압축 푼 폴더의 이름을 rclone으로 변경

Windows에서 rclone 인증

1. 명령 프롬프트 관리자 권한으로 실행

 

2. 드라이브 이동을 ‘d:’ 입력

d:
Microsoft Windows [Version 10.0.22621.1105]
(c) Microsoft Corporation. All rights reserved.
 
C:\Windows\System32> d:
D:\>

 

3. rclone 폴더로 진입

cd rclone
D:\> cd rclone
D:\rclone>

 

4. rclone 인증을 위해 config_token 얻기위한 명령어 붙여넣기 » Enter

구글에서 로그인하라고 나온다.

로그인하면 success 창이 나오는데 다시 명령 프롬프트 창으로 가자.

D:\rclone> [복사한 명령어 붙여넣기]
2023/02/03 00:06:58 NOTICE: Config file “C:\\Users\\mingg\\AppData\\Roaming\\rclone\\rclone.conf” not found – using defaults
2023/02/03 00:06:58 NOTICE: Make sure your Redirect URL is set to “http://127.0.0.1:53682/” in your custom config.
2023/02/03 00:06:58 NOTICE: If your browser doesn’t open automatically go to the following link: http://127.0.0.1:53682/auth?state=IRrcn1JkNGirtnAGRafPnA
2023/02/03 00:06:58 NOTICE: Log in and authorize rclone for access
2023/02/03 00:06:58 NOTICE: Waiting for code…
2023/02/03 00:07:20 NOTICE: Got code
Paste the following into your remote machine —>
복사할 범위
<—End paste
 
D:\rclone>

rclone 설정 완료

1. config_token 붙여넣기 » Enter

Enter a value.
config_token> [복사한 config_token]

 

2. ‘n’ 입력 » Enter

Configure this as a Shared Drive (Team Drive)?
 
y) Yes
n) No (default) : 팀 드라이브(공유 드라이브)는 사용하지 않음
y/n> n

 

3. 설정 완료를 위해 ‘y’ 입력 » Enter

Configuration complete.
Options:
– type: drive
– client_id: [클라이언트 ID]
– client_secret: [클라이언트 보안 암호]
– scope: drive
– token: {“access_token”:”액세스 토큰”,”token_type”:”Bearer”,”refresh_token”:”리프레시 토큰”,”expiry”:”2023-02-03T01:07:19.3293803+09:00″}
– team_drive:
Keep this “gdrive” remote?
y) Yes this is OK (default) : 설정 완료
e) Edit this remote
d) Delete this remote
y/e/d> y

 

3. ‘q’ 입력 » Enter

Current remotes:
 
Name Type
==== ====
gdrive drive
 
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config : 설정 종료
e/n/d/r/c/s/q> q
root@synology:/usr/bin#

원격지 생성

rclone_vfs.sh 파일 만들기

텍스트 편집기 이용하여 아래 코드 입력하여 파일을 만든다.

#!/bin/bash

sleep 30

sudo mount --make-shared /volume1

#mount GD
sudo rclone mount gdrive: [구글 드라이브의 원격지 경로] \
--config /root/.config/rclone/rclone.conf \
--allow-other \
--allow-non-empty \
--fast-list \
--drive-skip-gdocs \
--poll-interval=15s \
--vfs-cache-mode full \
--vfs-write-back 5s \
--bwlimit-file 16M \
--buffer-size=16M \
--vfs-read-chunk-size=32M \
--vfs-read-chunk-size-limit 2048M \
--vfs-cache-max-size 100G \
--vfs-cache-max-age 336h \
--vfs-read-ahead 32M \
--dir-cache-time=1000h \
--log-level INFO \
--log-file [rclone 로그 파일 저장될 경로]/rclone_vfs.log \
--cache-dir=[rclone cache가 저장될 경로] \
--timeout 1h \
--umask 000 &

인코딩 : UTF-8

기본 예시
#!/bin/bash

sleep 30

sudo mount –make-shared /volume1

#mount GD
sudo rclone mount gdrive: /volume1/rclone/gdrive \
–config /root/.config/rclone/rclone.conf \
–allow-other \
–allow-non-empty \
–fast-list \
–drive-skip-gdocs \
–poll-interval=15s \
–vfs-cache-mode full \
–vfs-write-back 5s \
–bwlimit-file 16M \
–buffer-size=16M \
–vfs-read-chunk-size=32M \
–vfs-read-chunk-size-limit 2048M \
–vfs-cache-max-size 100G \
–vfs-cache-max-age 336h \
–vfs-read-ahead 32M \
–dir-cache-time=1000h \
–log-level INFO \
–log-file /volume1/rclone/rclone_vfs.log \
–cache-dir=/volume1/rclone/gcache \
–timeout 1h \
–umask 000 &

자동으로 마운트 하게끔 스케줄링하기

제어판 » 작업 스케줄러 » 생성 » 트리거된 작업 » 작업 이름: 원하는대로 설정, 사용자: root, 이벤트: 부트업 » 작업 설정 » 사용자 정의 스크립트: /volume1/rclone/rclone_vfs.sh

rclone 설정 잘 된지 확인

1. SSH 접속
– 나는 Windows를 사용하므로 Putty 프로그램을 이용하여 SSH에 접속 한다.

login as: [사용자 이름 입력]
test@192.168.0.3’s password: [암호 입력]
Synology strongly advises you not to run commands as the root user, who has the highest privileges on the system. Doing so may cause major damages to the system. Please note that if you choose to proceed, all consequences are at your own risk.
test@synology:~$

 

2. 관리자 권한 얻기

sudo -i
test@synology:~$ sudo -i
Password: [암호 입력]
root@synology:~#

 

3. /usr/bin 으로 이동

cd /usr/bin
root@synology:~# cd /usr/bin
root@synology:/usr/bin#

 

4. rclone lsd 명령어로 확인

구글 드라이브에 만들어놓은 폴더들이 잘 보이면 활성화가 잘 된거다.

rclone lsd gdrive:
root@synology:/usr/bin# rclone lsd gdrive:
-1 2022-07-27 21:50:43 -1 Synology
-1 2022-12-20 11:54:44 -1 etc
관련 포스트
rclone 1.61.1 - Synology에 rclone vfs로 Google Drive 연결 - 현재글

Mingg`s Diary
밍구
공부 목적 블로그