Usb disk not writable

Hi, I have an external usb harddrive and I cannot write on it. Commands chown and chmod does not even work returning that the file system is read only. Owner is presently user:autologin. What can I do in addition?
Thanks in advance.
Bilem

Then you can try to mount the drive with root.

autologin group is not a default group but an additional group used for that purpose

Assuming the user nomen is a substitute for your actual username?

Whether you can write to a device or not depends on the filesystem in question.

When you state the nothing can be change - I am guessing a ntfs formatted device.

If the last access was using Windows and the disk not ejected before shutdown it may be caused by Windows being shutdown in hibernation/sleep/fastboot mode.

For a ntfs formatted disk this will cause the filesystem to be mounted read-only when trying to access from Linux.

2 Likes

Thank you both.
@Keruskerfuerst. This provides me a short term solution.
@linux-aarhus. My disk is ext4 formatted.
My question would be: what can I do next in order that my disk mounts automatically in w mode when I plug it in?

This is a permission issue.

Linux permissions is user group other which then can be read write execute

execute is necessary to navigate into folders
read is necessary to read a file’s content
write is necessary to write a file’s content

If you are the only user of the disk assigning yourself as owner (recursively) will do the trick.

man chown

Usually a disk is mounted in the /run/media/$USER folder so navigating there and list the content - which would then point you to the mountpoint in use.

The $USER is a system environment variable holding the currently logged-in user.

echo $USER

The default mountpoint is the uuid but if you labeled the disk it will be the label

When you have identified the auto generated mountpoint

sudo chown -R $USER /run/media/$USER/mountpoint
1 Like
sudo chown -R $USER /run/media/$USER/mountpoint

Yes, I have tried this from the beginning. As I mentioned it returns that the file system is read only This is the same with the chmod command. Anyway, this is not a permanent solution if I have to redo a command every time I plug in the disk.

Install the Disks application:

sudo pacman -S gnome-disks

(Nevermind that it has ‘gnome-’ in the name, it works in most everything.)
Once installed, open Disks find your disk or partition → select it → and click the ‘Additional partition options’ below where your disk/partition is selected.

Choose ‘Take Ownership’ from the popup menu – Click OK.

The new permissions should take effect immediately, but a reboot may still be needed. You can perform other tasks such as editing mount options, by using a similar procedure with Disks.

This is a simple way to achieve your desired outcome. Hope it helps.

If your goal is also to have your disk available at each boot, please rephase your question, and ask about mounting your disk using an entry in the `/etc/fstab’ file. Someone will help if you spell out what you wish to accomplish; in greater detail. Cheers.

To be clear:
I have other disks that are immediately available for reading and writing as soon as I plug them in a usb port.
For this specific one, I have the problem described above.

I give up for the moment and will come back later. I don’t have time anymore to solve this issue because I have to leave for a few weeks.
Thanks and best regards.
Bilem

Apologies, I missed that it was a removable drive. Is formatting it as ‘exfat’ an option for you, or does it absolutely need to be ext4?

Then you have other problems with that disk - you just state usb disk - which could be anything.

Ensure it is not mounted - then run fsck /dev/sdy (where y is the actual device)

If that doesn’t do it - I suggest you go low level

sudo pacman -Syu gdisk
sudo sgdisk --zap-all /dev/sdy

Then create a new partition and reformat …

sudo sgdisk --mbrtogpt {device}
sudo sgdisk --new 1::: --typecode 1:8300 --change-name 1:'Linux filesystem' /dev/sdy
sudo mkfs.ext4 /dev/sdy1

If that doesn’t do it - consider if it is broken

Looks like he misunderstood that it was a one-time command that you gave.

Edit;- Ignore this; it was based on a misread comment.

Since nobody has thought of posting these two tutorials here yet, I’ll go ahead and toot my own horn again. :stuck_out_tongue:

Everything you need to know is explained in human language in these two tutorials below. Read them, study them, print them out, and put a copy on your bedside table. :stuck_out_tongue: :laughing:

And if you dual-boot with Microsoft Windows, then you must disable Fast Boot and Hybrid Sleep in Windows, because they leave your Windows filesystems in an open state, and then the Linux kernel will mount them read-only so as to prevent filesystem corruption.