Oh, my old nemesis, mounting secondary drives under Linux.

Hello, last night on a whim, I pulled the cord and finally am making a push to use Linux exclusively. I am not the most knowledgeable when it comes to Linux but I can hold my own enough.

EXCEPT when it comes to mounting drives and making them work with programs. I've gotten them wiped and mounted, but steam does not see them as internal drives and at each reboot, they or any games I put on there are gone from steam. They also do not show up with their names I've given them during formatting.

Would adding them to fstab fix some of these issues? I know they would at least be mounted before I ever open steam. So maybe there is a chance?

For more info, these are two Samsung 800 series SSD drives. One 250 GB, and the other 500 GB. These are games only SSDs as it's their only job.

I am on elementary OS version 7.

Any help will be very much appreciated. Thanks for anyone who takes the time to respond.

mrbigmouth502, (edited )
mrbigmouth502 avatar

I've gotten used to adding extra drives in fstab, myself. I do wish adding permanent secondary drives was a more straightforward process though. I understand the Windows approach of making them instantly accessible has security implications, but I feel like that's something distros could implement as an optional setting.

I think little things like this hinder Linux adoption among end users. The purists may cry foul at this idea, but I think there should be more and better GUIs for system management tasks, so users don't have to use the terminal or muck around editing text files as much.

EDIT: Apparently gnome-disk-utility might be a solution if you're looking for something more straightforward than manually editing fstab. I don't know whether it can do permanent mounts or not though.

EDIT2: Turns out gnome-disk-utility can create fstab entries, but it can't remove them if you've used it to delete a partition.

redcalcium, (edited )

Just some tip: if you’re not comfortable editing /etc/fstab directly, use gnome-disk-utility app to edit mount options from GUI.

mrbigmouth502,
mrbigmouth502 avatar

Can gnome-disk-utility set up permanent mounts? I've used it for other things before, but I've never used it to permanently mount a drive. If so, I wish I knew about that sooner.

Montagge,
Montagge avatar
mrbigmouth502,
mrbigmouth502 avatar

Neat! I usually edit things manually in fstab, but I'll have to keep this in mind for when I'm helping new users out, or if I just want to set up a drive quickly.

redcalcium,

Yes, if you check the “mount at system startup” checkbox, it’ll update fstab for you. My only problem was when deleting partitions on gnome-disk-utility, it doesn’t automatically delete the fstab entries it previously created. You’ll need to manually clean it up yourself. This might cause mount problem if you delete and recreate the partition with the same mount settings because there are now two fstab entry, where the first entry references partition that no longer exist.

mrbigmouth502,
mrbigmouth502 avatar

Good thing to be aware of. I usually edit fstab manually anyway, but this is worth knowing if I'm helping someone out.

mihnt,
mihnt avatar

I was fine editing it. Just wanted to be a bit more informed before I mess with system stuff. Too many distros out nowadays and it seems sometimes even the slightest misstep can sends things in the wrong direction way too easy.

BigVault,
BigVault avatar

I'd just like to say that this is where things like Google Bard/Bing Chat can really help you out if you're semi-competent but stuck.

Using the output from lsblk on one of my homelab machines I get the below:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 111.8G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 109.8G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 54.9G 0 lvm /
sdb 8:16 0 465.8G 0 disk
└─sdb1 8:17 0 465.8G 0 part /mnt/usbhdd1

Giving Bard the prompt "how do I mount my ext4 formatted usb hard drive to /mnt/usbhdd1 at boot in Ubuntu server."

Sure, here are the steps on how to mount your ext4 formatted USB hard drive to /mnt/usbhdd1 at boot in Ubuntu Server:

Identify the USB hard drive. Use the lsblk command to list all of the block devices on your system. This will show you the UUID of your USB hard drive.
Create a mount point. Use the mkdir command to create a directory where you want to mount your USB hard drive. In this example, we will use the directory /mnt/usbhdd1.
Edit the /etc/fstab file. This file contains a list of all of the filesystems that are mounted at boot. Open the file with your favorite text editor and add the following line:
Code snippet
UUID=YOUR_USB_HARD_DRIVE_UUID /mnt/usbhdd1 ext4 defaults 0 0
Use code with caution. Learn more
Replace YOUR_USB_HARD_DRIVE_UUID with the UUID of your USB hard drive.
4. Save the /etc/fstab file and reboot your system.

After your system reboots, your USB hard drive will be mounted to the directory /mnt/usbhdd1. You can then access the files on your USB hard drive from this directory.

Here are some additional notes:

The UUID=YOUR_USB_HARD_DRIVE_UUID entry in the /etc/fstab file is the most reliable way to identify your USB hard drive. If you do not know the UUID of your USB hard drive, you can use the blkid command to find it.
The ext4 filesystem type is the default filesystem type for USB hard drives in Ubuntu Server. If your USB hard drive is formatted with a different filesystem type, you will need to specify the correct filesystem type in the /etc/fstab file.
The defaults options in the /etc/fstab file tells the system to mount the filesystem with the default options. These options include mounting the filesystem read-write and enabling file system checking.
The 0 0 values in the /etc/fstab file tell the system to not check the filesystem for errors at boot and to not mount the filesystem in read-only mode.
I hope this helps! Let me know if you have any other questions.

bing chat:

To mount an ext4 formatted USB hard drive to /mnt/usbhdd1 at boot in Ubuntu server, you can follow these steps:

  1. Get device info: $ lsblk or $ sudo fdisk -l
  2. Create the mount point. In the example below, the mount point name is /mnt/usbhdd1. You can name it anything you want. $ sudo mkdir /mnt/usbhdd1
  3. Edit the /etc/fstab file and add the following line at the end of the file:
UUID=<UUID> /mnt/usbhdd1 ext4 defaults 0 0

Replace <UUID> with the UUID of your USB hard drive. You can get it by running $ sudo blkid /dev/sdX1, where X is the letter assigned to your USB hard drive.

After you save and close the file, you can run $ sudo mount -a to mount all file systems listed in /etc/fstab.

I hope this helps! Let me know if you have any other questions.

Either Bard/Bing Chat can be a real help when you have some idea on what to do but are stuck.

rastilin,

I'd use ChatGPT v4. It's been very helpful in my quest to get Linux set up.

PabloDiscobar,
PabloDiscobar avatar

If you want them mounted before you open steam then you should add them to fstab, it will become a condition for booting your machine.

$ ls -la /dev/disk/by-uuid/

Make sure you mount with the UUID, the UUID is permanent on a disk, unlike /dev/sdx.

blkid

Will also show you the mapping betwen UUID and disks.

So your fstab will look like this

UUID=7ca0dbbb-459d-4731-a3..... /boot ext4 defaults 1 2

Test if the uuid is correct before booting by mounting it manually in a random location like /mnt with

mount /boot

And see what happens.

falsem,

Fun fact the UUID can be changed and persists if you clone the whole block device

https://askubuntu.com/questions/132079/how-do-i-change-uuid-of-a-disk-to-whatever-i-want

nottheengineer,

You can use mount -fav to let it verify the fstab automatically. If it goes through without errors, you can do mount -a to apply the fstab without rebooting.

mihnt,
mihnt avatar

When I use blkid it is showing me the UUID and PARTUUID. I'm assuming I use the UUID over the PARTUUID?

PabloDiscobar,
PabloDiscobar avatar

UUID.

Remember that when a disk is mentioned in fstab, if the disk is not present at boot time then your machine will return an error. If you replace/swap your steam disks remember to comment this line in /etc/fstab until you have finished your maintenance.

mihnt, (edited )
mihnt avatar

Yes, thanks. They are mounted up at reboot.

edit: Now steam is giving a disk write error. Permissions?

When I was setting the drives up I set them with the command line "sudo chmod ugo+wx "/where/the/drive/ismounted"".
Was this not correct? Steam itself can write files as it's already setup the folder heirarchy, but when it attempts to download any game it throws a disk write error. When I check the permissions of the folders it working in it looks like the screenshot in this post.

RickRussell_CA,
RickRussell_CA avatar

Maybe add the recursive option to change all dirs?

sudo chmod -R ugo+wx "/where/the/drive/ismounted"
mihnt,
mihnt avatar

Would that be persistent for all files/folders created after the change is made? Or just existing files/folders?

PabloDiscobar,
PabloDiscobar avatar

You do a

chown -R myuser:mygroup /target

then a

chmod +rwx /target

so /target belongs to you and you can do anything you want in it. Who knows, maybe steam checks that only you has the privilege to read/write in it? (to protect your credit card information, registration keys, licenses... or whatever of value that could be in these folders? That would be a possibility that you have to take into consideration when money is involved. Anyway this is a safe and clean procedure to operate with mount points.

In the future your process steam will be run as yourself, writing and reading as if it was yourself, in a folder where he has all the rights to do so. Since he can only write files and folders as yourself there should be no problem anymore. So you will be fine.

RickRussell_CA,
RickRussell_CA avatar

The better solution on that second command (chmod) would be

chmod -R u+rwX /target


-R : recursive, affects all files and subdirectiories
u: current user (who just took ownership of everything with the previous command)
+rwX: add read access, write access for all files and directories. Adds execute (list/traverse) access for directories only

That covers existing files/directories and anything new.

Of course, if the permissions are all screwed up now, one might have to run these with sudo!

More generally, the permissions on all new files/dirs are controlled by the umask command:

https://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html

insomniac_lemon,
insomniac_lemon avatar

it will become a condition for booting your machine.

Personally, this is what I want to avoid (particularly for slower drives, though I leave the HDD unmounted most of the time) because booting isn't as fast as it should be already (mobo firmware), and I did see some info about passwordless mounting but it doesn't seem to make post-boot startup commands work properly.

Though luckily nothing much actually needs this, if I forgot to mount the SSD and open Steam I just close it and do that (in the past sometimes I've had to re-start Steam twice for it to take effect).

palordrolap,

If you're on a system that has GNOME-based gio, the command

gio mount $(realpath /dev/disk/by-uuid/UUIDHERE)

is a way of mounting drives as a user.

This is basically what the file manager(s) like Nemo / Thunar / Nautilus do under the hood when mounting drives because they use the gio subsystem.

The trick would be to ensure whatever launches Steam ensures the right gio commands are despatched before the main Steam executable.

The reason I'm suggesting gio is that if you're used to mounting drives using the file manager, it will put those drives in the same filesystem places that the file manager does, and it means that those drives aren't mounted until you need them if that's preferable.

e.g. on my system, drives are mounted at /media/USERNAME/DRIVELABEL.

Of course, as others point out, all of this can also be done old-school with fstab.

swartze,

Mounting via fstab will likely help. Make sure that your user has proper permissions on the directory that you mount the drive to. Steam is running as your user and won't be able to read/write to a directory (for example) owned by root with 755 permissions.

NettoHikari,

Yes, adding them to /etc/fstab will fix it. Since you’re asking if this would be a solution, I guess that you know how to add drives to fstab. If you need assistance, though, let us know.

mihnt, (edited )
mihnt avatar

Yes, I've been on and off using Linux since Mandrake was the go to distro so I've gotten some things written to memory but am by no means a master. lol

I ran across an article last night explaining the UUID thing and quickly grew tired enough to go to bed. Going to have to wrap my head around it at some though it seems as all these lovely comments are leaning that way.

tlf,

This depends on what you mean by mounting them. From what I understand the mount command functions to "temporarily" mount a drive that is not expected to be there at the next boot. Think of CD drives or USB sticks. fstab is a way of mounting drives persistently and should be used with drives that are permanently installed in the system.

The topic is likely more nuanced than that but working with this in mind did the trick for me.

PascalSausage,

Yeah, you’ll need to add entries for them to /etc/fstab if you want them to be mounted on boot, and make sure that Steam is pointed to the directory where they’re mounted.

Why do you mean by “Steam won’t see them as internal drives”?

mihnt,
mihnt avatar

It ignores their names and just labels them as external drives. As a reference, when I was running Nobara, it was not doing this. However, the drives were NTFS at the time. They've since been wiped and formatted to ext4.

Also, the mount point shown in the screenshot isn't their actual mounting point. Their actual mounting point is "/media/mihnt/250" and "/media/mihnt/500".

Johanno,

Mhh I am on nobara and had issues with ntfs drives permissions, but an exec in fstab fixed it.

Now I use an btrfs format. Worked flawlessly.

While my internal drive just works for my iscsi one i use this config

UUID=019a65de-5f1a-41e8-bf90-2333546375f8 /mnt/steam-library btrfs nofail,noauto,users,exec 0 0

average650,
@average650@lemmy.world avatar

If I'm understanding correctly, yes, adding them to fstab is what you need to do. That's what fstab is for.

GrumpyRobot,

Correct, just make sure to add them by UUID. Names (sda,sdb,sdc, ect) can change over time, and will eventually break your boot. Speaking from experience lol

average650,
@average650@lemmy.world avatar

Yes! Great point.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux
  • InstantRegret
  • ngwrru68w68
  • modclub
  • normalnudes
  • everett
  • rosin
  • Durango
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • Youngstown
  • osvaldo12
  • slotface
  • kavyap
  • JUstTest
  • mdbf
  • anitta
  • tacticalgear
  • cubers
  • tester
  • GTA5RPClips
  • khanakhh
  • ethstaker
  • provamag3
  • Leos
  • cisconetworking
  • megavids
  • lostlight
  • All magazines