How do I get my Plex media server running on startup?

I have my movies and TV Shows on an external SSD which is pretty much always connected to my laptop and auto-mounts on login.

But to run my Plex media server I am supposed to change the file permissions so that it can read the files on the external SSD.

chmod 775 /run/media/hydra

And then use the systemctl command to start the server.

systemctl start plexmediaserver.service

What script can I use to make this happen automatically on startup?(I tried putting this in a .sh file and made it autostart but it didnt seem to work)

why would you do that ? the chmod is done only once.
if you have to start a service each time after reboot you simply missed to enable the service.
you enable it with

sudo systemctl enable plexmediaserver.service

now the service is started automatically each time at boot

1 Like

Plex shows an error dialog saying ‘Check for the file at stored location’ and upon checking the file directory through plex, it doesn’t show my files on the external SSD because it doesn’t have Read permission, which is why I tried chmod on startup and that worked.

What filesystem is on the partition with the media files? And by the way, it doesn’t need 775. 755 is all that’s needed.

On running

df -Th

it says:

Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda4      fuseblk   286G  160G  127G  56% /run/media/hydra/Storage

For further information, the SSD is connected via an USB to SATA cable

Thanks, 775 must have been a typo

I’m guessing it’s NTFS then?

1 Like

Yes it should be, It is a sabotaged SSD which had windows which i have to wipe and setup for just storage, properly, soon.

Well, if it works, then good for you, but I foresee problems with permissions arising soon, because NTFS does not store POSIX file ownership or permissions.

So better would be to include a record for that filesystem — with the proper permissions as a mount option — in /etc/fstab. Something along the lines of… :arrow_down:

UUID=the-UUID-of-the-partition   /run/media/hydra/Storage   ntfs-3g   auto,nofail,uid=1000,gid=1000,utf8,umask=022,defaults   0   0

You can find out the UUID of the filesystem with… :arrow_down:

lsblk -o NAME,MOUNTPOINT,UUID

More information can be found in the tutorial below… :arrow_down:

you can try this

sudo chown -R $USER:$USER /run/media/hydra

reboot and test. if it works remind that it is a dirty-workaround.
the main problem is the ntfs…
the setup as @Aragorn recommends below is the better way but might need some work.

1 Like

I dont mind changing the filesystem, as ive to clean the SSD anyway. Should I? But I noticed it also doesnt see the manjaro partition in the same directory.

sda           8:0    0 465.8G  0 disk 
├─sda1        8:1    0   100M  0 part 
├─sda2        8:2    0    16M  0 part 
├─sda3        8:3    0   1.9G  0 part /run/media/hydra/0a001be9-83af-4bbe-9c23-a4bca902cf61
├─sda4        8:4    0 285.7G  0 part /run/media/hydra/Storage
├─sda5        8:5    0   509M  0 part 
├─sda6        8:6    0 167.5G  0 part /run/media/hydra/Manjaro22
└─sda7        8:7    0    10G  0 part 

Ive attached the partitions of the SSD

YES ! cleaning up the closet is always the best decission.

1 Like

Hii @Hydraknight,

I’d say so. It can only do you good. Get a proper filesystem running.

Shouldn’t be used for anything that is to be permanently mounted. Rather mount it under /mnt. That’s what it’s there for, after all.

See:

followed by:

3 Likes

I actually have no idea how it mounted to /run. Now that I am resetting the SSD, ill make sure its mounted to /mnt.

Should i format the SSD to ext4?

1 Like

Actually, no — /mnt is intended as a temporary mountpoint.

Considering that it’s a filesystem intended as a media server, I would create a mountpoint for it under /srv. On my system here, I use /srv/mmedia for all my multimedia stuff. That way, all user accounts have (read-only) access to it — root has write access, of course.

Time to promote another one of my tutorials… :stuck_out_tongue: :arrow_down:


It’s udisks2, a plug & play subsystem of systemd.

Don’t — see above. :wink:

That’s a good choice. :wink:

2 Likes

That’s news to me. All my partitions are mounted in /mnt/<subdiectory>. Unless you mean directly, in which case yeah, and I’m sorry for the misunderstanding.

1 Like

No, even then still, if you mount something to /mnt directly — which is what /mnt is intended for — then it’ll hide all your other mounts under there, because the subdirectories will no longer be visible.

Read my tutorial(s). :wink:

I intend to use the external ssd to store files from windows as well(I have dual booted). Partition manager says ext4 is linux only. Should i consider any other format like ExFAT?

I’ve done so, but I confess that I might have missed something…

1 Like

this format will be supported by both systems, so if you still need to use windows with it then it’s a good compromise.

if you do so you can install the package “exfat-utils” that you’ll might need some day

1 Like

Create two partitions: one in ext4 and another one in exfat — there are fewer problems with exfat than with ntfs, and GNU/Linux can read and write to exfat.

That way, you can mount the multimedia stuff on the ext4 partition to /srv/mmedia — after creating the mountpoint, of course — and you can mount the exfat partition under your $HOME somewhere.