Just Changed Second HDD To Ext4, Now I Can't Write Anything To It

ntfs
externalhdd
hdd
internal
ext4

#1

So I always used NTFS for my secondary hard drives due to sharing data with Windows, I’ve never used ext4. My NTFS 4tb WD Blue was showing some bad sectors so I decided to replace it with a Toshiba x300 5tb. This time I elected to use ext4 because I just don’t need Windows access to the drive. I set a GPT partition scheme and created a single ext4 partition on the drive using Gparted. The drive is mounted internally I don’t want the drive automounted at boot, I want to manually mount when I need it. Everything seemed fine after installing, but with one big issue…I can’t write anything to the drive. After extensive Googling, it’s apparently a permissions issue, but this is where my complete confusion comes in and I could really use some help setting this up correctly.

Question 1: Why does an NTFS formatted drive just “work” out of the box without changing any permissions to write to it?
Question 4: Apparently I need to chown the disk. But why didn’t I have to do that with an NTFS disk? How do I properly do this on Manjaro?
Question 3: Is there a different way to format to ext4 in Gparted and have it just work out of the box without having to change user permissions on the OS? This would be important if I want ext4 formatted external drives that bounce from computer to computer. I thought using ext4 would be better, but if I have to manually own the drive on every computer I attach it to, it seems like more work than it’s worth.

Any help with answering all of my questions would be a big help. Thanks.


#2

This has been covered a few times on the forum, but here we go:

NTFS does not support Linux file system permissions so is mounted to be read-write by the current user.

As above.

sudo chown /path/to/disk/mountpoint

No. Disks are by default writable only by the root user, and it’s up to the root user to set permissions.

If the UID is the same on each machine then you don’t have to. Otherwise, you can set write-access for a common group (e.g. users) then anyone in that group will be able to read and write files.


#3

Thanks @jonathon, I know it’s been posted several times, but the information is so fragmented that getting clarification on details is difficult. Big thanks for making it all clear to me. Right now “mount” shows this as my mountpoint:

/dev/sdc1 on /run/media/cn/5TB Toshiba type ext4 (rw,nosuid,nodev,relatime,stripe=8191,uhelper=udisks2)

