NVMe storage (not boot) drive is being recognized as an external drive?

Hello, everyone!

I have yesterday rebooted Manjaro with the Cinnamon distro. Installation ran off smoothly as always, I booted into the system, then formatted my second nvme drive (storage only) as ext4, mounted it to ~/Storage, then added UUID to /etc/fstab, then ā€˜sudo mount -aā€™ and rebooted. Even though this drive is both recognizable and usable by the OS and permanently mounted to ~/Storage, it still appears as a removable drive, which causes a bit of confusion with my actual removable drives. Itā€™s not too big of a problem, but it would be nice if I could make it so that Manjaro just recognizes it as a permanent storage drive, not allowing me the option to remove it. Just a small quality-of-life change, but that would look cleaner to me.

Can someone help please?
Thank you.

An advise from a sysadmin for life

Remove the line from your fstab and save the file and unmount the device

sudo umount /home/$USER/Storage

Then create a folder in root

sudo mkdir /a/storage
sudo chown $USER:$USER /a/storage

Create a file

cat /etc/systemd/system/a-storage.mount

[Unit]
Description=Storage partition

[Mount]
What=/dev/disk/by-uuid/<your-uuid>
Where=/a/storage
Type=ext4
Options=defaults,rw,noatime

[Install]
WantedBy=multi-user.target

The enable and start the unit

sudo systemctl enable --now a-storage.mount

Symlink the mountpoint into your home

ln -sf /a/storage ~/storage
3 Likes

Add x-gvfs-hide to the options at fstab and it will be hidden in the file manager.

1 Like

I do something similar with an fstab entry:

``UUID=xxxxxxxx /media/archiv ext4 defaults,noatime,nofail,nosuid,x-gvfs-hide 0 2`

where the UUID must be determined beforehandā€¦

Or use a Bind mount. I have many of them, myself. But itā€™s up to you.

1 Like

Whoa, thanks everyone! Those are all very helpful suggestions. Iā€™ll get right on them :slight_smile:

@linux-aarhus I do have a question though, why do you feel its best to put a second storage drive outside of home directory, and directly under root? I used to think of home as being mostly storage anyway, even though this storage drive would also host applications, come to think of itā€¦ whatā€™s your take?

I have found that using Gnome Disks, works well, for this.

Select your drive:

Select Mount Options from the gear icon:

Then disable User Sessions Defaults, select Mount at startup and uncheck Show in user interface.

Iā€™m having trouble implementing these suggestions. Iā€™m following them to a tee, as best I can, but Iā€™m getting an error when trying to enable the a-storage.mount command. Just to be sure, I unmounted the unit:

sudo umount /dev/nvme1n1

then I reformatted it:

sudo gdisk /dev/nvme1n1

I zapped it (expert mode, then z), and next, I ran:

sudo cgdisk /dev/nvme1n1

then, I formatted it as 8300 type drive, and named it Storage. I mkfs.ext4 for that drive:

sudo mkfs.ext4 /dev/nvme1n1p1

When it was done, I created the /a/Storage folder:

sudo mkdir /a
sudo mkdir /a/Storage
sudo chown -R vicente:vicente /a/Storage

then I created the file:

sudo nano /etc/systemd/system/a-storage.mount

I copy-pasted your text, substituting in my UUID for the storage unit after formatting:

lsblk -f
...
ā””ā”€nvme1n1p1
     ext4   1.0         2f58a9e4-6d3c-4222-ba66-3b43b5e9c0dc
[Unit]
Description=Storage partition

[Mount]
What=/dev/disk/by-uuid/2f58a9e4-6d3c-4222-ba66-3b43b5e9c0dc
Where=/a/Storage
Type=ext4
Options=defaults,rw,noatime

[Install]
WantedBy=multi-user.target

Ctrl+O and Ctrl+X, then I tried enabling the service:

[vicente@ROG-Laptop a]$ sudo systemctl enable --now a-storage.mount
Failed to start a-storage.mount: Unit a-storage.mount has a bad unit file setting.
See system logs and 'systemctl status a-storage.mount' for details.
[vicente@ROG-Laptop a]$ systemctl status a-storage.mount 
ā—‹ a-storage.mount - Storage partition
     Loaded: bad-setting (Reason: Unit a-storage.mount has a bad unit file setting.)
     Active: inactive (dead)
      Where: /a/Storage
       What: /dev/disk/by-uuid/2f58a9e4-6d3c-4222-ba66-3b43b5e9c0dc

feb 10 18:07:40 ROG-Laptop systemd[1]: a-storage.mount: Where= setting doesn't match unit name. Refusing.
feb 10 18:28:47 ROG-Laptop systemd[1]: a-storage.mount: Where= setting doesn't match unit name. Refusing.

So, after all of this, what am I doing wrong here? I have no ideaā€¦ I have reviewed all steps multiple times, but I donā€™t see if I made a mistake along the way. Can you please help?

Thank you.

The correct filename would be -a-storage.mount. So try again with that.

I remember this is something I struggled with, as well. See:

https://unix.stackexchange.com/a/345518

Also see:

[root tip] [How To] Use systemd to mount ANY device)

and

An, to me, this: :point_down:

ā€¦doesnā€™t look right, as you canā€™t mount a disk, or ā€œdriveā€. Only partitions ON a disk/ā€œdriveā€ can be mounted, and NVMe partition paths look like:

/dev/nvme0n1p1

Take a look here, itā€™ll help a lot:

2 Likes

The unit-file must be named exactly as the mountpoint - Linux file-systems are case sensitive - and systemd is case sensitive.

if mountpoint is /a/Storage the unit-file must be named a-Storage.mount

Please see the following guides on using systemd mount units

1 Like

Well, technically, what you mount is neither a partition nor a disk/drive, but a filesystem.

It is possible to use an HDD or an SSD without partitions by directly formatting them with a filesystem ā€” just as back in the days of the floppy disk ā€” but you wouldnā€™t be able to boot from it, because the BIOS boot process requires there to be a distinct MBR, and the EFI boot process requires there to be a designated EFI system partition. :wink:

OKā€¦

But for us normal plebsā€¦ this makes my head hurt. And I just thought Iā€™m getting a grip on thingsā€¦

So, this would only be useful in the case of storage? And it sounds kind of advancedā€¦

Yes, exactly.

It is actually done quite often in enterprise environments. Technically, you could do it with a relatively simple filesystem type such as ext4, but it is most commonly used with very advanced filesystems such as btrfs or zfs, as well as with old-school volume managers such as LVM. :wink:

2 Likes

Wow, this solution works perfectly! =D thank you all so much!

no one needs to know how many times i tried doing this thing, and that i ended up completely reformatting my whole system just so i could start fresh and give it another try, but hey, now itā€™s working perfectly, so i can just say that and omit the rest, right? right?

Thanks again, everyone.

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.