Mounting a Second Internal Drive in Linux

The other day I put a 250GB SSD in the current desktop unit and made it the primary. I wiped the (now) secondary 1TB hard drive and left it be until I had time to mess with it. Yesterday I finally finished the much needed update of The Minimum You Need to Know Web site so I played with getting the second drive to auto mount just a bit.

In theory we shouldn’t need to know any of this. Linux Lite and most other YABUs (Yet Another uBUntu) have a “Disks” utility which is supposed to remove the arcane knowledge requirement.

Only one problem. The “Disks” utility was crashing fast an furious trying to mess with the second drive. It couldn’t/wouldn’t successfully finish formatting and had other issues. GParted was able to correctly partition and format the drive, but the right mouse button menu kept the “mount” option grayed out.

I dutifully opened a terminal and obtained my UUID.

roland@roland-HP-Compaq-8100-Elite-SFF-PC:~$ blkid
/dev/sda1: UUID="b139e4e7-6d46-4d44-bbe4-7bf83189550a" TYPE="ext4" PARTUUID="00086f66-01"
/dev/sda2: UUID="c124b156-cc2d-4f7d-8bab-74a0c31b033f" TYPE="swap" PARTUUID="00086f66-02"
/dev/sdb5: LABEL="MyData" UUID="58948af6-866b-49a1-9986-1c0a8b4aac53" UUID_SUB="757cbc5e-10c0-4640-a63b-e8a4b8df9c5c" TYPE="btrfs" PARTUUID="9c786281-05"

I dutifully created a mount point.

sudo mkdir mnt/data

I dutifully edited /etc/fstab and copied the primary drive line and edited it for my other drive.

UUID=b139e4e7-6d46-4d44-bbe4-7bf83189550a /               ext4    errors=remount-ro 0       1
UUID=58948af6-866b-49a1-9986-1c0a8b4aac53 /mnt/data       auto    errors=remount-ro 0       1

This is what my foggy brain remembered, but when I rebooted, I could not create a directory or file on the drive. I vaguely remembered hitting this problem once before. Admittedly it has been a long time since I stacked drives inside a case. For the past 5+ years I’ve been like most others, buying external USB and networked drives. I would imagine the “Disks” utility hasn’t been tested with a second internal drive in years just like my knowledge of how to do this.

Rebooted and created a shortcut in the File Manager by navigating to /mnt then dragging the folder icon to a spot under “Places.” (Not a very intuitive thing since most such tools have “create shortcut” on the right mouse button menu.) I clicked away on the new shortcut and we navigated there. Then I right clicked in the big empty space to see “create folder” and “create file” were both grayed out. &^$%&^%$&*^%

I did some poking around and found some well meaning yet fruitless advice. I even changed /etc/fstab to use parameters suggested in a few posts.

UUID=58948af6-866b-49a1-9986-1c0a8b4aac53 /mnt/data       auto    defaults,users,noatime,nodiratime 0 0

No joy in Mudville. On a whim I started doing some ls -al directory listings on /mnt/data and finally /mnt then the answer hit me between the eyes. I forgot to change the owner of /mnt/data.

sudo chown roland:roland /mnt/data
ls -al /mnt
total 24
drwxr-xr-x  3 root   root   4096 Mar  9 08:04 .
drwxr-xr-x 24 root   root   4096 Mar  9 08:02 ..
drwxr-xr-x  1 roland roland    8 Mar  9 08:52 data

Once again, this is a post so I don’t have to remember this stuff anymore. Given the false methodology known as Agile and the reliance on Test Driven Development (TDD) using “automated tests” under Jenkins or some other “tool” it is doubtful there will be any actual testing of Linux desktops in the future. I certainly don’t expect anyone to fix the “Disks” utility so it can properly handle a second internal hard drive. Tablets and most laptops don’t have two, therefore, it won’t be tested.