The officially official Devuan Forum!

You are not logged in.

#1 2024-02-29 21:49:10

Deze
Member
Registered: 2021-10-17
Posts: 15  

[SOLVED] Changing permissions on external drive

Hi,
An external ext4 formatted media drive has switched to read-only. I suspect a cheap usb hub is the culprit.
In Nautilus as Administrator, i can't change permissions, 'Error setting permissions: Read-only file system'

$ sudo chmod g+w /media/user/UUID

and reboot doesn't fix it.
Reformatting the drive would be a hassle. Are there other commands?


Devuan GNU/Linux 5 (daedalus) x86_64

Offline

#2 2024-02-29 22:46:26

Dutch_Master
Member
Registered: 2018-05-31
Posts: 282  

Re: [SOLVED] Changing permissions on external drive

There might be something else going on you probably don't realize. Do the following:

su #become root, alternatively sudo su
fsck /media/<user>/<UUID> #check the file system for errors and repair if required
chown <user> /media/<user>/<UUID> #make sure the directory is owned by the user
chmod 777 /media/<user>/<UUID> #set permissions for the directory for general access

HTH!

Offline

#3 2024-03-01 18:55:02

Deze
Member
Registered: 2021-10-17
Posts: 15  

Re: [SOLVED] Changing permissions on external drive

Thank you.

# fsck /media/<user>/<UUID>

Returns error message:
fsck.ext2: Is a directory while trying to open /media/<user>/<UUID>

The superblock could not be read or does not describe a valid ext2/ext3/ext4

Commands:

# e2fsck -b 8193 <device> 
# e2fsck -b 32768 <device>

Error message:
e2fsck: Is a directory while trying to open /media/<user>/<UUID>

Gparted shows 2 partitions:
1. File system ext4
Flags: msftdata
2. File system 1 mb unallocated
No flags

Are these settings ok for a media drive?


Devuan GNU/Linux 5 (daedalus) x86_64

Offline

#4 2024-03-01 19:25:38

rolfie
Member
Registered: 2017-11-25
Posts: 1,167  

Re: [SOLVED] Changing permissions on external drive

To clarify: Have you replaced the placeholder <user> with your username? And the placeholder <UUID> with the correct UUID of the device?

Maybe you show us with the drive connected:

# blkid
# lsblk

Then: the unallocated space is fine. But why does the ext4 file system have a msftdata flag, a Windows descriptor?

Offline

#5 2024-03-01 22:03:50

Deze
Member
Registered: 2021-10-17
Posts: 15  

Re: [SOLVED] Changing permissions on external drive

rolfie

To clarify: Have you replaced the placeholder <user> with your username? And the placeholder <UUID> with the correct UUID of the device?

Yes, i replaced <user> and  <UUID> with the correct names, i double-checked with # blkid and # lsblk.

In Gparted i formatted the new WD Elements drive as ext4. I don't remember enabling the msftdata flag. Disabling the flag isn't possible, the key icon in the Partition column probably indicates the drive is locked. I can open files, copying files to the drive and editing isn't possible.

I have no clue how this switch could have happened. Just format the thing?

Thanks.


Devuan GNU/Linux 5 (daedalus) x86_64

Offline

#6 2024-03-02 18:57:52

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,482  

Re: [SOLVED] Changing permissions on external drive

It's locked because it's mounted. Right-click on it to unmount.

Any time I've used fsck, I've done it on an unmounted device, like /dev/sdb1 for example. I just tried running it on a mounted filesystem, using the directory, and I got the same error you got about superblock.

Offline

#7 2024-03-03 10:37:31

delgado
Member
Registered: 2022-07-14
Posts: 210  

Re: [SOLVED] Changing permissions on external drive

@#1
In case the partition is mounted read-only (ro):
Altering the permissiion of the directory to read-write is not enough. The partition must be re-mounted read-write (rw) as well.

First check the output of mount to see whether this applies at all. (sticking to /dev/sdb1 as example)

$ mount
$ sudo mount -o remount,rw /dev/sdb1

Open question to answer is still: Why was the partiton mounted read-only at all?
Re-mounting the partition rw manually is curing a sympotom - if the real reason allows this at all.

Offline

#8 2024-03-03 17:33:02

chris2be8
Member
Registered: 2018-08-11
Posts: 306  

Re: [SOLVED] Changing permissions on external drive

Look in /etc/fstab to see if it has an entry.

Check dmesg output and syslog for messages about the device or the mountpoint.

Try e2fsck -n <device> (-n means read only so should work for mounted devices). If that shows errors you need to *umount* the device, then run e2fsck <device> (specify the device, not the mountpoint).

Offline

#9 2024-03-23 16:58:03

Deze
Member
Registered: 2021-10-17
Posts: 15  

Re: [SOLVED] Changing permissions on external drive

Fixed.

$ sudo umount /dev/sdb1
/dev/sdb1: recovering journal
/dev/sdb1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Invalid inode number for '.' in directory inode 112197682.
Fix<y>? yes
Pass 3: Checking directory connectivity
'..' in /.Trash-1000/files/[file names]), should be /.Trash-1000/files/[file names].
Fix<y>? yes
/lost+found not found.  Create<y>? yes
Pass 4: Checking reference counts

Pressed y to all q's

/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****

Read & Write restored 🙏
The new lost+found folder contains files that i had moved to Trash.
There's a new .Trash-1000 folder that contains .trashinfo file in the info folder. When i delete the file it replicates and adds a .trashinfo extension. I'll let it be.

Permissions problem was easier to fix than it looked, thank you for your help!

Last edited by Deze (2024-03-23 16:59:08)


Devuan GNU/Linux 5 (daedalus) x86_64

Offline

Board footer