Cannot write to secondary HDD

I recently used KDE Partition Manager to reformat a HDD from ntfs to ext4. After formatting the HDD I remounted it back to my media folder. However I cannot write or move any files into it. What did I do wrong? Can anyone help me out?

What permissions and ownership does the mountpoint have? If you want it mounted at /media ─ which is a root-level directory and which as such is not normally intended to be written to by users ─ then the directory itself will normally be owned by root:root and the permissions would typically be something like drwxr-xr-x. That means that it's only writable to the root account.

So, if you want to stick with that mountpoint and you want to be able to write to it, then I would advise you to change the ownership of /media to squitwert:squitwert ─ or whatever your local user name is ─ or else change the ownership to root:squitwert and the permissions to drwxrwxr-x.

For the first possibility... :arrow_lower_left:

sudo chown squitwert:squitwert /media

For the second possibility... :arrow_lower_left:

sudo chown root:squitwert /media && sudo chmod 775 /media

I have it mounted to/media/Ent

I tried the first command and nothing changed. I tried the second command and I got sudo chown root:wired /media $$ sudo chmod 775 /Media/Ent chown: cannot access '/media': No such file or directory chown: cannot access '40473': No such file or directory chown: cannot access 'sudo': No such file or directory chown: cannot access 'chmod': No such file or directory chown: cannot access '775': No such file or directory

First of all, this...
:arrow_down:

... tells me that you did not issue the command as I have told you to issue it. You substituted the double ampersand ("&&") between the two commands for dollar signs ("$$").

Secondly, You didn't say that it was mounted at /media/Ent, you said that it was mounted at /media There's a difference.

So let's try this again. Issue this (:arrow_down:) command, assuming that wired is the name of your user ─ if it isn't, substitute it for your user's actual name...:

sudo chown -R root:wired /media/Ent && sudo chmod -R 775 /media/Ent

P.S.: It would have been a lot easier if you had chosen to mount it under your $HOME directory somewhere. In a UNIX system, the users are only supposed to have write access to their own $HOME, as well as to /tmp and /var/tmp.

My bad man, I am new to all this. I ran the command [wired@BigBertha ~]$ sudo chown -R root:wired /Media/Ent && sudo chmod -R 775 /Media/Ent

It went through but I cannot write to it. Should I try rebooting to see if that fixes it? Is there some sort of way I can remount them in my $HOME directory?

If you supplied the command as you've pasted it here, then it will of course not have worked, because now all of a sudden you are referring to /Media/Ent instead of to /media/Ent. GNU/Linux is case-sensitive.

Yes, of course, and given that you are treating this as a single-user system, that would be the preferred option.

First of all, you'd need to unmount the filesystem from /media/Ent. Then you must create a directory in your $HOME ─ e.g. /home/wired/data ─ and mount it there. And if you want the same result after rebooting, then you're going to have to add a record for this filesystem in /etc/fstab.

Let's suppose that this secondary HDD has one partition on it, and that it is /dev/sdb1 ─ change this to the correct partition if needed.

Now, edit /etc/fstab as follows... :arrow_lower_left:

sudo nano /etc/fstab

Add a line for the filesystem like this... :arrow_down:

/dev/sdb1  /home/wired/data  ext4  defaults  0  0

Save the file by pressing Ctrl+O and exit the editor with Ctrl+X. This will make sure that the mount will persist across reboots. :wink:

I added the line

Screenshot_20200517_221541

I also reformatted seeing if I could fix it somehow that way and I still can't write to my HDD. It seems I don't have the permissions to write to it. Any way you know how to fix this?

First of all, there's another typo in there. There's a double zero at the end of your last line.

Secondly, are you sure that /dev/sdb1 is the correct partition?

Try taking the ownership of the mount point and see if it will work:

sudo chown wired:wired /home/wired/data

I fixed the typo and still nothing has changed. Also yes sdb1 is the correct one Screenshot_20200518_004004

I tried your command before you deleted it. I got this message:

chown: cannot access '/home/wired/data': No such file or director

Did you create a directory named data before?

Also a / is missing at the beginning of the line you add to fstab. Better to use its UUID.

Please post the terminal output as text formatted by clicking the </> button and not screenshot.

According to your screenshot, your partition is now mounted at /media/entertainment. :roll_eyes:


I told you to create that directory first. :man_facepalming:

Okay, do this... :arrow_down:

mkdir ~/data
sudo umount /dev/sdb1
sudo mount /dev/sdb1 /home/wired/data

I want to apologize for being a moron no I didn't but I did was Aragon told me then I went back and ran the command you told me to run sudo chown wired:wired /home/wired/data and that fixed it! Thank you for bearing with me!

2 Likes

Thank you for helping me step by step I did what you said and what Marte said. Thank you for bearing me with me! Truly a life saver!

2 Likes

Actually, no. Not to brag, but there was no mountpoint /home/wired/data yet until I told you to create one, and in creating that directory, it would automatically beget yourself as owner, given that you were creating it as yourself, and in your home directory. By consequence, that chown command had no effect.

The two commands I gave you below the one that created the mountpoint then made sure that your partition was mounted in the right place, because it wasn't ─ see your last screenshot.

This should be the case, one would think. However I just created an EXT4 partiton with Gparted and mounted it (both via terminal and then via fstab) at a directory called TEST under my home. Strange thing, I couldn't have write access to it,

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by