Confused about iocage-jail external file link

feleven

Dabbler
Joined
Feb 17, 2014
Messages
39
I run TrueNAS 12.0-U5 with Plex media folders/files at /mnt/TANK/PlexMedia. I installed Plex Media Server inside a jail at /mnt/TANK/iocage/jails.

I expected that the jail Mount Points connected the actual Plex media files by a symlink or pointer of some kind, as its my understanding (possibly flawed) that a jailed app that references externally located files doesn't copy those files into itself, but just points to them at their original location.

So if I drop a movie file, for example "The Quiet Earth (1985)" into folder /mnt/TANK/PlexMedia/Movies, and have jail Mount Points set as:

Source: /mnt/TANK/PlexMedia
Destination: /mnt/TANK/iocage/jails/plex/root/media

I expected the movie file to show up in the Plex jail as a symlink of some sort. Instead, I see what appears to be the actual movie file copied to the jailed plex media folder. That is, I see the same -rwxrwxr-x permissions string at both the original and jailed media locations:

TrueNAS# ls -lrt /mnt/TANK/PlexMedia/Movies
-rwxrwxr-x 1 nobody nobody 4695781113 June 25 2011 The Quiet Earth (2012).mkv

TrueNAS# ls -lrt /mnt/TANK/iocage/jails/plex/root/media/Movies
-rwxrwxr-x 1 nobody nobody 4695781113 June 25 2011 The Quiet Earth (2012).mkv

I was expecting to see lrwxrwxr-x in the jailed media location. Am I misunderstanding how the jailed media files are linked, or did I somehow mess up my jailed Plex Media Server installation?

FWIW, I started out with FreeNAS 9.x way back in 2014, and have updated and upgraded my way to 12.0-U5 through the years. Plex Media Server was originally installed as a FreeNAS plug-in, but I migrated it into an iocage/jail in 2018 following detailed instructions I found in these forums ... not to say I didn't screw something up in the process.
 
Joined
Jul 10, 2016
Messages
521
I expected that the jail Mount Points connected the actual Plex media files by a symlink or pointer of some kind, as its my understanding (possibly flawed) that a jailed app that references externally located files doesn't copy those files into itself, but just points to them at their original location.

This is correct, iocage uses mount_nullfs(8) to mount the directories from the host into the jail. This is not symbolic link, but a different mechanism to allow the existing files and directories to be accessed using a different pathname. The linked man page may help you understand the differences.

It does not count towards disk space, even though some tools may seem to double-count the space.
 

feleven

Dabbler
Joined
Feb 17, 2014
Messages
39
Hey Jurgen, thanks for the reply!

While I'm not a total newb to FreeNAS/TrueNAS, I'm still learning every time I log into it. That iocage uses mount_null to *mount* the original media files as a file-system is something I hadn't considered, but now seems obvious - "MOUNT POINTS" should have made the answer obvious. Duh. The link you provided mentioned the similarity to mounting a CD/DVD on your computer, allowing access to the content without copying everything over to the HDD - that helped to complete my grasp of the idea and a better understanding.

Where all this started was when I did an rsync backup of TANK to BKUP - and I could plainly see that the media files were being copied into the backed up plex jail - basically consuming twice the total HDD space I expected. I assume my existing backup Tasks/CronJobs command

rsync -avzz /mnt/TANK/ /mnt/BKUP

treats the iocage mounted file-system as being part of the /mnt/TANK files, and therefore dutifully backs them up. Obviously my backup process needs to be fixed, or I'll continue to consume a LOT of backup HDD space needlessly.

I often see snapshots recommended as a means of backing up a TrueNAS system. I assume that this process operates the same way macOS TimeMachine works, where the first TM snapshot of a brand new Mac basically copies the all files from the primary HDD/SSD to TM storage, then every snapshot taken after that contains just the differences between the original snapshot and the current content of the HDD/SDD. Would it be more efficient to backup iocage separately from the rest of the TrueNAS files?
 

feleven

Dabbler
Joined
Feb 17, 2014
Messages
39
Actually, I just read an article from a year ago about using "iocage export [ jail ]" to backup a jail, either manually or automatically as part of a scheduled script.

If I read correctly, it appears everything concerning the jail but the mounted fs (containing my media) would be included in the export. Then I'd just have to backup the rest of the TrueNAS files outside iocage/jails separately. Or am I missing something?
 
Top