We all have to do it from time to time. I’m creating this post so I can stop looking for a trusted source. I don’t add a second or third hard drive to my KDE Neon (Linux) desktops often enough to commit it to memory, and let’s face it, things have changed over the years.
I will assume you already have physically installed your drive and formatted it the way you want.
roland@roland-HP-EliteDesk-800-G2-SFF:~$ sudo mkdir /media/Data
roland@roland-HP-EliteDesk-800-G2-SFF:~$ sudo chown roland:roland /media/Data
roland@roland-HP-EliteDesk-800-G2-SFF:~$ sudo chmod +rw /media/Data
roland@roland-HP-EliteDesk-800-G2-SFF:~$ sudo apt-get install libblkid1
Years ago we used to create the mount point under /mnt. Today the preferred method is under /media. Come on, admit it. If you are an old timer you’ve even created the mount point at root. I labeled my drive “Data” when I formatted it to ext4 so I created the mount point as /media/Data.
Technically the chown command is
sudo chown [user]:[group] /media/Data
I wanted the drive to be owned by me because eventually I will be using the entire thing for a PostgreSQL database as part of another post series I really am working. I know, life and clients end many of my coding post series early. Either that or they get so involved I turn them into a book in my The Minimum You Need to Know book series. You also need to turn on Read Write privs which what the chmod command does.
The next thing you need to do is install libblkid1. Yes, there are other ways to identify the UUID but this utility is the current trend.
roland@roland-HP-EliteDesk-800-G2-SFF:~$ sudo blkid
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda1: UUID="DE4D-6645" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="1069be1a-bbde-4bef-97b0-657f14575d37"
/dev/sda2: UUID="9a3dc19b-fee9-4575-8d06-c77b00eb800c" TYPE="ext4" PARTUUID="c4cd47b7-2cb6-45f8-a546-828253162291"
/dev/sdb1: PARTLABEL="Microsoft reserved partition" PARTUUID="eae2381f-c7fc-45ab-952f-7af47a1535f5"
/dev/sdb2: LABEL="Seagate Backup Plus Drive" UUID="50C02DC2C02DAF62" TYPE="ntfs" PTTYPE="atari" PARTLABEL="Basic data partition" PARTUUID="c39930ea-d9d0-4956-b196-100b6e95bc3c"
/dev/sdc1: LABEL="Data" UUID="f1848754-cf08-4553-bf8e-33ec61693eab" TYPE="ext4" PARTUUID="1de73a93-bef6-3243-8419-ce262b3ca58f"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop12: TYPE="squashfs"
/dev/loop13: TYPE="squashfs"
/dev/loop14: TYPE="squashfs"
/dev/loop15: TYPE="squashfs"
/dev/loop16: TYPE="squashfs"
/dev/loop17: TYPE="squashfs"
/dev/loop18: TYPE="squashfs"
/dev/loop19: TYPE="squashfs"
/dev/loop20: TYPE="squashfs"
You can see my system currently identifies the disk as /dev/sdc1. Years ago we used to use /dev/sdc1 when creating entries in /etc/fstab. You can tell from the labels that the drive identified as /dev/sdb is my external Seagate Backup Plus Drive that is connected via USB3. Given that removable drives are now part of the standard device path most Linux distros have migrated to UUID values. A firmware update or a missing external drive used to play Hell with configurations. If I remove my external drive and reboot my new internal drive will end up as /dev/sdb and that would hose a manually edited /etc/fstab.
roland@roland-HP-EliteDesk-800-G2-SFF:~$ sudo jed /etc/fstab
You can see how I added the line to the end of /etc/fstab
To make things easier for you here it is:
UUID=f1848754-cf08-4553-bf8e-33ec61693eab /media/Data auto rw,user,auto 0 0
In theory you can just mount it now. Best to test with a reboot though. When you rebooted after installation, especially with KDE Neon, Dolphin will have identified the drive and created an entry in itself based on the label. The auto qualifier will cause the drive to mount at boot. The first auto qualifier is for the format. I could have chosen to use ext4 because that is how I formatted the drive. This is better only because it is a big spare drive I will use for multiple projects which may require reformatting from time to time.
Honestly, even after reboot I had to go back in and do the following
As a final test I used Dolphin to create a directory