Results 1 to 8 of 8

Thread: ext4 external partition read only

  1. #1
    Join Date
    May 2014
    Location
    Duncan BC
    Posts
    42

    Default ext4 external partition read only

    I have formatted an external partition with ext4 and am unable to write to it without Super Dolphin. How does one change permissions (and labels if possible)?
    I have tracked down enough cli to get this far...
    Code:
    mount|grep /dev/sdb4
    /dev/sdb4 on /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
    Thank you kindly,

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,742

    Default Re: ext4 external partition read only

    Well, the mount is rw, so that is OK then.

    Then we come down to every days Unix/Linux ownership and permissions of directories/files. Who is the owner and what are the permissions of /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad? And what are the owner and permissions of what is in that directory (if there is something) and who wants to create what file where?

    Code:
    ls -ld /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad
    ls -l /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad
    for the first two questions.

    And you could show that you can not write there by e.g.
    Code:
    touch /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad/something
    And please when you post computer text here, do so including the prompts (before and after), so that we can see who did what from where and that it is complete.
    Last edited by hcvv; 18-May-2018 at 08:53.
    Henk van Velden

  3. #3
    Join Date
    May 2014
    Location
    Duncan BC
    Posts
    42

    Default Re: ext4 external partition read only

    Quote Originally Posted by hcvv View Post
    Well, the mount is rw, so that is OK then.

    Then we come down to every days Unix/Linux ownership and permissions of directories/files. Who is the owner and what are the permissions of /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad? And what are the owner and permissions of what is in that directory (if there is something) and who wants to create what file where?

    Code:
    ls -ld /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad
    ls -l /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad
    for the first two questions.
    1. drwxr-xr-x 9 root root 4096 May 16 17:28
    2. total 72
    drwxr-xr-x 5 root root 4096 May 14 12:05 <blank>
    drwxr-xr-x 3 root root 4096 May 14 16:31 blend files
    drwxr-xr-x 3 root root 53248 May 13 19:57 Music
    drwxr-xr-x 17 root root 4096 May 14 12:00 Pictures
    drwxr-xr-x 5 root root 4096 May 15 05:38 SmallProgs Linux
    drwxr-xr-x 3 root root 4096 May 12 16:33 Videos
    And you could show that you can not write there by e.g.
    Code:
    touch /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad/something
    3. touch: cannot touch '/run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad/test.txt': Permission denied
    And please when you post computer text here, do so including the prompts (before and after), so that we can see who did what from where and that it is complete.
    Not sure what you mean.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,742

    Default Re: ext4 external partition read only

    Quote Originally Posted by Scorpa54 View Post
    1. drwxr-xr-x 9 root root 4096 May 16 17:28
    2. total 72
    drwxr-xr-x 5 root root 4096 May 14 12:05 <blank>
    drwxr-xr-x 3 root root 4096 May 14 16:31 blend files
    drwxr-xr-x 3 root root 53248 May 13 19:57 Music
    drwxr-xr-x 17 root root 4096 May 14 12:00 Pictures
    drwxr-xr-x 5 root root 4096 May 15 05:38 SmallProgs Linux
    drwxr-xr-x 3 root root 4096 May 12 16:33 Videos

    3. touch: cannot touch '/run/media/drew/6bf099e8-75ed-4e46-83da-60b58994e4ad/test.txt': Permission denied

    Not sure what you mean.
    To start with the last:
    There is an important, but not easy to find feature on the forums.

    Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

    Example:
    Code:
    henk@boven:~> ls -ld test
    drwxr-xr-x 23 henk wij 4096  2 apr 14:15 test
    henk@boven:~>
    =======================

    Then back to your problem.
    As you can see, all that is there is owned by user root (and group root) and there is no permission for other users to write there. So your observation is correct.


    But this means that your original description
    I have formatted an external partition with ext4 and am unable to write to it
    is not complete. After you (in this case meaning: root) has created the ext4 file sytem, you (again as root) have created directories like Music and Pictures there, which you did not tell.

    So what is this file sytem to be for? When it is for the use of user <user> (strange name), then you should have that user do all the creating. Or now you can go and change the ownership of what is already there:
    Code:
    cd /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad
    chown -R <user>:users *
    When this mass storage device is to be on your system normaly (not by incident), then my advice would be to choose another place for mounting it and configure it in /etc/fstab.
    Henk van Velden

  5. #5
    Join Date
    May 2014
    Location
    Duncan BC
    Posts
    42

    Default Re: ext4 external partition read only

    Quote Originally Posted by hcvv View Post
    Then back to your problem.
    As you can see, all that is there is owned by user root (and group root) and there is no permission for other users to write there. So your observation is correct.


    But this means that your original description

    is not complete. After you (in this case meaning: root) has created the ext4 file sytem, you (again as root) have created directories like Music and Pictures there, which you did not tell.
    I was trying to drag folders there and discovered that the only way to do this was from Super Dolphin.

    So what is this file sytem to be for? When it is for the use of user <user> (strange name), then you should have that user do all the creating.
    It's use is for backup of files. <user> is me being secretive.

    Or now you can go and change the ownership of what is already there:
    Code:
    cd /run/media/<user>/6bf099e8-75ed-4e46-83da-60b58994e4ad
    chown -R <user>:users *
    I could cd without a problem, the chown failed with "Permission denied"

    When this mass storage device is to be on your system normaly (not by incident), then my advice would be to choose another place for mounting it and configure it in /etc/fstab.
    You've lost me here. The partition is on a 2T external drive, one of three. sdb2 - mac format, sdb3 - encrypted and sdb4 - the one I would just like to backup to.
    And thanks for your help by the way.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,742

    Default Re: ext4 external partition read only

    Quote Originally Posted by Scorpa54 View Post
    I was trying to drag folders there and discovered that the only way to do this was from Super Dolphin.
    You should decide who is the owner of the files there. And when you tell you want to put backups of files there, you should decide who is making the backups.

    When it is root that is doing this for the users (maybe only the user <user>), then root should own the mount point and do the copy while keeping ownership and permissions (e.g. cp -a). I do not know what Dolphin "in superuser mode" exactly does. Try to avoid using such GUI programs as root. And it should definitely be mounted elsewhere.

    When it is the user <user> that does make his/her own backups, the mount point can be used and Dolphin can be used also (I would prefer a backup script though). But then user <user> must own everything there. And that is where the chown is for.

    Quote Originally Posted by Scorpa54 View Post
    It's use is for backup of files. <user> is me being secretive.
    When you think that is needed. But we can only use <user> because we do not know what it really is and you have to translate everything.

    Quote Originally Posted by Scorpa54 View Post
    I could cd without a problem, the chown failed with "Permission denied"
    Please copy/paste as I explained above. We want to see things, not your description about what you think you saw.
    You probably did this as <user> and not as root, but we can not tell because you did not show us what you did. Of course it should be done as root, because, as tyou have found out already, <user> can not do very much which files it does not won.

    Quote Originally Posted by Scorpa54 View Post
    You've lost me here. The partition is on a 2T external drive, one of three. sdb2 - mac format, sdb3 - encrypted and sdb4 - the one I would just like to backup to.
    And thanks for your help by the way.
    You mean you have three partitions there (no sdb1?) That is OK.
    As said above, when it is user <user> that makes the backup (and restores), that is fine. <user> plugs in the device and the desktop will offer him/her to use the file manager on it. Then <user> can drag to and from. All fine, But <user> must then be the owner of those directories.


    And some advice.
    Please try to understand how a multi-user / multi-session operating system like Unix/Linux functions. Users must be protected from each other. Thus concepts like ownership (by user and by group) and permission granted to owner, users in the same group and other (the world) to files. There is plenty of course material on the internet.

    Also try to understand that stories like "I did this" and "I can not write" is of not much use. The Linux system does not know that "I" (you), it only knows about users defined on the system. So it is user <user> that does something and user root may do something different, but it is never "I".
    Henk van Velden

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,562

    Default Re: ext4 external partition read only

    Quote Originally Posted by Scorpa54 View Post
    You've lost me here. The partition is on a 2T external drive, one of three. sdb2 - mac format, sdb3 - encrypted and sdb4 - the one I would just like to backup to.
    Within the top level directory of the external drive, regardless of how you mounted it, with the user "root" and with a CLI (Konsole terminal) create a directory to be used by you; with the user "root", change the owner and the group of that newly created directory to your username and your group:
    Code:
     # mkdir «A suitable directory name»
     # chown «Your user name»:«Your group -- usually "users"» «A suitable directory name»
    Done.

    Example: a DVD-RAM, ext2 UNIX®/Linux file system, mounted via the KDE Plasma devices widget:
    Code:
     > mount
    /dev/sr1 on /var/run/media/xxx/XXX_EXT2 type ext2 (rw,nosuid,nodev,relatime,block_validity,barrier,user_xattr,acl)
     > 
     > cd /run/media/xxx/XXX_EXT2/
     > ls -al
    total 20
    drwxr-xr-x  4 root   root   2048 Jun 21  2017 .
    drwxr-x---+ 3 root   root     60 May 18 21:02 ..
    drwxr-x--T  3 xxx xxx_Group  2048 Jun 21  2017 Backup_xxx
    drwx------  2 root   root  16384 Jun 21  2017 lost+found
     >
    The user 'xxx' who is a member of the 'xxx_Group' (not the "normal" group named 'users') can read and write within "their" directory on that DVD-RAM.
    Other members of the group 'xxx_Group' can read the directory's contents; the rest of the user world not …

    Welcome to the power of UNIX® and Linux user groups and file and directory ownerships.

  8. #8
    Join Date
    May 2014
    Location
    Duncan BC
    Posts
    42

    Default Re: ext4 external partition read only

    Quote Originally Posted by hcvv View Post
    You probably did this as <user> and not as root.
    That I did, just following directions as laid out so I didn't bother using sudo which definitely worked, thank you for your patience.
    All is grand, thank you again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •