Notes on setting up host tol-eressëa

Russell Bateman
September 2013
last update:

Table of Contents

Tol Eressëa
Server installation
Disk list
Pre-launch maintenance
Changing direction a bit...
Setting up ZFS...
Additional set-up
Appendices
Disk table
Disk-related status
Apache 2 web server, PHP, Java 7 and Tomcat
Attaching a USB 3 disk to Ubuntu Server
Attaching a USB 3 disk to Ubuntu Server, second try

This is a log of events setting up a new host on which I'll run the Plex Media server. I'm choosing the recent Ubuntu 14.04 LTS Trusty Tahr Server OS.

Tol Eressëa

In case you had to ask, Tol Eressëa is, as tol suggests, the name of an island. It was used by Ulmo to ferry the Vanyar and the Noldor, then later those Teleri (who were not Umanyar or late to the western shores) across the seas until fixed in the Bay of Eldamar.

Since the rebellion of the evil sea kings and the meddling of Sauron which resulted in the downfall and destruction of Numenor, it's probably no longer reachable by any purely physical voyage without aid of the Valar. Without these "straightening the way" by which you could come to the Undying Lands, you would merely wrap around the Earth until you reached your starting point.

It's a phenomenon that has stumped arrogant scientists in recent centuries who've concluded that Arda is "round" (or spherical) as set in Ea and have falsely promoted the idea that people were once cruelly burned at the stake for saying so. Some of us know now that no one was ever burned at the stake for saying the world was round, but that that the scientists themselves would leap at the chance to burn someone who says Arda has a western edge (or that men are somehow responsible for global warming cycles which they could easily remedy if only they'd open their wallets to the liberal politicians and other allies of these so-called scientists).

Installation

Hardware being used:

Intel i5-2500K 6Mb L3, 1Mb L2, 3.3GHz Sandy Bridge 3.3 GHz CPU
ASUS P8Z77-V motherboard
16Gb memory
Seagate 320Gb hard drive (system)
2 × Western Digital 2Tb hard drives
2 × Seagate 4Tb hard drives

This hardware has been running flawlessly for some 18 months under VMware ESXi.

I ran into a problem. When I rebuilt the host I had been using to run VMware ESXi, equipping it with an old Seagate 320Gb drive I hoped to load the OS on plus adding two new Seagate 4Tb drives, the OS installation was unable to write GRUB to the boot part. I tried replacing the 320Gb drive with a 240Gb SSD and that didn't work any better. I also tried to install Ubuntu 12.04 in case it was a new problem, but to no avail. Finally, I disconnected all the drives except the 320Gb and the installation went perfectly. Then I reconnected all the 2Tb and 4Tb drives and it came up cleanly. Those I will be handling using zfs. Click to the right here to see the GRUB error.

I got some help before I decided to remove the other drives. I posted this: http://ubuntuforums.org/showthread.php?t=2236061&p=13081643#post13081643

Disk list

As seen in case above, from top to bottom:

  1. Seagate 320Gb system disk
    —replaced 25 September 2018 with 1Tb Western Digital Blue
  2. Western Digital Black 2Tb movies disk; black cable marked T
  3. Western Digital Black 2Tb movies disk; black cable marked B
  4. Seagate 4Tb BarraCuda television series disk; red cable marked A
  5. Seagate 4Tb BarraCuda television series disk; red cable marked B

Pre-launch maintenance

Before getting started, I performed a number of tasks. I don't wish to do too much in case zfs fails and I have to start over or even rethink it.

  1. Switch from DHCP to static IP address 192.168.0.101.

  2. Repair resulting DNS problem created by that. see
    1. "Starting configure network security device [fail] and
    2. Failure to ping outside of LAN, ping google.com.

  3. Update and upgrade via advanced package tool
    # apt-get update
    # apt-get upgrade
    

ZFS: Changing direction a bit...

This time around, ZFS is supported by Canonical (Ubuntu), so while most of what's here now (and was here from the beginning) still holds, I'm putting the rest of that discussion—new version/post crash—in these separate notes. And here are the notes on bringing everything back


Additional set-up...

I created all the relevant users, assigned temporary passwords and copied all the web server content from taliesin to tol-eressea.

I installed Apache 2, PHP, Java 7 and Tomcat, I copied over all the vhost files, etc. for the domains I serve up. See this here.

Then I installed the Plex Media Server.





Appendices

Disk table

Here's the map I made of the disks after system installation and before zfs. The order of these is logical and also the order you see, top to bottom, in the photo above.

Disk Device Volume Size Use Comments
Seagate 320 Gb
ATA ST3320613AS (scsi)
/dev/sdc1 boot 255 Mb GRUB (still has some MSDOS thing on it? harmless? still investigating)
/dev/sdc2 swap 16.8 Gb Swap space
/dev/sdc5 boot 303 Gb /
Western Digital 2 Tb
ATA WDC WD20EARX-00P (scsi)
/dev/sda X 1.8 Tb X
Western Digital 2 Tb
ATA WDC WD20EARX-00P (scsi)
/dev/sdb X 1.8 Tb X (still has VMware ESXi on it—will be removed by zfs)
Seagate 4 Tb
ST4000DM000 (scsi)
/dev/sdd X 3.6 Tb X
Seagate 4 Tb
ST4000DM000 (scsi)
/dev/sde X 3.6 Tb X

Disk-related status

Now, before I used zfs, yet with all the disks connected and turning, here was the output of a number of a number of commands. There are errors here associated with the two, brand new 4 Tb disks that have never had anything on them.

$ fdisk -lu
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000d048e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  3907029167  1953514583+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00018ad7

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  3907029167  1953514583+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdc: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000146f0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048      499711      248832   83  Linux
/dev/sdc2          501758   625141759   312320001    5  Extended
/dev/sdc5          501760   625141759   312320000   8e  Linux LVM

Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes
255 heads, 63 sectors/track, 486401 cylinders, total 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/sde: 4000.8 GB, 4000787030016 bytes
255 heads, 63 sectors/track, 486401 cylinders, total 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/tol--eressea--vg-root: 302.9 GB, 302946189312 bytes
255 heads, 63 sectors/track, 36831 cylinders, total 591691776 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/tol--eressea--vg-swap_1: 16.8 GB, 16848519168 bytes
255 heads, 63 sectors/track, 2048 cylinders, total 32907264 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

$ blkid
/dev/sda1: UUID="195fdacc-4891-4250-a901-241b655387b1" TYPE="ext2"
/dev/sda5: UUID="5JtzN6-u6QS-Nju1-uDs5-N1Ml-WGIi-PJgOcX" TYPE="LVM2_member"
/dev/mapper/tol--eressea--vg-root: UUID="359c69e9-fe56-4403-94e0-0ef569518263" TYPE="ext4"
/dev/mapper/tol--eressea--vg-swap_1: UUID="87631cc8-248e-424b-a9dd-d93ee2ec74ca" TYPE="swap"


$ parted -l
Model: ATA WDC WD20EARX-00P (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Model: ATA WDC WD20EARX-00P (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Model: ATA ST3320613AS (scsi)
Disk /dev/sdc: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type      File system  Flags
 1      1049kB  256MB  255MB  primary   ext2         boot
 2      257MB   320GB  320GB  extended
 5      257MB   320GB  320GB  logical                lvm

Error: /dev/sdd: unrecognised disk label

Error: /dev/sde: unrecognised disk label

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/tol--eressea--vg-swap_1: 16.8GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system     Flags
 1      0.00B  16.8GB  16.8GB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/tol--eressea--vg-root: 303GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  303GB  303GB  ext4


$ gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): DDFA998F-8F8A-45F7-8BAA-A9146B1FB61C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3907029101 sectors (1.8 TiB)

$ gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 8B3E3422-A0CE-4293-9EE2-75C0FA58C285
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3907029101 sectors (1.8 TiB)

$ gdisk -l /dev/sdc
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/sdc: 625142448 sectors, 298.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): C52FC97E-3717-481A-B815-70D4446C2F65
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 625142414
Partitions will be aligned on 2048-sector boundaries
Total free space is 4717 sectors (2.3 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          499711   243.0 MiB   8300  Linux filesystem
   5          501760       625141759   297.9 GiB   8E00  Linux LVM

$ gdisk -l /dev/sdd
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.
Disk /dev/sdd: 7814037168 sectors, 3.6 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 26A0FEB1-9BC7-420F-9763-E85084AC2E25
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7814037134
Partitions will be aligned on 2048-sector boundaries
Total free space is 7814037101 sectors (3.6 TiB)

$ gdisk -l /dev/sde
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.
Disk /dev/sde: 7814037168 sectors, 3.6 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 14288C92-D349-42A2-B789-3659F8888C96
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7814037134
Partitions will be aligned on 2048-sector boundaries
Total free space is 7814037101 sectors (3.6 TiB)

Apache 2 web server, PHP, Java 7 and Tomcat support

Install Apache 2 web server.

root@tol-eressea:/# apt-get update
root@tol-eressea:/# apt-get install apache2

This starts after installing Apache 2. I'm just getting ready to host various pages that require extra modules. First, I went to /etc/apache2/mods-enabled and examined what might be missing. I see that Tomcat support, PHP and some stuff that's needed for certain kinds of PHP activities are missing.

root@tol-eressea:/# cd /etc/apache2/mods-enabled

PHP support...

root@tol-eressea:/etc/apache2/mods-enabled# apt-get install php5
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/php5.conf
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/php5.load

WordPress (PHP) support...

root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/reqtimeout.conf
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/reqtimeout.load
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/rewrite.load
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/userdir.conf
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/userdir.load

Before Tomcat comes Java...

root@tol-eressea:/# apt-get install openjdk-7-jdk
root@tol-eressea:/# apt-get install tomcat6

Tomcat support...

root@tol-eressea:/etc/apache2/mods-enabled# apt-get install libapache2-mod-jk
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/jk.conf
root@tol-eressea:/etc/apache2/mods-enabled# ln -s ../mods-available/jk.load

I still need to modify some configuration files for the Tomcat support. See Apache 2 and Tomcat in Co-existence for details on what I had to do so these two could coexit.

I also copied all the vhost files for the domains my web server hosts from host taliesin. To more easily preserve the links, I made a tarball of sites-enabled which worked perfectly (I did not have to re-create the symbolic links).

More necessary Apache 2 support to turn off the complaint about the server's FQDN when starting/restarting Apache:

root@tol-eressea:/# service apache2 restart
 * Restarting web server apache2
 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. \
         Set the 'ServerName' directive globally to suppress this message
root@tol-eressea:/etc/apache2# echo "ServerName localhost" | tee /etc/apache2/conf-available/fqdn.conf
ServerName localhost
root@tol-eressea:/etc/apache2# ln -s /etc/apache2/conf-available/fqdn.conf /etc/apache2/conf-enabled/fqdn.conf
service apache2 restart
 * Restarting web server apache2                                          [ OK ]

Apache doesn't work as configured identically to my old server (Ubuntu 12.04 LTS), but it's not Ubunut's fault. It's Apache's; they changed a bunch of stuff. Here are things I looked at.

Ultimately, I discovered two things very different from Apache 2.2.

  1. Configuration files in sites-available and sites-enabled MUST end with the extension .conf and nothing else.

  2. Second, there is a problem with /etc/apache2/apache2.conf. It appear thus:
    <Directory />
            Options FollowSymLinks
            AllowOverride None
            Require all denied
    </Directory>
    

    ...but I had to change it to this:

    <Directory />
            Options FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
    

I'm a little worried about this and I'm going to uninstall Apache 2, then start over. So, I did

# apt-get purge php5
# apt-get purge apache2

Then I copied all the vhost files back to sites-available and made links to them. I copied mods-available/jk.conf (and the load) by hand and make links. I remade the userdir links.

Then I reinstalled Apache and PHP. Making the changes I learned about and noted just above, the server came up.


Attaching a USB 3 disk to Ubuntu Server

With the chassis pretty much full of internal drives, I resorted to external, USB 3 drives for adding more Plex media. Here's what I did. I downed the server, hooked up the USB 3 drive, a Seagate 2Tb, then powered up.

root@tol-eressea:/# cd media
root@tol-eressea:/media# mkdir plex-vintage
root@tol-eressea:/media# ll
total 16
drwxr-xr-x  4 root root 4096 Aug 15 13:28 ./
drwxr-xr-x 24 root root 4096 May  5 06:54 ../
drwxr-xr-x  2 root root 4096 Jul 24  2014 cdrom/
drwxr-xr-x  2 root root 4096 Aug 15 13:28 plex-vintage
root@tol-eressea:/media# blkid
  /dev/sda1: LABEL="movies" UUID="17302323605392653091" UUID_SUB="15394959432617986808" TYPE="zfs_member"
  /dev/sdb1: LABEL="movies" UUID="17302323605392653091" UUID_SUB="14639891384711792792" TYPE="zfs_member"
  /dev/sdc1: UUID="195fdacc-4891-4250-a901-241b655387b1" TYPE="ext2"
  /dev/sdc5: UUID="5JtzN6-u6QS-Nju1-uDs5-N1Ml-WGIi-PJgOcX" TYPE="LVM2_member"
  /dev/sdd1: LABEL="television" UUID="3759371443983060498" UUID_SUB="9705470060758384852" TYPE="zfs_member"
  /dev/sde1: LABEL="television" UUID="3759371443983060498" UUID_SUB="11200378628305314885" TYPE="zfs_member"
  /dev/mapper/tol--eressea--vg-root: UUID="359c69e9-fe56-4403-94e0-0ef569518263" TYPE="ext4"
x /dev/sdf1: LABEL="22@2 Provo movie" UUID="28DA225FDA222A10" TYPE="ntfs"
  /dev/mapper/tol--eressea--vg-swap_1: UUID="87631cc8-248e-424b-a9dd-d93ee2ec74ca" TYPE="swap"
root@tol-eressea:/media# mount /dev/sdf1 /media/plex-vintage
root@tol-eressea:/media# cd /media/plex-vintage/
root@tol-eressea:/media/plex-vintage# ll
total 740
drwxrwxrwx 1 root root   4096 Aug 10 17:26 ./
drwxr-xr-x 4 root root   4096 Aug 15 13:34 ../
drwxrwxrwx 1 root root      0 Aug 10 17:26 LDS Tab Choir MP4/
drwxrwxrwx 1 root root      0 Aug 10 17:25 LDS Tabernacle choir MP3/
drwxrwxrwx 1 root root  28672 Aug 10 15:12 MP4 - Christmas-new year/
drwxrwxrwx 1 root root 262144 Aug 10 17:17 MP-4 documentary/
drwxrwxrwx 1 root root  28672 Aug 10 11:59 MP4-Hallmark Movies/
drwxrwxrwx 1 root root  20480 Aug 10 15:18 MP4-John Wayne  Movies/
drwxrwxrwx 1 root root  65536 Aug 10 17:45 MP4-LDS-tab/
drwxrwxrwx 1 root root 131072 Aug 10 18:23 MP4-LDS-videos/
drwxrwxrwx 1 root root  65536 Aug 10 13:18 MP4-Movies-Gaye(A)/
drwxrwxrwx 1 root root  98304 Aug 10 17:22 MP4-Movies-Russ(A)/
drwxrwxrwx 1 root root  49152 Aug 10 14:57 MP-4 - The Piano Guys/
drwxrwxrwx 1 root root      0 Aug 10 14:50 $RECYCLE.BIN/

I renamed these directories and plunged them down under just a couple because of what I'll need to do in Plex. But first, I edit /etc/fstab to make this drive remount automatically at reboot.

root@tol-eressea:/etc# vim fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#                
/dev/mapper/tol--eressea--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=195fdacc-4891-4250-a901-241b655387b1 /boot           ext2    defaults        0       2
/dev/mapper/tol--eressea--vg-swap_1 none            swap    sw              0       0
UUID=28DA225FDA222A10     /media/plex-vintage    ntfs   auto   rw   user   0   0
root@tol-eressea:/etc# cd /media/plex-vintage/
root@tol-eressea:/media/plex-vintage# ll
total 9
drwxrwxrwx 1 root root 4096 Aug 15 13:51 ./
drwxr-xr-x 4 root root 4096 Aug 15 13:34 ../
drwxrwxrwx 1 root root  184 Aug 15 13:50 Music/
drwxrwxrwx 1 root root    0 Aug 10 14:50 $RECYCLE.BIN/
drwxrwxrwx 1 root root  528 Aug 15 13:51 Videos/
root@tol-eressea:/media/plex-vintage# reboot

Broadcast message from russ@tol-eressea
    (/dev/pts/1) at 14:10 ...

The system is going down for reboot NOW!
root@tol-eressea:/media/plex-vintage# exit
russ@tol-eressea:~$ Connection to tol-eressea closed by remote host.
Connection to tol-eressea closed.

And now we prove success...

~/Downloads $ ssh tol-eressea
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-48-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sat Aug 15 14:11:55 MDT 2015

  System load:  0.35                Processes:           334
  Usage of /:   16.5% of 277.59GB   Users logged in:     0
  Memory usage: 1%                  IP address for p4p1: 192.168.0.101
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

Last login: Sat Aug 15 13:34:16 2015 from gondolin.site
russ@tol-eressea:~$ cd /media/plex-vintage/
russ@tol-eressea:/media/plex-vintage$ ll
total 12
drwxrwxrwx 1 root root 4096 Aug 15 13:51 ./
drwxr-xr-x 4 root root 4096 Aug 15 13:34 ../
drwxrwxrwx 1 root root    0 Aug 15 13:50 Music/
drwxrwxrwx 1 root root    0 Aug 10 14:50 $RECYCLE.BIN/
drwxrwxrwx 1 root root 4096 Aug 15 13:51 Videos/
russ@tol-eressea:/media/plex-vintage$ /home/russ/bin/diskspace.sh
.
.
.
Filesystem on disk: /media/plex-vintage (device: /dev/sdf1)
   Total disk size: 1.9Tb
        Used space: 413Gb (23%)
        Free space: 1.5Tb
Filesystem on disk: /plex-movies (device: movies)
   Total disk size: 1.8Tb
        Used space: 530Gb (29%)
        Free space: 1.3Tb
Filesystem on disk: /plex-television (device: television)
   Total disk size: 3.6Tb
        Used space: 550Gb (16%)
        Free space: 3.1Tb

Attaching a USB 3 disk to Ubuntu Server, second try

Attaching the external USB 3 disk worked, but as it had an NTFS filesystem, it would not remain mounted, even with an entry in /etc/fstab.

The first thing I tried was to set up for chron to check every 5 minutes, rediscover then remount the disk. This didn't work perfectly because ultimately, the disk would disappear anyway.

So, I decided to copy the disk contents (video files being used on my Plex Media server) elsewhere, reformat the drive to ext4, then copy the files back and remount it on the system.

Here's what I had to do. I ended up having to change filesystem permissions in imitation of other Plex Media files before Plex would stop labeling the content from this disk as "Unavailable."

root@tol-eressea:/plex-movies# blkid
/dev/sda1: LABEL="movies" UUID="17302323605392653091" UUID_SUB="15394959432617986808" TYPE="zfs_member"
/dev/sdb1: LABEL="movies" UUID="17302323605392653091" UUID_SUB="14639891384711792792" TYPE="zfs_member"
/dev/sdc1: UUID="195fdacc-4891-4250-a901-241b655387b1" TYPE="ext2"
/dev/sdc5: UUID="5JtzN6-u6QS-Nju1-uDs5-N1Ml-WGIi-PJgOcX" TYPE="LVM2_member"
/dev/sdd1: LABEL="television" UUID="3759371443983060498" UUID_SUB="9705470060758384852" TYPE="zfs_member"
/dev/sde1: LABEL="television" UUID="3759371443983060498" UUID_SUB="11200378628305314885" TYPE="zfs_member"
/dev/sdf1: LABEL="plex-vintage" UUID="af8defec-2a88-4178-9744-f756b813a527" TYPE="ext4"
/dev/mapper/tol--eressea--vg-root: UUID="359c69e9-fe56-4403-94e0-0ef569518263" TYPE="ext4"
/dev/mapper/tol--eressea--vg-swap_1: UUID="87631cc8-248e-424b-a9dd-d93ee2ec74ca" TYPE="swap"
root@tol-eressea:~# mount /dev/sdf1 /media/plex-vintage
root@tol-eressea:~# cd /media/plex-vintage
russ@tol-eressea:/media/plex-vintage$ ll
total 44
drwxr-xr-x   6 russ russ  4096 Sep  3 19:27 ./
drwxr-xr-x   4 root root  4096 Aug 15 13:34 ../
drwx------   2 russ russ 16384 Sep  3 18:56 lost+found/
drwx------ 181 russ russ 12288 Sep  3 17:55 Movies/
drwx------  10 russ russ  4096 Aug 29 22:41 TV/
drwx------  12 russ russ  4096 Aug 15 13:51 Videos/
russ@tol-eressea:/media/plex-vintage$ chmod -R g+rwx *
russ@tol-eressea:/media/plex-vintage$ chmod -R a+rx *
russ@tol-eressea:/media/plex-vintage$ ll
total 44
drwxr-xr-x   6 russ russ  4096 Sep  3 19:27 ./
drwxr-xr-x   4 root root  4096 Aug 15 13:34 ../
drwxrwxr-x   2 russ russ 16384 Sep  3 18:56 lost+found/
drwxrwxr-x 181 russ russ 12288 Sep  3 17:55 Movies/
drwxrwxr-x  10 russ russ  4096 Aug 29 22:41 TV/
drwxrwxr-x  12 russ russ  4096 Aug 15 13:51 Videos/

I also made a new entry in /etc/fstab in place of the old one given above.

UUID="af8defec-2a88-4178-9744-f756b813a527"  /media/plex-vintage    ext4   auto   rw   user   0   0

Keeping the USB 3 disk mounted on my Ubuntu Server

Unfortunately, the above didn't get me all the way home. So, I wrote a cron script, which runs every so often, to look for and remount the drive if necessary.

#!/bin/sh
# Determine whether the plex-vintage USB drive is mounted and, if not, mount it.
# This is needed because this drive is formatted NTFS, which will not remain
# permanently mounted.
VOLUME_LABEL="plex-vintage"
I_AM_ROOT=`echo $EUID`

if [ "$I_AM_ROOT" = "0" ]; then
  echo
else
  echo "You must have root privileges to run this script."
  exit
fi

# ------------------------------------------------------------------------
# Don't do this: even when the disk is not mounted, it is in this list!
# Find our volume among those known to be mounted...
#found_plex_vintage=`cat /proc/mounts | grep /media/plex-vintage`
#
#if [ -n "$found_plex_vintage" ]; then
#	echo "/media/plex-vintage is mounted"
#	exit 0
#fi
#
## The volume is no longer mounted....
# ------------------------------------------------------------------------

# Determine what device the OS has assigned...
block_id=`blkid | grep $VOLUME_LABEL`
device=`echo $block_id | awk '{ print $1 }'`

if [ -z "$device" ]; then
	echo "The volume is unknown"
	exit 2
fi

# Isolate the exact device name...
device=`echo $device | sed 's/://'`

echo "plex-vintage is mounted on device $device"

# Mount the volume again on the new device...
echo "Mounting the volume on the new device..."
echo "# mount $device /media/plex-vintage"

mount $device /media/plex-vintage

# vim: set tabstop=2 shiftwidth=2 noexpandtab:

And here's the crontab script:

#!/bin/sh
# Every 5 minutes, run this script:
*/5 * * * * /home/russ/bin/mount-if-needed.sh

However, for some reason, even this doesn't work. So, whenever I think of it, or my father tells me it's off-line, I ssh in and run this script.

In the end, this never worked. The disk never remained on-line.