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

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.

I’m a total noob, but I have the same problem. I formatted an external 1TB drive to use for backups and general storage.

I did what @TriMoon suggested,by typing:

The result was:

chown: changing group of '/run/media/bash/backup/timeshift/snapshots/2021-07-24_07-00-10/localhost/usr/share/man/man3/CURLOPT_FNMATCH_FUNCTION.3.gz': Bad message

I already used the drive to make Timeshift backups.

Sorry for bringing back an old thread.

Hi Ping, the “-R” will change the ownership and permissions of every file and folder, (recurring) but files in snapshots from Timeshift or BackInTime you don’t want to change them.

So in your case, assuming that "backup" is the mounted drive in the user “bash” directory, then you can just omit the -R like so;

sudo chown $USER:$USER /run/media/bash/backup

Ideally, this is best done before the drive is used. Go to /run/media/yourusername/ and create your directory, then run the command above.
Then once the empty directory is created and given the proper permissions, and the drive set to UUID as in the link above. Everything should work perfectly.

Hi, @DeLinuxCo . I tried what you mentioned, but I still can’t make it write to the drive directly. When I check permissions on the folder properties on the drive, they still say they’re in the root group and access is read only.