nuc를 통해 구글 드라이브 마운트해 나스처럼 사용했는데

#auto

구글무제한 드라이브가 종료되어 나스를 새롭게 구하게 되었습니다. ㅜ,.ㅜ

이제 시놀로지 나스 관련 글을 많이 업로드할 예정이니 많이 와주세요!

구글 API 설정

아래 글 참고하셔서 구글 API 설정을 맞춰줍니다.

Rclone 설치하기

시놀로지 나스에 SSH 접속을 합니다.

먼저 root 계정으로 권한을 변경합니다.

sudo -i

입력하고 비밀번호를 입력하면 root 계정으로 권한이 변경됩니다.

다음 명령어로 rclone 설치진행합니다.

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

설치가 완료되고 아래 명령어로를 치시면 설치된 rclone 버전을 확인하실 수가 있습니다.

rclone version

아래 이미지처럼 진행되겠죠!

#display

Rclone 설정

이제 Rclone 리모트할 드라이브를 설정할 차례입니다. 귀찮으시면 다른곳에서 사용한 설정파일을 복사 붙여넣기 하셔도 됩니다.

기존 다른 기기에서 사용하셨던 rclone.config 파일이 있으면 아무 폴더에 rclone.conf 파일 업로드 하신 후 파일 속성 에서 위치를 복사 해줍니다.

그리고 아래 명령어를 rclone 설정폴더에 복사 붙여넣기 해줍니다.

cp 위에 업로드한 설정파일 속성 위치 /root/.config/rclone/

전 다운로드 폴더에 업로드했으니 아래와 같겠죠

cp /volume1/homes/hjm79/download/rclone.conf /root/.config/rclone/

자기에 맞게 수정하고 실행시켜줍니다.

cp /volume1/homes/hjm79/download/rclone.conf /root/.config/rclone/

설정하신게 없으시면 아래 명령어로 rclone 리모트 드라이브를 생성시켜줍니다.

rclone config

이 부분도 아래 윈도우 마운트 부분에서 자세히 다뤘으니 참고바랍니다.

rclone 새로운 인증방식

기존 config 파일 없이 새롭게 진행해보려고 하니 마지막 부분 인증방식이 바뀌어서 첨부합니다.

관리자 계정으로 전환

sudo -i

비번 입력해주시고

rclone config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

Enter name for new remote.    <- 원하는 드라이브 명을 넣어줍니다.
name> gdrive

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)

-----생략-------
18 / Google Drive
   \ (drive)

Storage> 18          <--  원하는 드라이브 형식을 넣어줍니다. 전 구글드라이브 18번

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> xxxxxxxxxxxxx.apps.googleusercontent.com.        <- 구글 API 설정 했던 cliend ID 입력해줍니다.


Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>  xxxxp-_xxxxxxxx-7ycNp3-B-R5kP.          <- 구글 API 설정 했던 secret 입력해줍니다.

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> 1                       <- 풀 액세스   1번 선택

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>         <- 엔터로 스킵

Edit advanced config?
y) Yes
n) No (default)
y/n>            <- 디폴트로 그냥 엔터키

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         <- 외부접속이니 n키 입력후 엔터

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):
	rclone authorize "drive" "eyJjbGllbnRfaWQiOiIxNjgxNjg5NDE1NTAtaTV0am1nbTlzYjdjbDZoZjhka3VoZjMwb2lma3RrdnEuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJjbGllbnRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Then paste the result.
Enter a value.
config_token>                                    <-  이 부분 입력 아래 글 참고바람   

맨 아래 부분부터 문제가 생기는데요 예전에는 아래 그림처럼

인증이 가능했지만 이제 접속하는 기기에서 rclone을 설치 후 인증을 진행해야합니다.

제 홈페이지 보시면 윈도우, 맥 rclone 설치 방법 있으니 설치 후 위에 빨간색 부분을 복사해 붙여넣기 후 엔터를 누르시면 기존처럼

링크가 활성화 되면서 권한을 허용해주시면 설정이 끝납니다.

rclone authorize "drive" "eyJjbGllbnRfaWQiOiIxNjgxNjg5NDE1NTAtaTV0am1nbTlzYjdjbDZoZjhka3VoZjMwb2lma3RrdnEuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJjbGllbnRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Rclone 마운트

Rclone 1.62 버전부터 fuse3 에러가 나니 아래 명령어로 심볼릭 링크를 통해 fusermount3를 대체합니다.

ln -s /bin/fusermount /bin/fusermount3

이제 마운트할 폴더와 캐쉬폴더를 파일스테이션에서 생성해줍니다.

Rclone 명령어 수정하기

폴더를 생성했으면 아래 명령어를 자신에 설정에 맞게 수정바랍니다.

rclone mount gdrive: /volume1/homes/hjm79/gdrive --allow-other --allow-non-empty --drive-skip-gdocs --use-mmap --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 240h --vfs-read-ahead 32M --dir-cache-time=1000h --log-level INFO --log-file /volume1/homes/hjm79/cache/rclone.log --cache-dir=/volume1/homes/hjm79/cache --timeout 1h --umask 000 --no-checksum --rc --rc-no-auth --rc-addr 127.0.0.1:5573 --config /root/.config/rclone/rclone.conf

rclone mount gdrive: /volume1/homes/hjm79/gdrive –allow-other –allow-non-empty –drive-skip-gdocs –use-mmap –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 240h –vfs-read-ahead 32M –dir-cache-time=1000h –log-level INFO –log-file /volume1/homes/hjm79/cache/rclone.log –cache-dir=/volume1/homes/hjm79/cache –timeout 1h –umask 000 –no-checksum –rc –rc-no-auth –rc-addr 127.0.0.1:5573 –config /root/.config/rclone/rclone.conf

위에 빨간색 부분을 자신에 맞게 수정바랍니다.

간단하게 설명 드리면 처음 빨간색 gdrive는 rclone 설정에서 생성한 리모트 드라이브명입니다.

그리고 두번째 빨간색 부분은 리모트 드라이브를 마운트할 폴더 경로(위에 생성한 gdrive폴더) 이며

세번째 네번째 폴더는 위에 생성한 캐쉬폴더(로그파일 포함)입니다.

작업스케쥴러 등록

이제 작업스케쥴러를 실행시켜줍니다.

생성 – 트리거된 작업 – 사용자 정의 스크립트 를 선택해줍니다.

원하는 작업명을 넣어주시고 사용자는 root로 설정 이벤트는 부트업(시작시 실행) 으로 설정해주고 작업 설정으로 넘어가줍니다.

사용자 정의 스크립트 부분에 수정한 rclone 명령어를 복사 붙여 넣기 해줍니다.

그리고 나스를 재시작하거나 작업을 실행하시면 마운트 되신게 확인 가능합니다.

마운트 하고 보면 요렇게 파일크기가 계산이 안될정도로 큰 구글 드라이브가 마운트된게 확인이 됩니다.