Hi Yvonne,
The file /etc/fstab is basically a list that maps physical block devices (hard drives) to locations in the filesystem. There are four entries on each line. The first is the device, and will be something like /dev/mmcblk0p1 or /dev/sda1. Drives can also be identified by a “Universal Unique IDentifier”, or UUID in which case the first field is something like UUID=f0C81fb5-BEF0-40EB-67854-055afd; using UUIDs is better for reasons I won’t go into right now but will explain if you’re curious; there’s some interesting history behind it.
The second field is a directory somewhere in the filesystem; with some restrictions it can be anywhere. This is the “mount point” where the device will be visible to the software.
The third field is the type of filesystem on the device, and will most likely be ext4 for a native linux partition, or vfat for a Windows type partition; there are a large number of possible types but those are the two most common especially on our Raspberry Pis.
The fourth field is mount option flags, usually “defaults” for the default options.
The fifth field is used by the “dump” command; none of my systems (Raspbian, Linux Mint and Slackware) even have a “dump” command. Best to set it to 0. The sixth field is the order in which filesystems should be checked via fsck at boot time; 0 means don’t check.
So a “typical” Raspi fstab might look like this:
/dev/mmcblk0p5 /boot vfat defaults 0 2
/dev/mmcblk0p6 / ext4 defaults,noatime 0 1
This means that /dev/mmcblk0p6 will be mounted at the root of the filesystem; “/”, while /dev/mmcblk0p5 will be mounted on the “/boot” directory.
Anyway, yes, you’d want a line such as:
UUID=f0C81fb5-BEF0-40EB-67854-055afd /opt/plex/videos ext4 defaults 0 0
After modifying /etc/fstab, you can reboot for it to take effect, or simply type “sudo mount -a”.
After the drive is mounted, you can copy files to /opt/plex/videos and they will be placed on the pidrive even though the directory appears to exist on the SD card. Well the directory itself is in fact on the SD card, but its contents are on the hard drive.
You can see this by doing this:
Copy a few files to /opt/plex/videos (they can be anything, don’t have to be videos for the purposes of the test).
Verify they’re there by listing the directory: ls -l /opt/plex/videos
Now type “sudo umount /opt/plex/videos” (note it’s umount, not mount) to unmount the drive.
List the directory again, you’ll see it’s empty.
Type “sudo mount /opt/plex/videos”, list the directory avgain, and you’ll see the files have returned.
You might want to open a terminal and type “man fstab” for more information on the fstab file. “man mount” will also have some good information on the subject.
If you have any questions I’d be happy to try to explain.
-Bob