Getting a partitioned nvme drive to be accessible in Linux

Darc Sceptor

Active Member
Joined
Oct 2, 2024
Messages
112
Reaction score
40
Credits
1,240
I have two nvme drives on a mini-computer -- the system drive is 512 G and the other is 2TB. I have Windows and Linux Mint installed on the small drive with the big one for use by Steam. I found that Steam had problems accessing the drive even though I formatted it as exFAT so I wiped it clean and repartitioned it -- half for Windows (NTFS) and half for Linux (ext4). The problem I have is that even though I can mount the linux partition without a problem, I have to be root in order to write to the partition.

I did some digging around...checking the flags and other things but I cannot get that partition to be writeable without being root.
Can someone tell me what I did wrong and how to fix it?
 


You just have to use the "chown" command to make the files on the mounted partition owned by your user so you write as your user to those files. Something like this.
Code:
chown darc:darc -R /mnt/Games
Replace "darc" with your username and "/mnt/Games" with the actual location where you have your games partition mounted.
 
Wow, I never heard that command before!
 
Okay, I opened the terminal, ran the command, and it said I could not change ownership!
Now what?
 
UPDATE: well, I found how to run terminal as root. I then ran the command and got no error. But I still cannot write to the disk.
Strange yet, when I do an ls -l it show darc darc.
 
Last edited:
UUID=5a8bf537-d8d2-4761-bac6-dd415569ce2b / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme1n1p1 during installation
UUID=2E21-9FEC /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
/dev/disk/by-uuid/F654-2D79 /mnt/F654-2D79 auto nosuid,nodev,nofail,x-gvfs-show 0 0


When I ran the command I used dev/nvmen1p2 for the device
 
To be honest, I have no idea what that is. I definitely have never seen any UUID anywhere in the UI with anything I've touched. It is the second partition so ... maybe?
 
Share the exact command when you ran the "chown" command?
 
chown michael:michael -R dev/nvmen1p2

by the way: when I float the mouse over that drive the dev/nvmen1p2 is the name that is displayed.
 
Last edited:
Okay you lost me there. What is the difference between dev/nvmen1p2 and this "mount path"?
I don't have anything installed and running under Linux yet because that drive is where all my games need to go. So I have no location where my Steam games are located. That is what I'm trying to access now.

Thanks for your help and hope we can solve this....but this kind of pain is why only people like me move to Linux. In Windows you just create a partition and access it.
 
but this kind of pain is why only people like me move to Linux. In Windows you just create a partition and access it.
This doesn't sound like a Linux problem just a difference of how things work.

I found that Steam had problems accessing the drive even though I formatted it as exFAT so I wiped it clean and repartitioned it -- half for Windows (NTFS) and half for Linux (ext4). The problem I have is that even though I can mount the linux partition without a problem, I have to be root in order to write to the partition.
Here you said that you created a partition and created an ext4 filesystem on it, but I guess you created the partition from Windows and haven't created an ext4 filesystem on it yet? With Windows you first create a partition and when formatted with ntfs it automatically assigns it a drive aka mount point.

You can just search for the disk manager in your menu, select the partition, format it with ext4 and then choose a location to mount it. It's not complicated, just different workflow. And if I remember correctly with the disk manager if you don't set a custom path for mounting it will use the default one.

Also learning a new os is going to take time and will be a learning progress, nothing you know in life you knew without learning, not even how Windows works. And Linux is different from Windows so don't expect Linux to work the same.
 
Also, with the OP's
chown michael:michael -R dev/nvmen1p2

...it was missing a forward slash before the dev, and a 1 with the drive,eg

dev/nvmen1p2 should be /dev/nvme1n1p2

Cheers

Wizard
and welcome, Michael
 
Okay I went through it once more. I made terminal root, I did the CHOWN command. I did type chown michael:michael -R /dev/nvme1n1p2 and when I accessed the drive with my file manager I could not create a new folder for Steam.

And the process I used to create the partition was I calculated how much half the drive was, I went into Windows because it is easier there. I deleted the existing partition and created a new partition (NTFS) for Windows and I left the second partition undefined. Then I went into Linux, I rant GPARTED and created the second partition and formatted it ext4.
 
Then I went into Linux, I rant GPARTED and created the second partition and formatted it ext4.
Did you also tell the disk manager to mount the "/dev/nvme1n1p2" partition, can you share the output of the following?
Code:
lsblk -f
I don't think it is because it wasn't listed in your /etc/fstab. That's not a problem since you can still that.
 
Yes, sir, it was mounted. Linux Mint does make it easy to see when a drive is mounted or not.
It is mounted and I can see it under "Other". Everything seems to be able to "see" the drive but it is always in read-only mode. And after taking ownership it still is read-only.
 
Linux is NTFS compatible. So AFAIK, you could just have a "Linux" and "Windows" folder for each OS. All one partition. I'm not super familiar with Steam as I'm not much of a gamer, but I see no reason for separate partitions.

That said, based on what you want, let's start anew because I want to make sure it's done right (for my sanity). Backup everything on your partition first... I mean it; we're going wipe it and start fresh. You acknowledge that by proceeding...

I'm going to assume you have the correct partition and your username is michael (mentioned earlier).

Code:
$ mkdir /home/michael/SteamLibrary/
# mkfs.ext4 -L steamlinux /dev/nvme1n1p2
# cp /etc/fstab /etc/fstab.bkp_2024-10-03
# blkid /dev/nvme1n1p2
Note down the "UUID".
I'd love to give you a copy+paste into your terminal so you don't have to manually edit the next bit, but I'll probably forget an escape character here, a closing quote there... So I won't risk that.
Code:
# nano /etc/fstab
Now you find where the UUID or "/dev/nvme1n1p2" is listed. Search with ctrl+w. Delete a line by pressing ctrl+k. There should only be one mention of it. Save with ctrl+o and exit with ctrl+x.
Next (I can give you a copy+paste):
Code:
# echo "LABEL=steamlinux                                       /home/michael/SteamLibrary/             ext4     defaults,user,exec              0       0" >> /etc/fstab
And that's it. It should show up in your file manager within a second or two. If not, just run:
Code:
$ mount /home/michael/SteamLibrary
You should be able to mount/unmount as a normal user from you file manager. If it requests the root password to mount, it'll only be this time. After each subsequent boot it'll be automatically mounted.

  • Obviously you can change the names and locations as you require
  • Note down each step you took in case something goes wrong. But you should have no issues.
  • For anyone wondering, I use LABEL in fstab for data partitions because UUIDs can change across formats, resizing, etc... But mainly it looks neater as is more maintainable, just don't reuse labels (no I'm not going don the UUID vs LABEL debate hole).
 
Everything is backed up on Steam Cloud services.
So if I take your suggestion, create a single NTFS partition, and have the folders for Windows and Linux, does that change any of the commands above?
 


Follow Linux.org

Members online


Latest posts

Top