- Notifications
You must be signed in to change notification settings - Fork1
LGUG2Z/sbmt
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Plexdrive, Rclone and UnionFS mount management made easier.
The Seedbox Mount Tool (sbmt) is a single binary intended to help ensure the integrityof Plexdrive, Rclone and UnionFS mounts on a seedbox and synchronise data between localand cloud storage.
This project takes heavy inspiration from work already done byMads Lundt,Jamie and all the contributors over athoarding.me and the variousscripts and tips I found posted on thePlexACD subreddit.
Withsbmt
I am trying to hit the sweet spot between the approach of Dockerising everythingand maintaining an array of bash scripts to enable the smooth running of a seedbox runningPlex and the seamless synchronisation of local and remotely stored media.An additional consideration that has had a big influence on the direction ofsbmt
isthe desire to easily be able to switch from one seedbox to another and get up and runningagain as quickly as possible.
With a single binary managing mounting and ensuring mount integrity, dealing with synchronisingof local and remote data as well as ensuring any required cleanups of local and remote data,cron jobs can be copied easily from one seedbox to another, either maintaining an old folderstructure or implementing a new folder structure just by changing the flags passed to differentcommands.
The latest version of bfm can be installed usinggo get
.
go get -u github.com/LGUG2Z/sbmt
Make sure$GOPATH
is set correctly that and that$GOPATH/bin
is in your$PATH
.
Thesbmt
executable will be installed under the$GOPATH/bin
directory.
Before schedulingsbmt
commands to be run on a seedbox, there are some pieces of priorsetup required:
- Create anunencrypted remote for Google Drive using Rclone.Files uploaded to this remote will be stored unencrypted.
- Create anencrypted remote for Google Drive using Rclone.Files uploaded to this remote will be stored encrypted.
- ConfigurePlexdrive to be able to access your Google Drive account.Encrypted files viewed on this mount remain encrypted.
- Create a remote todecrypt the encrypted files mounted by Plexdrive.Encrypted files viewed on this mount will be shown in their unencrypted form.
The three commands ofsbmt
aremount
,upload
andcleanup
.
The encrypted remote files on Google Drive are mounted by Plexdrive in the folderspecified using the--plexdrive
flag. A local Rclone mount then reads theencrypted files in the plexdrive folder and shows their unencrypted representationin the folder specified using the--decrypt
flag. A UnionFS mount is thencreated at the location specified by the--union
flag, which shows a unifiedrepresentation of all of the files stored in Google Drive (in their unencryptedform, in the--decrypt
location), and files that have been downloaded tothe local machine, in a folder specified using the--local
flag.
The flow of data is as follows:
GDrive (enc) -> Plexdrive (enc) -> Rclone (dec) -> UnionFS (dec).
In order to show an unencrypted representation of the data mounted by Plexdrive,a separate Rclone remote will have to be created, in which the remote locationis set to the local folder where Plexdrive will be mounted. The encryption typeand the encryption passwords should be the same as those set for the encryptedGoogle Drive remote. The name of this remote must be passed to the mount commandusing the--decrypt-remote
flag.
If the mount command is run and all mounts are intact, no further action will betaken. Conversely, if any single mount is broken, every mount will be unmountedand remounted to re-establish mount integrity.
Example:
sbmt mount \ --plexdrive /plexdrive \ --decrypt-remote plexdrive-decryptor: \ --decrypt /decrypt \ --local /local \ --union /union
Files deleted from read-only section of a UnionFS mount are not actually deleted butrather hidden from view. A record of these hidden files is kept in a hidden subfolder ofthe unionfs mount location (.unionfs). The cleanup command will iterate through all thefiles of this hidden subfolder, find the corresponding files in the location identifiedusing the--decrypt
flag and remove them from Google Drive.
Example:
sbmt cleanup --decrypt /decrypt --union /union
Files created in the read-write section of a UnionFS mount will be iterated over,encrypted, and uploaded to the Rclone remote specified using the--encrypt-remote
flag.
The upload command uses the rclonemoveto
command, which ensures that the fileto be uploaded will automatically be removed from the local read-write folder assoon as the upload is confirmed as having been successful.
Example:
sbmt upload --local /local --encrypt-remote encrypted-remote:
The mounts are unmounted in the following order to ensure that there are no problemswith busy resources that prevent a successful unmounting operation:
UnionFS -> Rclone -> Plexdrive
Example:
sbmt unmount --union /union --decrypt /decrypt --plexdrive /plexdrive