Using Amazon Cloud Drive with Plex Media Server on Ubuntu… And Encrypting It!

UPDATED – 26 January, 2017

This guide previously made use of acd_cli for mounting Amazon Cloud Drive. It’s been updated to use rClone for both mounting and uploading, as this is not only more efficient, but also much more robust. Using rClone for mounting eliminates the need to sync/remount your ACD mount.

If you’ve already used this guide, you can simply head over to the automatic mounting script guide, update your script with the changes in the guide, and execute it, you should be good to go!

The idea of an “unlimited” Plex server is an exciting one, but there are some bases you’ll want to cover before dumping all your media into the cloud. The biggest issue with keeping your media hosted in the cloud is encryption; you don’t want any storage providers snooping around your files, regardless of their source or content. This guide will get you going, with a focus on security.

Also, with the announcement of Plex’s new “Plex Cloud” offering, I’ve seen quite a few people posting on Reddit’s Plex subreddit for help with using Amazon Cloud Drive (ACD) as a storage provider for their Plex media on their standalone Plex server. There have been some guides floating around the Internet, but some of these guides use a confusing approach (in my opinion) to accomplish a task that’s already a bit confusing for some. I’ve been using the setup detailed in this guide for a few years now, even with multiple servers utilizing the same ACD mount, and I’ve had very few issues. I’ve automated this setup with tools like CouchPotato, Sonarr, and custom scripts in conjunction with Plex Requests to the point where I rarely have to do any maintenance on my Plex servers, and anybody can request media and have it available in minutes without any kind of interaction from me.

If you haven’t set up Plex yet, or you’ve got a fresh installation of Ubuntu, you can use my other guide, Getting Started with Plex to get the prerequisite setup finished first.

In this guide, we’ll be making use of several different projects to get this setup working smoothly, so while a guide can help you get set up, troubleshooting any problems can be difficult and a guide won’t always be helpful. However, if everything is set up in a logical way to begin with, the pain of troubleshooting can eased. Let’s get started on that now!

What you’ll need:

  • Amazon Cloud Drive account (obviously)
  • User account running these tools and Plex (preferably named “Plex”)
  • unzip
  • Python 3 (installed by default on Ubuntu 14.04+)

What we’ll be installing:

How it Will Work:

Basically, we will be using rClone both to read our Amazon Cloud Drive and to write to back ACD, and EncFS to encrypt it all. The real magic happens with UnionFS, as it will merge our read and write directories into one, so we can essentially forget about those other directories and focus on a single path for all our needs, including other tools like CouchPotato and Sonarr.

I’m going to assume your user account running Plex is not root, and is called “Plex” for the sake of convenience. Substitute usernames as necessary here, and stay logged in as this user throughout the guide. We’ll use “sudo” for anything requiring elevated privileges.

Anytime “~” is specified in a directory, it is assumed to be equal to ‘/home/plex’

Step 1 – Creating Necessary Directories

Let’s create the directories we’ll be using to make all this work. For ease of use, I like to put these directories right inside my Plex user’s home directory. So let’s make sure we’re at the right place (again, you should be logged in as your Plex user, not root):

cd ~

Now that we’re in the home directory, let’s create the five directories we’ll be using:

mkdir .acd
mkdir acd
mkdir .local
mkdir local
mkdir media

These directories will be used as follows:

~/.acd – ACD mount containing encrypted media
~/acd – ACD mount decrypted with EncFS
~/.local – local media after being encrypted by EncFS
~/local – where your local/downlaoded media will be copied to
~/media – the UnionFS mount point which will merge ‘~/acd’ and ‘~/local’ directories

Step 2 – Setting up rClone

Install rclone

Start off by making sure you’re in your Downloads directory, then grabbing the rclone package:

cd ~/Downloads
wget http://downloads.rclone.org/rclone-current-linux-amd64.zip

Now, unzip the archive and change directories to it:

unzip rclone-current-linux-amd64.zip
cd rclone-*-linux-amd64

Copy the binary and give root ownership:

sudo cp rclone /usr/sbin/
sudo chown root:root /usr/sbin/rclone
sudo chmod 755 /usr/sbin/rclone

Then install the manpage so you can read all about rclone:

sudo mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb

Set Up rclone

Now we’re ready to configure rclone. Once again, this process is different depending on whether you’re using a desktop session or a headless SSH session. If you’re using a terminal in a desktop session (GUI), then simply enter the commands below, otherwise scroll down a tad further to “Using SSH or a headless server”

Using a desktop interface/GUI

In your terminal, simply type the following command to enter the rclone configuration process:

rclone config

This will guide you through a fairly easy process. Let’s go through the steps together:

  • Press “n” to add a new remote connection, then “enter” to proceed
  • You’ll want to name your instance something simple, like “acd” to make it easier to upload files
  • Press “1” for ACD, then “enter” to proceed
  • Press “enter” for the next two fields to use defaults
  • Press “y” to use the “automatic” mode, which will open a browser window. Enter your ACD credentials, and log in. The config process should continue automatically.
  • Press “y” if you can see your token text on the screen
  • Press “q” to exit the config process, we’re done for now

Using SSH or a headless server

If you’re managing a headless Plex server, or you don’t have a desktop environment installed, authenticating rClone gets a bit trickier. I’ve found success using the w3m browser. So lets install that:

sudo apt-get install -y w3m

This will install a text-only terminal-based browser. It should do fine for this purpose, but don’t plan on surfing the web with it.

Now we’ll install a utility called Screen (this is included in later versions of Ubuntu). Screen allows you to have multiple terminal sessions open without worrying about them expiring or closing out. This is useful if you need to access your server remotely with Putty or something similar to execute a script or other process, but can’t have the SSH session open until that script/process is complete. Ending your SSH session also ends whatever script/process you were running. Screen is a great way to prevent that from happening, and lets you reconnect to existing sessions from any other SSH session. So let’s install Screen:

sudo apt-get install -y screen

Sometimes Screen is already installed, but either way it should be now for sure. To open a new terminal session with Screen, just type:

screen

Press “enter” to dismiss the message, and now you’re in a second terminal session. You can exit a Screen session while leaving it active at anytime by pressing “CTRL+A” then “D” to disconnect. Now that we have a second session running, let’s start the rclone config process:

rclone config

Move past these steps the same as the GUI users would have, up to the “use auto-config” step:

  • Press “n” to add a new remote connection, then “enter” to proceed
  • You’ll want to name your instance something simple, like “acd” to make it easier to upload files
  • Press “1” for ACD, then “enter” to proceed
  • Press “enter” for the next two fields to use defaults
  • PAUSE at the auto-config step. Pressing “y” to use the “automatic” mode will attempt to open a browser window. This won’t work, however it will show you a URL to use. Copy this URL, then disconnect this Screen session by pressing “CTRL+A” then “D” which will keep that session active in the background
  • Open the w3m browser to the rclone URL by entering:
w3m http://127.0.0.1:53682/auth
  • Enter your ACD credentials by moving your cursor to the required fields, pressing “enter” and typing your username/password, then pressing “enter” again
  • Place your cursor on “Sign in using our secure server” and press “enter” to sign in. You should see a “success” message
  • Press “q” to exit the w3m browser
  • Type the following command to reconnect to your previous Screen session:
screen -r
  • Press “y” if you can see your token text on the screen
  • Press “q” to exit the config process, we’re done for now
  • Press “CTRL+A” then “K” to permanently kill this Screen session

Just to make sure everything worked correctly, we can run the following command to list the remote accounts configured with rClone, and it should list “acd” under the “Name” heading and “amazon cloud drive” under the “Type” heading:

rclone listremotes

Mounting ACD with rClone

Now we’re ready to mount our Amazon Cloud Drive instance to make it accessible to the server. This is accomplished with one simple command, however you can automate this process (and the rest of this guide) using the scripts over at our other guide here! The command to mount ACD is as follows (don’t forget the ampersand at the end!):

rclone mount acd:Plex /home/plex/.acd &

This will mount your ACD instance in the ‘.acd’ directory in the plex user’s home directory. The ampersand executes the command in the background so we can continue using our terminal. Now we can move on to the encryption phase!

Step 3 – Setting up EncFS

Install EncFS

Now that we have our ACD instance mounted using rClone, let’s make sure it’s encrypted:

sudo apt-get install -y encfs

Set Up and Test Encryption

Then we’ll go ahead and get our directories encrypted. Using EncFS, the first directory in the command is the one you’ll want encrypted, and the second directory is the one you want decrypted. The nice thing about EncFS is you don’t really have to specify the action, if the first directory already contains encrypted files, the second directory will automatically decrypt them. So let’s encrypt our local media directories:

encfs /home/plex/.local /home/plex/local

You should see a prompt from EncFS regarding encryption settings. Use the default and just press “enter” to move on to password creation. Make sure you remember this password! Type it a second time, and your local directories are now encrypted. You can test this by creating the directories Plex will use in the ‘/home/plex/local’ directory. In this guide, we’ll only worry about movies and TV shows, so let’s create a directory for each:

cd ~/local
mkdir Movies
mkdir "TV Shows"

Now let’s list the ‘local’ directory to make sure they’re created:

ls ~/local

And you should see the “movie” and “tv” directories listed. Now, let’s list the encrypted directory:

ls ~/.local

You should see two directories with a bunch of random characters. This confirms our files are being encrypted.

Move Settings File

Now let’s move our EncFS settings file to a more convenient location. First we need to unmount our local media directories. This command is also used to unmount other EncFS directories in the future, though you shouldn’t need to use it very often:

fusermount -u /home/plex/local

Next, we’ll move the “encfs6.xml” file and rename it to something simpler:

mv /home/plex/.local/.encfs6.xml  /home/plex/encfs.xml

Encrypting Directories Using EncFS Configuration Files

This “encfs.xml” file is your encryption “key,” not to be confused with the password. These work in tandem to keep your files secure, so you’ll want to make sure you keep a copy of this file backed up somewhere safe. Now, when mounting an EncFS directory, you’ll need to specify the location of the config file. Anytime you mount an encrypted directory, the command will always start the same, only the directories will change as needed. Let’s go ahead and mount our local media directory again using the config file:

ENCFS6_CONFIG='/home/plex/encfs.xml' encfs /home/plex/.local /home/plex/local

Okay, now let’s do the same for our ACD directories. Enter the following into your terminal:

ENCFS6_CONFIG='/home/plex/encfs.xml' encfs /home/plex/.acd /home/plex/acd

And that’s it for encryption! It seems like a lot, but underneath it all, everything is pretty simple. Four directories, two of which are encrypted mirrors of the others, and a fifth to merge the two decrypted directories together. Let’s move on to merging those directories with UnionFS!

Step 4 – Merging directories using UnionFS-Fuse

Install UnionFS-Fuse

Once again, let’s get UnionFS-Fuse installed;

sudo apt-get install -y unionfs-fuse

Merge Directories Using UnionFS

There’s no other setup required for this part, we just need to specify which directories we want to merge. Those will be the decrypted directories, local and ACD, so Plex can be refreshed to grab new movies/episodes when they’re downloaded without waiting for them to be uploaded, and so other tools like CouchPotato and Sonarr can move files into this directory and they’ll appear to be in the same location as all the ACD media.

unionfs-fuse -o cow /home/plex/local=RW:/home/plex/acd=RO /home/plex/media/

The “RW” and “RO” arguments in that command specify which directory is writable (local directory) and which is read-only (ACD directory). So now anything you copy/move to ‘/home/plex/media’ will actually be in ‘/home/plex/local’ and thus encrypted in ‘/home/plex/.local’, and anything in your ‘/home/plex/acd’ directory will also show up in the ‘/home/plex/media’ directory. We only need to worry about one directory to point Plex libraries at, or to have CouchPotato/Sonarr monitor. This makes life much, much easier! Now, we’re ready to move on to the final phase of this guide; uploading your downloaded media to ACD.

Step 5 – Adding ACD Directories to Plex

Let’s make sure Plex can see the ACD directories now! Hop over to your Plex web portal, and add a new library (or edit an existing one). When choosing your directory, browse to ‘/home/plex/media’ and you should see the “movie” and “tv” directories we created. Choose the respective directory for your library, and that’s it! Anything you upload to ACD will show up in that directory.

If you don’t see the ‘media’ directory when trying to add it through Plex, it could be a permissions issue. One thing you can try is browsing to the ‘/home/plex/acd’ directory from Plex web and seeing if those directories show up. If they do, this is a permissions issue with the UnionFS mount. Unmount it by typing:

fusermount -u /home/plex/media

And then edit  the fuse configuration file:

sudo nano /etc/fuse.conf

Find the line “#user_allow_other” and remove the “#” by pressing the delete key in front of that line. Save the file by pressing “CTRL+X” and “Y” to overwrite. Then, mount the merged UnionFS-Fuse directory by adding the “allow_other” option to the mount command:

unionfs-fuse -o cow,allow_other /home/plex/local=RW:/home/plex/acd=RO /home/plex/media/

Now, you should be able to see the “movie” and “tv” folders inside ‘/home/plex/media’ directory when adding a library in Plex web.

Step 6 – Uploading to ACD with rclone

Now that our directories are set up and encrypted and we have them added to our Plex server, it’s time to start adding media to them.

Upload Local Files/Directories to ACD Using rclone

The syntax for copying files with rclone is “rclone copy sourcedir remote:destinationdir”. In this context, “sourcedir” is your local encrypted directory, “remote” is what you named your ACD instance when setting up rclone (I suggested acd), and “destinationdir” is the directory in your ACD you want to move those files to, which in our case would be inside the “Plex” folder you created in the ACD web portal.

Anyways, on to the meat and potatoes! To upload your local files over to your ACD mount, we’ll be uploading your encrypted local directory to the encrypted ACD mount with the following command:

rclone copy /home/plex/.local acd:Plex

This should copy the files from your local encrypted directory to your encrypted ACD directory, and then you can manually delete them from ‘home/plex/local’ if the copy was successful.

One thing I like to do is upload my movie and TV directories separately by appending those directory names to the ends of the source and destination directories in the rclone move command. You can just list your ‘/home/plex/.local’ directory to get the names of the directories, and you can figure out which is which by using the “touch” command to place a test file in either directory, then listing the encrypted directories to see which has a file in it. Keep note of those directory names then for future reference, and then you can add them into your “rclone move” command rather than using the “rclone copy” command to have these sub-directories automatically deleted after a successful copy. Here’s what my commands look like to upload with rclone (using my encrypted directory names):

rclone copy /home/plex/.local/BZxQ7QeNh8jos9pEzcKXk5vy/ acd:Plex/BZxQ7QeNh8jos9pEzcKXk5vy
rclone copy /home/plex/.local/L,ULJSSLPjETMTzk5OhzCioC/ acd:Plex/L,ULJSSLPjETMTzk5OhzCioC

And then to empty out my local storage while maintaining those parent directories:

rm -Rf "/home/plex/local/Movies/"*
rm -Rf "/home/plex/local/TV Shows/"*

This will maintain a “Movies” and “TV Shows” directory inside the ‘/home/plex/local’ directory for you.

Step 7 – Use Crontab to Mount rClone, EncFS, and UnionFS Automatically (UPDATE)

I’ve added a new post for handling all your mounts automatically! Check out Automatically Mounting acd_cli, EncFS, and UnionFS Mounts at Boot

Wrap-Up

Well, you made it this far, so hopefully everything is working for you and you’re starting to take advantage of that “unlimited” storage! If this guide garners a decent amount of interest, I’ll write another guide on automating the downloading, renaming, moving, and uploading of all your media using scripts with CouchPotato and Sonarr. You can also fully automate the conversion of your media if you just hate transcoding and want all your media in a universal MP4 format. Leave a comment below if you’d find that useful!

Also, if you’re having any issues, you can either leave a comment below or hit me up on Reddit.

If these guides have been helpful and you’d like to help out with funding my blog, you can make a donation here. It’s greatly appreciated!

Advertisements

203 thoughts on “Using Amazon Cloud Drive with Plex Media Server on Ubuntu… And Encrypting It!

  1. Pingback: Getting Started with Plex | Site Title

  2. Pingback: Setting up CouchPotato and Sonarr with Plex Media Server | enzTV

  3. Pingback: The (Almost) Complete Guide to Creating the Ultimate Plex Server | enzTV

  4. If I’m copying the individual movie/tv folders with rclone, do I need to put this after the acd:Plex part too?

    rclone move /home/plex/.local/[…]/ acd:Plex/[…]

    Like

    • You don’t have to, using this command will copy any directories/files inside ‘/home/plex/.local’ and put them in your ACD under the “Plex” folder, retaining directory structure.

      Also, I’d suggest using the “copy” command rather than the “move” command, then deleting the files in ‘/home/plex/local’ manually when you confirm they’re synced by checking ‘/home/plex/acd’ after running “acdcli sync” to update the nodes.

      Like

    • It sounds like you’re doing the processes backwards. You want to run the rclone config command in the screen session, and then open the address w3m in the original terminal session after you press “CTRL+A,D”

      Like

      • That’s exactly what I’m doing though. Is there another way to do this step? I notice when you run rclone config it gives an option for setting up on a headless server instead of opening up the browser. Have you tried this at all?

        Like

      • The option built in for a headless server just forces you to install rclone on another computer. Try these steps in this exact order:

        -Quit rclone config (CTRL+C)
        -Exit screen session if using one (CTRL+A,K)
        -Start screen (screen)
        -Run rclone (rclone config)
        -Get to the option to open a browser where the URL is displayed
        -Disconnect screen (CTRL+A,D)
        -Open w3m to URL provided (it might have a different URL than what the guide has, so make sure to write it down or copy it)
        -Continue guide

        Those are the exact steps in the exact order

        Like

      • Okay that worked. For some reason I thought the guide said to ctrl+C in the screen session before you ctrl+a, d. Your guide is correct though, I just read it wrong.

        Like

  5. Pingback: Automatically Mounting acd_cli, EncFS, and UnionFS Mounts at Boot | enzTV

  6. Pingback: Deep Dive: Making Sonarr Work So You Don’t Have To! | enzTV

  7. Hello,

    Great guide and I am trying to figure out how to use it for my needs. Right now I have a ton of media locally using snapraid and mhddfs. My directories that I want uploaded to ACD are /storage/media/Film and /storage/media/Television.

    I am confused on how to “fuse” your guide with my existing data to make sure I upload everything and then be able to serve that content from ACD as separate libraries in Plex. I certainly can’t have doubles of everything locally. That would be quite a bit of space I don’t have. 🙂

    Can you clarify this for me? Thanks for developing these guides!!

    Like

  8. So have some questions:

    1) Is this guide meant to use a VPS?
    2) Does the downloading using Sonarr and Couch Potato happen on the same server that is hosting plex or is the VPS hosting plex only do plex and then you do the downloading and uploading to ACD on a separate machine?
    3) If I have all my media on a current server and want to upload to the cloud as a one time thing how would you recommend doing that initial upload?

    Like

    • Sorry for the delay:

      Using this guide (as of today since it was updated), you can have Plex installed on another machine by itself using the same ACD storage mounted with rClone. Your downloads can happen on another machine. Just simply follow the setup/mounting procedures for rClone and encFS/Union-FS on the Plex server and that should be it.

      Like

  9. Hello! Thanks for the guide!

    I’ve run into a snag that I’m hoping you can help me with (I’m a Linux noob — lots to learn, but am enjoying the journey!)

    When I run the command:
    acdcli mount -ro /home/plex/.acd

    I get this message:
    [CRITICAL] [acdcli.acd_fuse] – Mountpoint does not exist or already used.

    Is it a permissions issue? I’m almost certain I have the directories you laid out correctly set in home/plex. I’m issuing the commands as my plex username (not root).

    Thanks in advance!

    Like

      • Hi! Thanks for the reply!

        ls -l~ results in myusername:myusername (not root)

        This is also the user I set my plex setup to run as. I followed a HTPCGuides tutorial and was having permission issues there. Setting Plex to run as that resolved those permission issues. This is also the user I was issuing the acdcli mount -ro /home/plex/.acd command from, too.

        It would not surprise me in the slightest if I screwed something up along the way as far as permissions go! I’ve started over and over and over on my server. Again, learning as I go and enjoying the experience along the way.

        Like

  10. Just for clarification, since we are creating a local encrypted directory as well as a local media directory, does this mean that we are essentially doubling the local disk space needed? I have over 10TB of media, so am now going to need 20Tb of local storage?

    Thanks!

    Like

  11. Hey,

    I am on step 2 and getting an error. it looks like the acdcli sync worked properly because I didn’t get any errors as seen below. But when I try to move onto the second part of the step acdcli mount -ro /home/plex/.acd; I get an error user has no write access to mountpoint /home/plex/.acd

    Any help would be appreciated

    plex@ubuntu-2gb-sfo2-01:~$ acdcli sync
    Getting changes……………………………………………………….. …………………………………………………………………….. …………………………………………………………………….. …………………………………………………………………….
    Inserting nodes……………………………………………………….. …………………………………………………………………….. …………………………………………………………………….. ……………………………………………………………………
    plex@ubuntu-2gb-sfo2-01:~$ acdcli mount -ro /home/plex/.acd
    fusermount: user has no write access to mountpoint /home/plex/.acd
    Traceback (most recent call last):
    File “/usr/local/bin/acdcli”, line 9, in
    load_entry_point(‘acdcli==0.3.2’, ‘console_scripts’, ‘acdcli’)()
    File “/usr/local/bin/acd_cli.py”, line 1611, in main
    ret = args.func(args)
    File “/usr/local/bin/acd_cli.py”, line 1097, in mount_action
    allow_root=args.allow_root, allow_other=args.allow_other)
    File “/usr/local/lib/python3.5/dist-packages/acdcli/acd_fuse.py”, line 716, in mount
    FUSE(ACDFuse(**args), path, subtype=ACDFuse.__name__, **kwargs)
    File “/usr/local/lib/python3.5/dist-packages/fuse.py”, line 480, in __init__
    raise RuntimeError(err)
    RuntimeError: 1

    Like

    • Sorry for the delay:

      If you run ls -l in /home/plex what do you see for the .acd directory? If it says root:root, then you need to run “chown -R plex:plex .acd”

      Like

  12. regarding the (/home/plex/local) vs (/home/plex/media)
    I see that PMS should be pointed to (/home/plex/media), but just wanted to verify that Sonarr & CP should move downloaded content to (home/plex/local) and not to (/home/plex/media).

    Because it seems that (/home/plex/local) will not always have the content as it gets move to ACD, and because of this Sonarr, for example, will see the media as missing after it is moved to ACD.

    Liked by 1 person

  13. Out of curiousity, has anyone actually got this to work using this guide? I am not questioning the author – they did a fantastic job of explaining the little details, but I’ve gone through this guide at least 20 or more times and still do not have a working setup.

    I am able to transfer files encrypted to acd, I can see them using the cloud drive interface (they are indeed encrypted), but my plex server shows that i have nothing. It’s pointing at the media folder, which per the guide is broken out into 2 sub directories (Movies and TV Shows).

    From my understanding, one should upload or put unencrypted files into the /media path. The media path will then clone it to local/.local/etc. I inititaed an rclone copy – it successfully transferred. I followed it up by an “acdcli sync” and then removed the contents of the local directory since (to my knowledge) it transferred to the cloud.

    Maybe I am missing something… it’s very possible. After removing the contents in /local, it also removed from my /media. I don’t understand how plex can see the contents of acd while its pointing to /media? I mean, I get that its all being cloned / encrypted, but i must be doing something wrong because the only time I can ever have plex list anything is when there is a physical copy of a file in “/home/plex/media/movies/whatever.mkv”. If anyone happens to read this and notices where I am failing at this, please feel free to respond.

    I feel its so close to working – just cant figure out this last puzzle.

    Like

    • I also noticed files removed from media after I removed them from local. Ran scrip to remount everything and data will show back up in media. Hope that helps.

      Like

  14. First, I would like to thank the author for writing up all the guides here. Has anyone checked what the upload speeds to Amazon Cloud are? Also, what so the playback performance like with the media being stored on Amazon Cloud?

    Like

    • I’m running it on a dedicated server based off the authors idea. My rclone speeds reach about 35mbytes/s upload and 25mbytes/s down. It has a bit of buffer at the beginning when loading in plex.

      Like

    • I run a method similar to the author’s on a dedicated server with 1Gbps internet. I get around 35Mbytes/s down and 25Mbytes/s up. There’s a bit of buffer at the beginning when loading through plex.

      Like

  15. Has anyone looked into using rclone mount, as opposed to acd_cli? It would cut down on installed programs, I tend to get better speeds with rclone than with acd_cli and acd_cli seems to drop out sometimes. Just wondering if anyone has tried with rclone only.

    Liked by 1 person

  16. hi,

    Thank you for all the effort to write these guides which are some of the few that actually work.

    I would like to ask you how do you manage deletions on acd (lets say that you want to delete some files from acd because you don’t want them anymore)?

    Like

  17. Any idea why acdcli wont mount my directory? Suddenly stopped working…

    plex@Test]:(1.0kb)~$ acdcli mount -ro /home/plex/test
    fuse: unknown option `volname=None’
    Traceback (most recent call last):
    File “/usr/local/bin/acdcli”, line 9, in
    load_entry_point(‘acdcli==0.3.2’, ‘console_scripts’, ‘acdcli’)()
    File “/usr/local/bin/acd_cli.py”, line 1679, in main
    ret = args.func(args)
    File “/usr/local/bin/acd_cli.py”, line 1154, in mount_action
    volname=args.volname)
    File “/home/plex/.local/lib/python3.5/site-packages/acdcli/acd_fuse.py”, line 716, in mount
    FUSE(ACDFuse(**args), path, subtype=ACDFuse.__name__, **kwargs)
    File “/home/plex/.local/lib/python3.5/site-packages/fuse.py”, line 480, in __init__
    raise RuntimeError(err)
    RuntimeError: 1

    Like

  18. HI,

    I reach the end of the topic but I encountered a problem : My acd and .acd directory seems to be encrypted :

    d????????? ? ? ? ? ? acd
    d????????? ? ? ? ? ? .acd

    Any idea ?

    Thanks.

    Like

  19. I have made through the topic as well. However all the folders I created except .local are now owned by root for some reason. I am unable to see them in sonarr, plex, or couch potato. I am also unable to write to them. I tried to take ownership but nothing changes. I tried the following command and variations:

    sudo chown -R username:group /home/owner/plex/

    Any help would be greatly appreciated. Why would these folders change after i created them under my account?

    Like

  20. Awesome guide! Couple questions:

    1) Why use rclone to upload to ACD when you could just use the acd_cli upload command?

    2) How are you automating uploads to ACD/auto deleting from local disk space/acd syncs? Care to share your scripts?

    Like

  21. Dude this is awesome! I followed so many different guides just to find this one just now with everything together. Thanks so much!

    Quick question – since you’re logging in with user ‘plex’, is it okay to change the default password?

    Like

    • FYI, I attempted to use this guide, but found it is actually much easier to just use Rclone for everything. You can do the encryption and decrpytion with their newest version.

      Like

  22. Ok so after a couple of tries I’ve got this working. It works suprisingly fast btw, hopefully it can enough simultanious streams, but so far I’m impressed.

    What I’d like to see as far as automated scripting is all the different cron jobs you applied. Also – I noticed a disconnect of my mount. Remounting using mount.sh works like a charm, but if somehow it would be possible to monitor this and remount automatically.. that would be awesome. You also mentioned making a cron job to keep acd_cli up to date. I really want to know how you did this and when you are running this, as not to disconnect the mount during playback…

    Also, in my case, I like to keep local storage at a minimum, so I’m thinking of rclone’ing after a sabnzbdplus transfer, followed by an acdcdi sync. Is this wise, or is it better to run a cronjob every hour or so?

    Like

  23. Strange to see those different results. Before the movie starts playing, I need to buffer at least 60 seconds. Afterwards, it stops playing after 10 seconds again. Looks like the transferspeed is too slow from AWS to VPS to home.

    Like

    • Well, I’m still uploading my entire Library to my ACD. Finetuning all my scripts now. I was testing this weekend. I noticed that starting any movie after the system has been idle takes about 10 seconds. This was streaming to a Samsung 2016 tv btw.

      When opening another stream at the same time on my Android phone it started almost instantly. I guess it really depends on what VPS you’re running as well. Real test will be when I transfer my users over to the VPS. No idea how much streams it can handle. Got a 4 vCPU Leaseweb VPS running in Europe.

      Like

  24. Great tutorial. Worked like a charm. Also the syncing in Plex worked. But somehow when i try to access files via Plex or after sometime without any action – not sure yet – the mounted folder disapperes when i look it up in WINSCP and i cannot acces the folder anymore. After umount and the remount the folder everything is back to normal. Any ideas what is goint on?

    Like

  25. Yeah so I’m using rclone mount now, works perfectly.
    I’ve got a decent amount of storage on my dedicated server (1.5TB) so I’m looking for a script that automatically uploads stuff after an x-amount of time. Say a couple of weeks. Anyone has something like this? Or if done manually, at least a script that checks if all uploads went well before actually deleting local content…

    Like

  26. Have you thought about having a docker-compose file to spin up the different services in containers (Plex, CouchPotato, Sonarr) to have it ready in a few minutes, just by providing the different elements that are needed when starting the containers ? That would be awesome! If you have a github repository for the code let me know.

    Liked by 1 person

  27. Thanks for taking the time to put this guide together.

    Everything worked with the one test file I uploaded but now I’m trying to upload another file via rclone and I get the following error: Failed to copy: failed to make directory: HTTP code 409 etc.. but one part that stands out is “Node with the name plex already esists under parentID.

    I used the following command rclone copy /home/plex/.local acd:Plex

    What am I doing wrong?

    Thanks

    Like

    • I rebuilt my system and paid closer attention to the encrypted names, which I believe was my issue before.

      Now for my new question: Is it possible to move the .acd, acd, .local, local and media folders to another drive that has more space? Would it be as simple as an unmount, move folders adjust scripts and I’m good to go?

      Thanks

      Like

      • Sure. You’d only have to move the folder which actually have the data, so in your case that would only be .local if I’m not mistaken. Just make sure you correct your mount/remount scripts after the move.

        Like

  28. I seem to be running into an issue. I previously have a lot of my data setup using acd_cli upload to move all the data instead of rclone. I wanted to convert to using rclone and followed this guide to a T except i used my encfs.xml file that i had already generated to get what i currently have in acd. I can see my encrypted ACD inside the .acd folder and the decrypted stuff inside of the acd folder. But when i did the thing with the media drive that is supposed to fuse these directories should it not all appear in local where i should be able to already upload to my movies folder and TV folder? i feel like i’m missing a step that is very important to get these drives to mirror.

    Like

  29. Hi!

    Thank for the tutorial.

    How do you manage the deletions? I mean… after uploading your files to the cloud and removing them locally, how do you manage the maintenance of your library if you need or want to delete something in the cloud? This would be trivial if the files are no encrypted, but with the encryption this task seems somewhat impossible to me.

    Do you ever considered this question and (hopefully) solved it?

    Thanks.
    Regards.

    Like

      • Hi!

        Thanks for reply.

        Yes, but, as long as I understood, the .acd is mounted readonly. And rclone syncs just in one direction: from local to remote.

        So we have 2 problems:
        1) deleting files locally will not reflect the deletion remotely
        2) there is no easy way to know the relationship between the encrypted and unencrypted files/folders…

        Like

      • Of course I meant the acd folder (which is unencrypted) instead of the .acd folder (which is encrypted). Only the media folder is based on a read-only version of the acd folder.

        1) Manually deleting movies from the acd folder works out perfectly (just tested it)
        2) However, I do have an issue when sickrage/couchpotato see a better version and download that one, because they look into the media folder, they see the read-only version of acd folder and cannot delete the lesser quality version (as in normally does). It remains to have multiple version of the movie/episode. Not a big issue of course, but if someone does have a solution…

        Like

    • Using the updated guide here (and the next guide for automating the mount process via script) you can simply browse to the file in the ~/media directory and delete it from there. Those files should then be in the trash if you check the Amazon Cloud Drive web UI. Though it’s possible rClone doesn’t make use of the trash function.

      Liked by 1 person

  30. so close and yet so far…. i can never get the point where the files are decrypted from amazon : (

    i get this error every time i try this… losing mind.. been at this for a week using 3 or 4 different sets of instructions… still no luck : ) : ( what am i doing wrong : (
    ———————————
    ENCFS6_CONFIG=’/home/xxxxx/plex/encfs.xml’ encfs /home/xxxxx/plex/.local /home/jaquestati/plex/local
    EncFS Password:

    fuse: mountpoint is not empty
    fuse: if you are sure this is safe, use the ‘nonempty’ mount option
    fuse failed. Common problems:
    – fuse kernel module not installed (modprobe fuse)
    – invalid options — see usage message

    Like

      • hahaha.. yes…
        if i try and do it sudo i get this error
        ——
        The directory “/home/jaquestati/plex/local” does not exist. Should it be created? (y,n) y
        Unable to create directory: : File exists
        21:41:24 (main.cpp:466) Unable to locate mount point, aborting.
        Build: encfs version 1.8.1

        ———————————

        so close and yet so far…. i can never get the point where the files are decrypted from amazon : (

        i get this error every time i try this… losing mind.. been at this for a week using 3 or 4 different sets of instructions… still no luck : ) : ( what am i doing wrong : (
        ———————————
        ENCFS6_CONFIG=’/home/xxxxx/plex/encfs.xml’ encfs /home/xxxxx/plex/.local /home/jaquestati/plex/local
        EncFS Password:

        fuse: mountpoint is not empty
        fuse: if you are sure this is safe, use the ‘nonempty’ mount option
        fuse failed. Common problems:
        – fuse kernel module not installed (modprobe fuse)
        – invalid options — see usage message

        Like

    • so close again : ) : (
      i think i have all the mounts and everything working.
      i see the files in local and in .acd/local/.local and media but nothing unencrypted in acd

      and even with the allow other changes… plex doesn’t see the files in media.

      Like

      • does this help from the acd_cli log?
        the no such file/directory error…?
        ——–
        17-01-18 22:08:33.412 [DEBUG] [acdcli.acd_fuse] – readdir /Plex (0,)
        17-01-18 22:08:33.413 [DEBUG] [acdcli.acd_fuse] – releasedir /Plex (0,)
        17-01-18 22:08:33.414 [DEBUG] [acdcli.acd_fuse] – -> getattr /Plex/grPLvi5seEFqQsVrGmyXoe7j (None,)
        17-01-18 22:08:33.414 [DEBUG] [acdcli.acd_fuse] – <- releasedir 0
        17-01-18 22:08:33.414 [DEBUG] [acdcli.acd_fuse] – opendir /Plex ()
        17-01-18 22:08:33.415 [DEBUG] [acdcli.acd_fuse] – readdir /Plex (0,)
        17-01-18 22:08:33.416 [DEBUG] [acdcli.acd_fuse] – releasedir /Plex (0,)
        17-01-18 22:08:33.416 [DEBUG] [acdcli.acd_fuse] – <- releasedir 0

        Like

  31. all day again at this : ) : (

    i thought i was getting somewhere… but now i’m ready to give up..

    every time i try and – encfs /home/plex/.local /home/plex/local

    i get this error
    ————————–
    fuse: mountpoint is not empty
    fuse: if you are sure this is safe, use the ‘nonempty’ mount option
    fuse failed. Common problems:
    – fuse kernel module not installed (modprobe fuse)
    – invalid options — see usage message
    —————————-
    (hours googling i swear i can’t find an example of how/what to add/use for ‘nonempty’)

    Like

      • ok thanks.. i’ll try that…

        i’ve made some progress at least…

        i finally got the union fuse thing to work.. finally figuring out i needed to put ‘nonempty’ after the allow other bit in the ENCFS6_CONFIG= line and not the original encfs line about the two directories. : )

        and i got thru all the commands with zero errors for the first time…

        and everything is ALMOST working… almost…. : (

        i put things in the local folder and they show up encrypted in the .local folder.
        i rclone the .local folder to amazon (i check via the web and the shows up encrypted on amazon)
        i run acd_cli sync.
        i check and the stuff appears unencrypted in the media folder and plex can see them (hurrah a first) : )

        but… two things… when i rclone to acd it works.. no errors and shows up in the browser as having been deposited on acd.. BUT.. 1- as soon as i exit the terminal and look at my drives in file manager .. after EVERY successful rclone (tried three times after rebooting/redoing it all) the .acd and acd folders disappear completely (they are still there because i cant remount them or recreate them.. but they totally disappear… even checking as root.. both folders are missing/poof/hidden/inaccessible) ?!

        if i reboot they reappear and i do all the commands again and they stay until i rclone then disappear again!?

        could this have to do with various other attempts at mounting acd in different folders this past week? i can’t figure it out. : (

        the other thing is… not all of the stuff i have rcloned up to acd during these various attempts the past week (about 200gb) appears in the .acd or media folder… only the last 20gbs or so (i can see they are still on acd via the browser..but syncing does nothing to show them to me/in my folders)

        i’m thinking that has to do with all the different kinds of attempts at this i have tried and failed doing over the past week… i can just delete all that and redo… that’s no problem… but forgive me if i’m an idiot.. but my brain hurts from trying 4 different tutorials/how to’s on this this week…

        but as i understand it..

        local is the place where i will put things i want encrypted

        .local is where they will show up encrypted (and i’ll rclone them every so often to the cloud
        where they will appear in the media folder which is a fused folder of acd and local

        .acd is the mounted encrypted acd drive at amazon

        acd is suppo9sed to be the decrypted view/virtual folder of that cloud drive

        the point of this is to be able to rclone it to acd so i can delete it off the actual hd of the server, free up the space but still have plex see it on acd via this virtual media folder…

        stupid question… so after it’s rcloned successfully onto acd and appears in media… i can then delete the local folder unencrypted and the .local encrypted versions to free up the space and they will still appear in media via the cloud/acd folder fuse??? i ask because i tested it once and i could be wrong but it seemed if i deleted the .local and local versions they disappeared from the media folder even though they were still in the cloud and in the .acd folder encrypted..

        anyways thanks for all your help (i’m obviously new to linux and have no idea what i’m doing) : ) : (
        hanks for putting up with my stupidity/thickness…. feel like i am THIS close to finally getting it working : )

        Like

    • Would remove all previous mounts and try again. Best to do via the automatic mount script in the next chapter.

      chmod + x the script (fill the XXXX) and run it…

      ———
      #!/bin/sh

      /bin/fusermount -uz /home/jaquestati/plex/acd
      /bin/fusermount -uz /home/jaquestati/plex/.acd
      /bin/fusermount -uz /home/jaquestati/plex/local
      /bin/fusermount -uz /home/jaquestati/plex/.local
      /bin/fusermount -uz /home/jaquestati/plex/media

      /usr/local/bin/acdcli sync

      /usr/local/bin/acdcli mount -ao /home/jaquestati/plex/.acd

      ENCFS6_CONFIG=’/home/jaquestati/plex/encfs.xml’ encfs –extpass=”cat /home/jaquestati/plex/scripts/encfspass” /home/jaquestati/plex/.acd/XXXXXX /home/jaquestati/plex/acd

      ENCFS6_CONFIG=’/home/jaquestati/plex/encfs.xml’ encfs –extpass=”cat /home/jaquestati/plex/scripts/encfspass” /home/jaquestati/plex/.local /home/jaquestati/plex/local

      unionfs-fuse -o cow /home/jaquestati/plex/local=RW:/home/jaquestati/plex//acd=RO /home/jaquestati/plex/media

      exit

      Like

      • where would i put the “allow_other,nonempty” in those two ENCFS6_CONFIG lines? (without them i get/got errors)

        right after encfs? with a dash? or after the -extpass=”cat ?

        thanks.

        Like

      • not sue what i did wrong… i tried it your way above..

        ——————–

        #!/bin/sh

        /bin/fusermount -uz /home/jaquestati/plex/acd
        /bin/fusermount -uz /home/jaquestati/plex/.acd
        /bin/fusermount -uz /home/jaquestati/plex/local
        /bin/fusermount -uz /home/jaquestati/plex/.local
        /bin/fusermount -uz /home/jaquestati/plex/media

        /usr/local/bin/acdcli sync

        /usr/local/bin/acdcli mount -ao /home/jaquestati/plex/.acd

        ENCFS6_CONFIG=’/home/jaquestati/plex/encfs.xml’ encfs –extpass=”cat /home/jaquestati/plex/scripts/encfspass” /home/jaquestati/plex/.acd/plex /home/jaquestati/plex/acd

        ENCFS6_CONFIG=’/home/jaquestati/plex/encfs.xml’ encfs –extpass=”cat /home/jaquestati/plex/scripts/encfspass” /home/jaquestati/plex/.local /home/jaquestati/plex/local

        unionfs-fuse -o cow /home/jaquestati/plex/local=RW:/home/jaquestati/plex//acd=RO /home/jaquestati/plex/media

        exit

        —————————
        and also tried adding the nonempty and allow other… but got the same errors– : (

        ————
        /bin/fusermount: entry for /home/jaquestati/plex/acd not found in /etc/mtab
        /bin/fusermount: entry for /home/jaquestati/plex/.acd not found in /etc/mtab
        /bin/fusermount: entry for /home/jaquestati/plex/local not found in /etc/mtab
        /bin/fusermount: entry for /home/jaquestati/plex/.local not found in /etc/mtab
        /bin/fusermount: entry for /home/jaquestati/plex/media not found in /etc/mtab
        Last sync was very recent or has invalid date. Waiting 0m 41s.
        Getting changes..
        Inserting nodes.
        When specifying daemon mode, you must use absolute paths (beginning with ‘/’)
        Build: encfs version 1.8.1

        Like

  32. Have you had any more success with this one? i think i’m seeing a similar problem. the “.acd” folder mounts successfully via acdcli and i can see the encrypted files. I can mount the folder with encfs and the subfolders decrypt successfully (Movies and TVShows). None of the contents do, however. The folders appear to be empty. i’ve been through the list here and spent some time with google elsewhere, but can’t get this to work.

    Like

    • When you say the Movies and TV Shows directories are decrypted, where are you seeing those? In the media directory? Because that would be the local Movies/TV directories you’re seeing.

      If you run “mount” in a terminal, how many encfs entries are there and what are the directories?

      Like

      • Probably should have included a bit more info. Sorry about that.
        1) running mount in termini can indicates two encfs entries, /home/plex/acd and /home/plex/local
        2) i also see the union-fs mount on /home/plex/media
        3) When i look at the /home/plex/.acd/Plex folder, i see two directories which are encrypted (random names) and inside them, i see my encrypted files. When i look in /home/plex/acd, i see two folders (Movies and TV Shows). Inside them, i see only the readme.txt file that i created as part of the process to figure out which one was which while they were encrypted. None of my video files are decrypted of visible.

        Liked by 1 person

  33. I am intrigued with this setup, and I seem to have missed how does plex read the encrypted files on Amazon? The end result is serving the encrypted files from amazon to plex, correct?

    Like

  34. I just cannot get this to work. I’ve tried it multiple times and all seems good until I get to

    rm -Rf “/home/plex/local/Movies/”*
    rm -Rf “/home/plex/local/TV Shows/”*

    and the files I’ve uploaded to ACD disappear and Plex cannot see them.

    What am I doing wrong?

    Like

    • Is your transfer server and plex server on same machine? Also, how are you mounted, via acdcli or rclone? If acdcli, then you will need to sync after upload. If rclone, I would recommend setting the dir-cache-time on mount, that way it refreshes automatically on interval. For example:

      rclone mount –dir-cache-time 5m acd:Library /home/plex/.acd &

      I have this set on my plex server so that every 5 minutes, it’ll make sure whatever uploads I’ve completed from transfer server will show up on my plex server.

      The plex application needs to be set to pick up changes as well… if local server, you can change settings in plex to auto detect directory changes. If on VPS, you’ll have to set to interval.

      Like

  35. One of the clearest guides that I have been able to follow, Thanks.

    How could I present the encrypted data to a Windows box, using my Plex box as a shim/man in the middle for my ACD drive?

    I have attempted to share /media/ via Samba but the drive is unreadable once mounted.

    Like

  36. First of all, great guide. Thanks!

    I run into a weird problem. I move files to the media folder, copy them to ACD via rclone, but when I delete the file in the local folder (after finishing uploading, of course), the files are still visible in the media folder but Plex can’t see them and when I open the file Ubuntu says it can’t find the file. All the while I can see the file in the file explorer. Any idea what this could be?

    Like

    • I spoke too soon: now I also can’t see the files in file explorer. So… when I put files in the media folder, then copy the files to ACD and then delete them from the local folder, they also disappear from the media folder.

      Like

    • This is exactly where I am right now too.
      Uploaded a few test files, can see them in Amazon, can see them in the Media folder, but cannot see anything in /.acd except a plex folder, nothing within.
      And Plex fails playback stating the file cannot be found.

      Like

      • Edit:

        I can now see my encrypted files in /.acd/, and unencrypted versions in /acd/ however they are still unavailable for playback within Plex.
        I feel like I am so close!

        Like

  37. Ok, so I thought I had everything working…but a few things are not working….
    Copying files into /Local/ results in them encrypting into /.local/
    The rclone copy command successfully copies from /.local to Amazon Cloud, I can see the files in Amazon’s webclient.
    Files appear in /Media/

    2 issues:
    I delete files/folders in /local/ however they don’t disappear from /.local/
    Do I also need to be clearing the encrypted /.local/ folder?

    Plex server can see the folders and files enough to sync and have them appear in my library, however the files are Unavailable for playback.
    =(

    Like

    • Edit:
      Forgot to say I wasn’t seeing files in /.acd/ either.
      Cleared that up just now, now I see files in /.acd/, unencrypted in /acd/, but Plex still isn’t able to playback the files.

      Like

      • Edit: And another update:

        Looks like the reason Plex can’t see the existing files to play/update the library is that Root owns the media directory…and for the life of me I can’t get my chown or chmod edits to retain on that folder.

        Like

      • Well… I’m getting out of ideas…

        As a last resource, try this:

        1) Put your own user in the Plex group
        2) Before mount, chmod/chown the mount point as read/write for user/group Plex
        3) Mount using your own user, but don’t forget to use the –allow-other switch.

        and check if this fix your issue.

        Regards.

        Like

      • That didn’t seem to help, my mount script has:
        /usr/sbin/rclone mount –allow-non-empty –allow-other acd:plex /home/plex/.acd &

        I still can’t see within the media folder as the plex user, only as sudo/root.

        Like

      • Looks like it is set correctly:

        # Allow non-root users to specify the allow_other or allow_root mount options.
        user_allow_other

        Like

    • Got it working!
      Had to unmount, chown and chmod the directories while they weren’t mounted, then re-mount (or reboot) and everything now works!

      Last question if anyone is following this:
      If I delete the directories in /local/ and /.local/ rsync will still working with acd and not screw things up, correct?
      I’ll just copy new files into /local/, theyll encrypt into the now empty /.local/, and rsync with amazon without screwing things up from before I deleted the directories within?

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s