Score:1

How can I auto mount a SSD on boot

cn flag

I have 3 NVME M2 internal ssd's in my system, only the main SSD auto mounts. The other 2 I have to manually right click on them and choose mount for my gaming program Lutris to access it.

How can I auto mount this linux formatted, single partition, non-shared physical hard drive on boot?

my 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).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=22e96bf2-fade-463d-8cc8-479247def942 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=E8A3-41F6  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

This is from $ sudo blkid for the "STEAM" M2 SSD I wish to auto mount:

/dev/nvme2n1p1: LABEL="STEAM" UUID="39c64773-f637-41ee-b8ca-1439b61426b0" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6b754125-761a-43a0-9592-c00ad3e55b26

Would the answer be to edit/add to my fstab with this line?

/dev/sda /mnt/steam ext4 defaults, 0 0

or do I need to add this command?

UUID=39c64773-f637-41ee-b8ca-1439b61426b0 /mnt/steam ext4 defaults 0 0

or this command?

UUID=39c64773-f637-41ee-b8ca-1439b61426b0 /mnt/steam auto nosuid,nodev,nofail,x-gvfs-show 0 0

I understand there are many options depending on what a user wants to do. In keeping with simplicity first, I only wish to auto mount a internal solid state hard drive, keeping all other default settings the same as the system is working after I mount it manually. Thank you all for your time and patience learning linux.

Taking all your kind advice, this is my edited fstab tested with mount -a

# /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).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=22e96bf2-fade-463d-8cc8-479247def942 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=E8A3-41F6  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
UUID=39c64773-f637-41ee-b8ca-1439b61426b0 /mnt/steam ext4 auto,nosuid,noatime,nodev,nofail,errors=remount-r,x-gvfs-show 0 0
waltinator avatar
it flag
Read `man mount fstab`. The "`auto`" option on the SSD's line in `/etc/fstab` will tell the system to mount it at startup. BUT if the SSDs are shared with Windows, Windows with "Fast Boot" may render the SSDs unmountable, and cause your Ubuntu boot to hang trying to mount them.
sudodus avatar
jp flag
What file systems are there on the problematic SSDs? Do you keep them connected all the the time, or do you want to 'hotplug' them (connect and/or disconnect them while the computer is running)?
Monkeyknife avatar
cn flag
The problematic nvme SSD is linux formatted single partition used for data storage. I would like the primary linux/ubuntu ssd and my data ssd named STEAM to be mounted at all times. They are internal M2 nvme type drives and not hot swap-able. I have a third nvme in my system build with a Windows 11 OS that does not need auto mounted.
oldfred avatar
cn flag
If you read the comments at top of fstab, it suggests using UUID. Drive order can change, so /dev/xxx may not always be the same. I use these options with my internal NVMe drive `nofail,noatime,errors=remount-r`. With NVMe drives, noatime is suggested for most uses.
sudodus avatar
jp flag
1. Use the UUID; 2. use the file system (not auto); 3. I rely on oldfred's advice about options; 4. The last two fields can be 0 0 for non-OS file partitions. -- When you have a Linux file system, it is OK to have the top level owned by root. Use sudo to create subdirectories and give them suitable ownership and permissions and store your files 'down there' without needing sudo.
sudodus avatar
jp flag
@Monkeyknife, you edited your question, but did not tell if the new line in `/etc/fstab` works like you want it to work. Are you satisfied now, or are there still problems, in that case what problems?
Monkeyknife avatar
cn flag
I initially showed no issues when tested with mount-a, then when I opened the ssd on reboot, it failed to open giving a general error. However when I re-edited fstab with the exact command listed in my edited fstab today, it worked perfectly. Does my command line look ok or did I make a mistake? tyvm sudodus 4 the follow up
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.