fstab

Plex – External FAT32 USB drive

So, trying to use a Linux Mint laptop and Plex for a lower power consumption server seemed a good idea, until I realised the disk in the laptop was only a few hundred gig. I opted to use my backup USB disk to serve the media. Its FAT32 and already contained hundreds of videos (as it was my backup)

I wanted it to automount, and always be connected so that Plex just sits there serving away and occasionaly updates the library with new files. My mount point is /media/plexmedia/

I used fstab to mount it. and with many different options and trials, I discovered this to be the optimum line:

UUID=DA3C-7706 /media/plexmedia/ vfat auto,users,umask=000 0 0

Explanation of the settings:

umask=000

This will set every file to rw for all users and groups.

auto

Will automatically mount the drive. Not really necessary but I like to leave it there.

users

Allows the disk to be mounted by any user. I don’t want root owning it, as then Plex might not be able to read/write nicely.

Finally the 0 0

The first 0 means that I don’t want the disk automatically backed up ever
The second 0 is telling fsck that I don’t want to check the device for errors.

 

Now, to get your UUID, you’ll need to run:

sudo blkid

Note: Its better to use the drive’s UUID – as this doesn’t change, but if you were to shuffle the order of the disks around (as in the physical USB ports) the /dev/sda labels may change.

Its important to note, that you cannot change the attributes of the files on a FAT32 disk in Linux, as they don’t have that sort of security metadata within them. The user access changes must be applied to the mount point. A lot of people forget this and is a source of confusion often.

Mounting HTML folder in Centos VirtualBox

I have a particular Linux set up I need to test something on, but I use a Mac, so I use VirtualBox with a Linux VM for the testing.

So, to do this normally, you either install an IDE on the VM and code on there. Installing Java, Netbeans, Subversion, Git, etc, etc, etc, or, you just checkout the code on the VM and make code changes on the Mac…

Neither of these options are really that great, so a friend recommended I mount the code folder from the Mac on the Linux VM. Great idea. So I install a new copy of CentOS and keep it minimal, no window managers, nothing like that. Just Apache, and the database connectors I require.

Now, I would not class myself as a Linux expert in any shape or form. I can set up a server and manage it, ut if you delve too deeply, I start to struggle. I used the VirtualBox automatic mounting for my code folder (using Guest Additions) – this just would not work. I tried checking out the code into a local folder and that worked fine. Must be a problem with the share/permissions or something.

After wasting an hour or so checking permissions and groups, I gave up and tried the internet. Came across a really helpful post, which I sort of followed. I had to alter it for CentOS as it was Ubuntu orientated.

You have to install Guest Additions first!

Add a virtual box shared folder

Create a Transient folder in the shared folders section and take note of the name, I used ‘sites’ – do not select any of the checkboxes when creating the share. This is what causes the problem as VirtualBox creates the share with permissions that Apache cannot use.

mkdir /var/www/sites
mount -t vboxsf -o rw,uid=0,gid=0 sites /var/www/sites

I used the UID and GID of 0 as I was only installing this VM as root. There were no other users installed, but you do need to change the UID and GID of the Apache process (www-data?)

Test that and make sure it works, if it does, lets make it permanent:

nano /etc/fstab
sites /var/www/sites vboxsf defaults 0 0

Hey presto, the folder is mounted on boot and you should be able to serve the docs from there.

Obviously you need to update the vhosts to point at the shared folder. But you know how to do that, right?