How to mount an ext4 on an external drive as rw?

I have made an ext4 filesystem on an external harddrive, that I want to use as a build drive. But I can’t mount it as rw. Even when I use mount -w, I still can’t write on it.

With FAT filesystems I don’t have these problems. I wonder why it happens with ext4…

do you get errors when you use fsck on the external hard drive partition?

Do you mount it as user or as root?
When you mount it as root you need to give rwx permissions on the root directory of it for your user account to be able to write on it.

1 Like

ext4 has file permissions, FAT has not.

https://forum.manjaro.org/search?q=mount%20write%20partition%20status%3Asolved

4 Likes

Add a record for the filesystem to /etc/fstab and make sure that the mountpoint for the filesystem has write permission for yourself.

If this is a system-wide mount, then the mountpoint will typically be root-owned and then by default, you won’t have write permission on that unless you change the permissions and/or ownership of the mountpoint. In addition to that, ext4 is a POSIX filesystem, which uses permissions and ownership metadata for every individual file. FAT-based filesystems don’t store any such information, and in that case, the information is faked in the virtual filesystem layer of the kernel at mount time, and discarded again when the filesystem is unmounted.

If this filesystem is to be used in your user account only, then set the mountpoint to a directory under your $HOME.

Required reading…: :arrow_down:

man mount
man fstab

I made a mount point in my home folder, created an fstab entry and mounted it there. At first it worked. Then I got IO errors, but since then I can automount it with rw. No idea why…

That means you are mounting it as root… see my suggestion :arrow_heading_up:

Refer to this post: Mount a external hard drive with execute permissions

This is basically the same advice i gave in Reply #3 :arrow_heading_up: :wink:

1 Like

The solution actually doesn’t work. I was just marking something as solution because I didn’t have time to solve it and was feeling bad because so many people replied. Anyway, when I try to chown, I get a bunch of messages like

chown: Changing own of 'directory': The file system is read-only

You might have missed that part.

Thats why i said “basically” meaning “in essence” :wink:

Could you provide the exact command you used and filesystem type where that directory is mounted?
It would also help to provide the command/config you used to mount the drive…

Actually he is right, I made a typo on command, I put %USER instead of $USER

Here is the corrected version
sudo chown -R $USER:$USER /run/media/user/directory
Again, replace “user and directory” with your path.

It doesn’t work. I think I got a general problem here. I realized that all my USB sticks and SSDs are mounted as read-only

Can you paste the contents of /etc/fstab?

Being unable to write to them as a user does not mean it is mounted r/o, you should check as root

Anyway lets start from the base and ask more info about your computer etc:

My fstab looks normal. I don’t think it has something to do with it.

# /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>
UUID=3AD2-9AC0                            /boot/efi      vfat    umask=0077 0 2
UUID=a2f3e649-9263-4ff5-a6cb-047f0b645cb7 /              ext4    defaults,noatime 0 1
UUID=7c399a75-036d-4bf9-9bba-751536bb90b3 /home          ext4    defaults,noatime 0 2

I think there is a mixed problem here. One of my USB keys has definitely crapped out. For the others I managed to get access by reformatting them. When I run into problems again, I will let you know.

@TriMoon There were no suspicious messages when running dmesg, that is why I didn’t post it.

I don’t recall (or can see in any reply) that i asked for that output…
But anyhow just like you can’t know what is inside other’s heads, no one can in return know about your hardware in details.
That’s why providing info that seems irrelevant to you, but is recommended in that link i provided, will help others to help you better.
If people need extra info they will ask for it on top of that info :wink:

2 Likes

@TriMoon Thank you for this valuable advice then.