How to Edit Files in Jail via SMB

dexll

Dabbler
Joined
Jul 16, 2020
Messages
10
I had an issue where my boot drive became corrupted. I reloaded fresh with the latest TrueNAS, imported my config, and all was well except my Plex Server. The Plugin/Jail won't start.

I created a new Plex Server plugin and thought I would just copy the "\\truenas\iocage\jails\PlexMediaServerJail01\root\Plex Media Server" from one jail to the other, but get do not have permission/rights in Windows.

I configured the iocage as an SMB share and my Windows account has Full Control + Inherit, but I still cannot edit the files in just the \Jails\ directory.

If I try to Apply Permissions Recursively I get Error: [EPERM] Changing permissions on jail dataset paths is not permitted.

Is there anyway I can get permission to these files?
 
Joined
Oct 22, 2019
Messages
3,641
Why not use SSH instead?
 

dexll

Dabbler
Joined
Jul 16, 2020
Messages
10
I'm down, but not sure how. Can you give me the 30 second cliffs notes? I am not good at unix. Is that kinda like doing copy/paste commands via the console?
 
Joined
Oct 22, 2019
Messages
3,641
If you prefer directly from within the "Shell" menu (in the TrueNAS GUI), you can do it that way as well. However, I find the line-width to be limiting.

If you configured SSH, you could login with your TrueNAS username (such as "dexll") via:
ssh dexll@192.168.0.101

Windows 10 PowerShell has SSH built-in, no need for any third-party tools or downloads. Any Linux distro likewise has this as well.

Whichever of the above methods you use (Shell from within TrueNAS or SSH), you will essentially use the "cp -v -a" command.

I'd also play it safe by renaming or removing the new Plex local files.

Code:
# If using SSH, first elevate yourself to the root user (or ignore this step if using the Shell menu inside TrueNAS GUI)
sudo su

# Stop both jails
iocage stop plexold
iocage stop plexnew

# Move to a a more comfortable base directory
cd /mnt/poolname/iocage/jails

# Remove (or rename) the new Plex folder, but be make sure it's the NEW jail, not the old one!

# To remove
rm -r -f -v plexnew/root/usr/local/plexdata

# Or if preferred, to rename
mv -v plexnew/root/usr/local/plexdata plexnew/root/usr/local/plexdata.new

# Then copy from the old jail to the new jail, preserving file/folder attributes
cp -v -a plexold/root/usr/local/plexdata plexnew/root/usr/local/

# Make sure the permissions/ownership are correct. You should see the user and group "plex" as the owner
ls -l plexnew/root/usr/local/

# Start the new jail
iocage start plexnew

# Exit the Shell or SSH with CTRL + D or by closing the window


See if this works? It might be an issue if your Plex versions are too far apart (like the old jail was using an older version of Plex with a different file/folder structure.)

BE VERY CAREFUL USING DESTRUCTIVE COMMANDS IN THE SHELL OR SSH AS THE ROOT USER. ONE SMALL ERROR OR JITTERY FINGER COULD DELETE EVERYTHING

Create a pool-wide recursive snapshot before proceeding if you want an extra buffer of protection.
 
Joined
Oct 22, 2019
Messages
3,641
Wait, did you check to see if your new plex jail will start?
 

dexll

Dabbler
Joined
Jul 16, 2020
Messages
10
Thanks I will try this. Yeah, new Plex Plugin works totally fine.
 
Top