Plex + Raspberry Pi + ExFat HDD

Written by Helguera on

In today's post I explain how to set up a Plex server on a Raspberry and use an Exfat HDD to store media files.


The operating system I am using is Raspbian OS Lite. It has no graphical interface, just a terminal, but it will be more than enough. It weighs only 480 mb. You can find it at the official page.

Initial Steps

First of all, it is always advisable to update the Raspberry.

sudo apt-get update
sudo apt-get upgrade

Remember: to be able to access the Raspberry Pi via ssh it is necessary to create an empty file named "ssh" in the root of the SD card.

Tip: you can run the following command from your computer to find out the IP that the router has assigned to the Raspberry.

arp -a | findstr b8-27-eb

Well, now we are sure that the Raspberry is up to date and that we are not missing anything we might need.

The next step is to **add the Plex repository** to the system repository list.
sudo apt-get install apt-transport-https
curl | sudo apt-key add -
echo deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

When a new repository has been added, it will be necessary to run the "update" command to refresh the list.

sudo apt-get update


With the previous steps completed, all that remains is to install the Plex server.

sudo apt install plexmediaserver

Starting and stopping the server

By default the server is already up once the installation is finished or when restarting the Raspberry. In any case, the command in case it is not:

sudo service plexmediaserver start

Similarly, if you want to stop the server:

sudo service plexmediaserver stop

Connect HDD Exfat

The first idea that comes to mind is to simply connect the external hard drive (or internal hard drive with an enclosure) to one of the USB ports of the Raspberry. And yes, that might be enough. So that's the first thing we are going to try:

By using the df command we can see the list of connected devices:

df -h

We will have to find a line with the name of our disk (it does not have to be the same as the one you see below, but it does have to start with /dev):

/dev/sda1       932G  222G  710G  64% /media/pi/mi-disco

In my case the file system is named /dev/sda1.

IMPORTANT: If your disk is not listed, take a look at the next section before continuing where I talk about external power. It will probably solve your problem.

For the Raspberry to recognize the Exfat format we install the following:

sudo apt install exfat-fuse
sudo apt install exfat-utils

We create a directory where we will mount the disk:

sudo mkdir /media/mydisk

And finally we mount the disk:

sudo mount -t exfat /dev/sda1 /media/mydisk

External power supply

If connecting the HDD to the Raspberry has not worked for you, it is probably because the HDD needs more power than the Raspberry can provide. There are two solutions to this situation:

  1. Use an enclosure that has an input for external power supply.
  2. Use a USB rack with external power supply -> Amazon link..

In my case, since I already had an unpowered enclosure purchased before I had this problem, the only solution that worked for me was the second one.

24/7 connected, to what extent is it advisable?

The big debate: the hard disk is spinning 24 hours a day even if I am not using it, can it break down or deteriorate its lifespan?

This question does not have an easy yes or no answer. There are numerous articles that compare having a hard disk spinning uninterruptedly with turning it off and on every time we make use of it. Remember that at all times in this article I am referring to hard drives, whose components are mechanical, not a solid state drive (SSD).

Personally, I prefer that if the disk is not being used, better stopped. There is a tool with which this can be achieved: hdparm.

Wikipedia: hdparm is a command line utility for GNU/Linux and Windows operating systems for viewing and adjusting hardware parameters of IDE and SATA1 disks. The utility can adjust parameters such as disk cache, sleep mode, power control, acoustic management and DMA settings. It is usually installed by default on most GNU/Linux distributions.

Therefore, with the following command the disk will stop spinning if it is idle for 3 minutes. As soon as its information is accessed it will start spinning again:

hdparm -B 50 -S 36 /dev/disk/by-label/nombre-del-disco


At this point Plex will be installed and ready for use. You can access its graphic interface through a web browser that is on the same local network through the address:


I hope you found it useful,

Javier Helguera.