2024-08-16, 03:12 PM
(This post was last modified: 2024-08-18, 01:34 AM by TheDreadPirate. Edited 6 times in total.)
So, just a short primer on what fstab is. It's a text file that Linux reads on boot with the parameters for all of the disks you want mounted.
The first parameter is the disk you want mounted. A lot of people use the /dev/sd* identifier, but that letter at the end can shift if you change what SATA or NVMe port the disk is attached to. So the /dev/disk/by-id/ directory provides a true unique ID to ensure the drive is always correctly identified and mounted. The "wwn" ID.
The second parameter is where in the file system you want the drive mounted. This is arbitrary. You can mount a drive anywhere. But you have to make sure that the directory exists already and is empty.
The third parameter is the file system on that disk. In this case it says "Linux filesystem" (almost certainly ext4).
The fourth are the mount options. This is a bit advanced, but "defaults" is what we'll be putting in and is fine for locally attached drives. If you have a NAS and need to mount a network share in Linux, you would need to provide more than just "defaults".
The fifth (0 or 1) and sixth fields (0, 1, or 2) are switches are for advanced uses, both will be 0 for this.
Now we are going edit /etc/fstab.
Now copy and paste this line to the bottom of the fstab file. You can change the second field (the mount path). You currently have your drive mounted at /media/rich/Red6. You can keep it there if you want or have it mounted somewhere else. Just make sure that the folder you want to be at A) exists and B) is empty. I'd recommend moving it out of /media/rich and mounting in a new directory in /mnt or /media. I mount mine at /media/library, but do whatever you'd like. "mkdir" is the command to make new folders.
Save and quit.
Regardless whether you keep it in the same place or not, we are going to unmount it and then re-mount it with the new parameters.
Unmount from the current location.
Then re-mount it.
This command reads in the fstab file and mounts all the drives defined in it.
Backing up a little bit, your question about ACLs. In Linux there are "basic" permissions and then ACLs (access control lists). Basic permissions are what you see when you type "ls -l" on the command line.
ACLs override the basic permissions and add more advanced and flexible capabilities for power users with complex, multi-user, access requirements. And can even work with Windows Active Directory (with the aid of the SSSD service).
But pretty much nobody on this forum really needs that functionality and should stick with basic permissions (chown, chmod). However, most Linux distros will auto-mount drives you haven't defined in fstab in /media/yourUser/driveName and put an ACL on /media/yourUser. ACLs are denoted by the + at the end of the permissions.
This is why I recommended you mount the drive outside of /media/rich. So you don't have to worry about an ACL coming back on /media/rich the next time you plug in a thumb drive or something.
The first parameter is the disk you want mounted. A lot of people use the /dev/sd* identifier, but that letter at the end can shift if you change what SATA or NVMe port the disk is attached to. So the /dev/disk/by-id/ directory provides a true unique ID to ensure the drive is always correctly identified and mounted. The "wwn" ID.
The second parameter is where in the file system you want the drive mounted. This is arbitrary. You can mount a drive anywhere. But you have to make sure that the directory exists already and is empty.
The third parameter is the file system on that disk. In this case it says "Linux filesystem" (almost certainly ext4).
The fourth are the mount options. This is a bit advanced, but "defaults" is what we'll be putting in and is fine for locally attached drives. If you have a NAS and need to mount a network share in Linux, you would need to provide more than just "defaults".
The fifth (0 or 1) and sixth fields (0, 1, or 2) are switches are for advanced uses, both will be 0 for this.
Now we are going edit /etc/fstab.
Code:
sudo nano /etc/fstab
Now copy and paste this line to the bottom of the fstab file. You can change the second field (the mount path). You currently have your drive mounted at /media/rich/Red6. You can keep it there if you want or have it mounted somewhere else. Just make sure that the folder you want to be at A) exists and B) is empty. I'd recommend moving it out of /media/rich and mounting in a new directory in /mnt or /media. I mount mine at /media/library, but do whatever you'd like. "mkdir" is the command to make new folders.
Code:
/dev/disk/by-id/wwn-0x50014ee00419ce97-part1 /media/rich/Red6 ext4 defaults 0 0
Save and quit.
Regardless whether you keep it in the same place or not, we are going to unmount it and then re-mount it with the new parameters.
Unmount from the current location.
Code:
sudo umount /media/rich/Red6
Then re-mount it.
Code:
sudo mount -a
This command reads in the fstab file and mounts all the drives defined in it.
Backing up a little bit, your question about ACLs. In Linux there are "basic" permissions and then ACLs (access control lists). Basic permissions are what you see when you type "ls -l" on the command line.
Code:
chris@rat-trap:/media/library$ ls -l
total 391
drwxr-s--- 135 chris jellyfin 135 Aug 9 17:21 Anime
drwxr-s--- 80 chris jellyfin 80 Aug 1 13:30 'Anime Movies'
drwxr-s--- 13 chris jellyfin 39 Apr 29 09:48 'Anime Music Videos'
drwxr-s--- 68 chris jellyfin 68 Apr 26 17:05 'Audio Books'
drwxr-s--- 4 chris jellyfin 4 Aug 24 2023 Comics
drwxr-s--- 5 chris jellyfin 5 Aug 8 18:07 jellyfinBackup
drwxr-s--- 7 chris jellyfin 7 Aug 7 16:26 'JP Live Action'
drwxr-s--- 3 chris jellyfin 3 Aug 9 17:55 'Korean Movies'
drwxr-s--- 2 chris jellyfin 3 Feb 11 2024 liveTV
drwxr-s--- 23 chris jellyfin 32 Apr 29 09:48 Manga
drwxr-s--- 177 chris jellyfin 177 Aug 9 11:52 Movies
drwxr-s--- 121 chris jellyfin 199 Jul 30 10:52 Music
drwxr-s--- 2 chris jellyfin 280 Aug 11 16:39 'Music Videos'
drwxr-s--- 44 chris jellyfin 44 Mar 7 2023 'Old Time Radio'
drwxr-s--- 30 chris jellyfin 30 Aug 9 13:43 'TV Shows'
drwxr-s--- 2 chris jellyfin 2 Aug 13 19:13 wip
ACLs override the basic permissions and add more advanced and flexible capabilities for power users with complex, multi-user, access requirements. And can even work with Windows Active Directory (with the aid of the SSSD service).
But pretty much nobody on this forum really needs that functionality and should stick with basic permissions (chown, chmod). However, most Linux distros will auto-mount drives you haven't defined in fstab in /media/yourUser/driveName and put an ACL on /media/yourUser. ACLs are denoted by the + at the end of the permissions.
Code:
rwxr-xr-x+
This is why I recommended you mount the drive outside of /media/rich. So you don't have to worry about an ACL coming back on /media/rich the next time you plug in a thumb drive or something.