Can you verify the correct chown command for me?:
sudo chown /dev/sdc1
or
sudo chown /run/media/cn/5TB Toshiba (also, if this is the command do I need an underscore in the blank space "5TB_Toshiba?)


#4

Also do I need to add the “R” (recursive) option in there too along with my username before the mount point?
sudo chown cn -R /run/media/cn/5TB Toshiba
Is this correct? Also unclear on if I need an underscore after 5TB.


#5

You normally want to avoid spaces in filenames. It can create all sorts of issues. You normally deal with spaces by enclosing in "quotation marks" (the other way is to escape spaces by a\ backslash but that’s much more difficult to read).

In this case, you want to run:

sudo chown $USER "/run/media/cn/5TB Toshiba"

This will set your user as the owner of the drive root (top-level directory).

chown -R is only necessary if you want to take ownership of all files/directories below the identified path.


#6

There it is. That worked perfectly. Big Thanks. What’s strange is this info seems to be common knowledge among most seasoned Linux users, but if you don’t know it, the information out there is very different from forum to forum so it’s difficult to figure out without guidance. Out of all of my searches, not one came up with the command the way that you wrote it. The key thing being the $USER after chown. The question I asked is such a common question that it’s asked in every distro forum, but all have varying methods to accomplish what seems to be a simple goal. That command you just gave me should be highlighted in the wiki with some explanation as to how and why it works.

Out of curiosity, if I decided to automount in fstab, ownership could not be specified there correct? I would still need to chown an ext4 drive regardless of whether or not it’s automounted at boot? Or can fstab give the user write permissions as well?


#7

There is couple of tutorials for mounting your extra drive.


#8

Yeah, I came across these. Both aren’t in the actual wiki, and like I said earlier they have contradicting actions and commands. It seems when it comes to mounting/owning/automounting there are many ways to go about it and the methods vary depending on the user posting and the desired result. This is one of the most fragmented searches for such a “simple” task. I think that the Manjaro heads should agree upon the best method for doing said action and hard print it in the Wiki as “the best” method with a sub-script explaining the variations of the methods and why they may be useful. @jonathon’s method was very simple, contained the $USER command (which detects the current user and inputs it, rather than the multitude of initial ownership commands that are optional), assumes that the drive is mounted or has been mounted by the system (which is what most will encounter, so there’s no need to manually create random directories), and simply applies ownership of the drive/partition to the user. Also in this particular scenario, @jonathon added in the proper way to define a directory that’s labeled with a “space” in it when working in the terminal by adding quotes. To top that off, a simple reason to not include the -R command was also given, where in my research many answers to this same question all call for the -R in forum posts, which ultimately will lead to new learners scratching their heads.

This is a scenario where “it’s been posted a thousand times” does not apply because it’s a scenario where yeah it’s been covered, but the coverage is far from consistent. There’s certainly NOT a thousand posts describing the same command/method.


#9

There is really no way of standardizing advice on mounting drives. There are too many possibilities. Which drive mount location, which file system, auto mounted in fstab, or mounted on access. SSD drive or platter drive. I could go on for along time about mount options because there are a ton of them.

One size definitely does not fit all.


#10

Care to elaborate?

I mean if these posts can be improved in any way why not do it?


#11

I was referring to general Google searches for the question I had. Basically the fragmentation is not limited to Manjaro, but across all other distro’s/forums. It’s a question that’s asked often too, because there are a ton of search results for it. For example, Googling “can’t write to ext4 drive linux” the first search result is from the Ubuntu forums (https://ubuntuforums.org/showthread.php?t=1334840) that clearly states to add the -R to the ownership command, which as it turns out is completely unnecessary because chown’ing the full mount point is top level and doesn’t require the recursive option. This is further compounded by the overall ownership command varying, the mount point varying, and the overall approach varying by different user methods. I feel as though some actions that are considered “simple” may be assumed to be understood to seasoned users, while if you’re unaware of the answer, finding it is not simple (due to the fragmentation of the answers). The 2 links given above in this post right here in the Manjaro forums both also contain mismatched information with directions including manually creating mount points and taking ownership of them via group entries, variations on the actual ownership command, fstab entries that may or may not actually be needed. Those are just a few examples, but as @tbg stated the possibilities are endless depending on what your specific needs are. There’s gotta be a better way to simplify or create a wiki post that outlines all the variations and why the methods vary so much. I “think” the information in this post is the most accurate and what most general/new Manjaro users would be looking for, but again that’s open to interpretation.

I would love to re-write a wiki entry clearing the information up, but as I just learned the method I would need to understand further all of the variables and reasons for all of the different approaches before I could make an accurate wiki entry. The main goal is to make the Manjaro forums/wiki as accurate as possible to make these types of things easier to find and understand for those in search of the answer.


#12

It is absolute necessary to understand that in some case you need the recursive argument especially when talking about disks coming from other systems which might have the data created by a different UID.

Otherwise you would only have access to the root of the disk - not the content.

This fact is one of the reasons which as stated earlier it is almost impossible to create a one-size-fits-all answer - it will all depend on the circumstances.

The $USER is on Linux the variable always describing the currently logged in user.


#13

Exactly. So many different approaches. So basically the -R is required if it’s a disk that’s already got data on it, that you’ve added to your system and want your user to be able to write to all parts of the disk. While the -R is not needed if it’s a new disk that you’ve just added to your system. Did I understand this correctly? Also, the $USER entry I just learned about in this thread. Very cool information, and again a variation on the commands required. So many approaches and options, where it can be difficult trying to figure it out if your just learning it. Luckily most users are pretty great here on the Manjaro forums…imagine me asking this in the Arch forum!! HAHAHAH.


#14

Yes

Yes

Indeed

It would be like commiting suicide :slight_smile: