Announcement

Collapse
No announcement yet.

SOLVED: Could someone talk me through step by step about USB ext4 ownership and permissions?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SOLVED: Could someone talk me through step by step about USB ext4 ownership and permissions?

    For example do you Chown/Chmod the mount point or the drive itself? Do you unmount then mount during any of these process's? I am getting different versions of the steps. What happens if you Chown/Chmod the wrong spot, terminal seems ok with either place? Here are two that I have had most success with.
    sudo chown -R $USER:$USER /mnt/sdg1
    sudo chown -R unity /mnt/sdg1
    sudo chmod a+rwx /dev/sdg1
    sudo chmod u=rwx,g=rwx,o= /dev/sdg1
    I'm really mixed up where I should point these cmds, at the mount or at the device?
    Last edited by TinyTim; Sep 18, 2023, 12:06 AM. Reason: Solved. The USB external should have never been in the fstab. /dev/sdg1 was in the same line with the SSD internal drive of SSD2.

    #2
    How you unmount it depends on how you are mounting it. Did you post a thread asking for help on here?

    Please Read Me

    Comment


      #3
      Originally posted by oshunluvr View Post
      How you unmount it depends on how you are mounting it. Did you post a thread asking for help on here?
      format ext4
      I just sudo mount it

      I might be doing something wrong for sure. I have assigned UUID to a ext4 USB in hopes that it will stop asking me for a password when I unmount it in Dolphin, plus the computer will not shut down or boot up without that ext4 USB plugged in. I have spent like 5 full days trying to figure it out and am simply wasted. The machine does work. Everyone here has been very helpful and I have learned more than I ever expected. I suspect that maybe I'm chown or chmod wrong or the kernel might be unclear on the matter. It is hard to let go of, but I am about spent. Thanks for your interest.
      Last edited by TinyTim; Sep 16, 2023, 12:42 AM.

      Comment


        #4
        There you go. SUDO means super user. So if you mount it that way, you have to unmount it that way. It's what I call "Intended Behavior."

        Here - and not sure why you don't do it this way or why you're not having the same result - I plug in a USB device (I have many) - then I get a notification from the "Disks & Devices" in the system tray. I can click on the notification and select "Mount and Open" or I can open Dolphin and it's there under "Removable Devices" which I can select and Dolphin mounts it and opens a window. Then I do yadda-yadda-yadda and when I'm done, I click on "Safely Remove" and it's automagically unmounted.

        Please Read Me

        Comment


          #5
          Originally posted by oshunluvr View Post
          There you go. SUDO means super user. So if you mount it that way, you have to unmount it that way. It's what I call "Intended Behavior."

          Here - and not sure why you don't do it this way or why you're not having the same result - I plug in a USB device (I have many) - then I get a notification from the "Disks & Devices" in the system tray. I can click on the notification and select "Mount and Open" or I can open Dolphin and it's there under "Removable Devices" which I can select and Dolphin mounts it and opens a window. Then I do yadda-yadda-yadda and when I'm done, I click on "Safely Remove" and it's automagically unmounted.
          Yes, it works that way, automount, and unmount. Except for the ext4 usb that I had to format so it would work with Timeshift and other LInux files. That is the problem. Probably something I'm doing wrong with ownership and permissions.

          Comment


            #6
            IIRC, with EXT4 you need to mount it, set it with your ownership and permissions, then it will retain those. Try doing a manual mount, setting you as owner then umounting it and try the "normal" way to access it like I described above.

            On a related note, I know of no reason to use EXT4 on a thumb drive and a couple reasons not to. For example, EXT4 reserves 5% of file system size for "system" use. But on a USB drive, no system space is needed. It's there so a root user can mount the file system even if it's full and delete a few files to free up space. This is not a concern on a removable device unless you're booting to it.

            If you MUST use EXT for some reason, use EXT2 and remove the reserved space. If you use EXFAT instead you probably won't have this ownership issue.

            FYI, if you're using EXT4 on a large hard drive partition, you probably have given up quite a large amount of drive space due to this function of EXT4. You can manually reduce it to something more reasonable.

            https://sysadmintips.com/linux/all-d...t4-partitions/

            The recommended reserved space is 1% but not less than 10MB. I have one EXT4 file system used for virtual disks that is not bootable so I reduced the reserve size from 21GB to 0. That's a lot of space wasted if I hadn't done that.
            Last edited by oshunluvr; Sep 16, 2023, 07:48 AM.

            Please Read Me

            Comment


              #7
              BTW, if you decide to keep EXT4 then the steps are:

              sudo mount /dev/XXXX /mnt
              sudo chown 1000:1000 /mnt
              sudo umount /mnt

              "XXXX" being the device name of the USB partition; sdc2, sdd1, etc.

              Please Read Me

              Comment


                #8
                Originally posted by oshunluvr View Post
                IIRC, with EXT4 you need to mount it, set it with your ownership and permissions, then it will retain those. Try doing a manual mount, setting you as owner then umounting it and try the "normal" way to access it like I described above.

                On a related note, I know of no reason to use EXT4 on a thumb drive and a couple reasons not to. For example, EXT4 reserves 5% of file system size for "system" use. But on a USB drive, no system space is needed. It's there so a root user can mount the file system even if it's full and delete a few files to free up space. This is not a concern on a removable device unless you're booting to it.

                If you MUST use EXT for some reason, use EXT2 and remove the reserved space. If you use EXFAT instead you probably won't have this ownership issue.

                FYI, if you're using EXT4 on a large hard drive partition, you probably have given up quite a large amount of drive space due to this function of EXT4. You can manually reduce it to something more reasonable.

                https://sysadmintips.com/linux/all-d...t4-partitions/

                The recommended reserved space is 1% but not less than 10MB. I have one EXT4 file system used for virtual disks that is not bootable so I reduced the reserve size from 21GB to 0. That's a lot of space wasted if I hadn't done that.
                This is good info. I formated ext4 because that is what Timeshift required. I did not really understand ext2,3,4 until now. I will not use ext for anything due the many problems, but if I do it will be ext2.

                One more thing, when I remove that ext4 USB from my fstab, when I reboot, the system still requires it to boot the system, and to shut it down. Is this something in the kernel, what is it that keeps holding onto this boot requirement? There is something requiring that, I assumed it was Timeshift. I uninstalled Timeshift, reformated the USB drive and assigned a UUID, I have done everything I can think of, but it will not boot without that ext4 usb plugged in, unless I add "nofail".

                Here is the thing as long as the ext4 is in the fstab, "default" any ext4 usb in any drive it will allow it to continue it's boot.

                (I have a partition on my SSD that is ext4, can I reformat that and it not bother the root partition on that drive?)

                Comment


                  #9
                  Originally posted by oshunluvr View Post
                  BTW, if you decide to keep EXT4 then the steps are:

                  sudo mount /dev/XXXX /mnt
                  sudo chown 1000:1000 /mnt
                  sudo umount /mnt

                  "XXXX" being the device name of the USB partition; sdc2, sdd1, etc.
                  Keep in mind, that I removed the ext4 in fstab completely, removed the external usb from port; to boot onto root system, it still required that ext4 USB be plugged in. I even had to boot live to put it back in the fstab for it to boot up on the main drive. Is this something the kernel does? How is it possible?

                  Comment


                    #10
                    You should not have a removable device in fstab. That's not what fstab is for. I don't use timeshift, but I find it hard to believe it "requires" EXT4 because there is no legitimate reason for any application to specify a file system unless it uses file system specific features of which EXT has almost none being more than 30 years old. In fact the first timeshift wiki I looked at mentioned BTRFS in the first paragraph, so maybe you've relied on out-dated info.

                    Removable devices are best kept simple. EXFAT is compatible with MS, OS/x, and Linux. Repeating myself: Why EXT* at all

                    As far as boot requirements, if the USB device is not in fstab and does not hold some required component of your OS, there's no reason it should be needed to boot. The only thing that comes to mind is swap which if is on the USB device, would require it to be present for booting. That is, of course, a bad idea so unlikely that's the issue. Frankly, it seems your problem is Timeshift itself, or how you've set up your system - fstab in particular.

                    If it were my system, I would remove timeshift and all references to the USB device, reinstall grub(sudo grub-install /dev/whatever), and reboot. Once I had a system that can boot on it's own, then work out how to use USB devices and reinstall timeshift and learn how to use it without all the problems.

                    Please Read Me

                    Comment


                      #11
                      Originally posted by oshunluvr View Post
                      You should not have a removable device in fstab. That's not what fstab is for. I don't use timeshift, but I find it hard to believe it "requires" EXT4 because there is no legitimate reason for any application to specify a file system unless it uses file system specific features of which EXT has almost none being more than 30 years old. In fact the first timeshift wiki I looked at mentioned BTRFS in the first paragraph, so maybe you've relied on out-dated info.

                      Removable devices are best kept simple. EXFAT is compatible with MS, OS/x, and Linux. Repeating myself: Why EXT* at all

                      As far as boot requirements, if the USB device is not in fstab and does not hold some required component of your OS, there's no reason it should be needed to boot. The only thing that comes to mind is swap which if is on the USB device, would require it to be present for booting. That is, of course, a bad idea so unlikely that's the issue. Frankly, it seems your problem is Timeshift itself, or how you've set up your system - fstab in particular.

                      If it were my system, I would remove timeshift and all references to the USB device, reinstall grub(sudo grub-install /dev/whatever), and reboot. Once I had a system that can boot on it's own, then work out how to use USB devices and reinstall timeshift and learn how to use it without all the problems.
                      I looked in the GRUB, and seen no odd entries. None the less, I will go with this plan. It may be that when I entered that USB drive into the fstab and had Timeshift use it for a backup, that Timeshift may have done something because this was not supposed to be. No need for repeats on ext4, I got it. Even if I zap the system, and need full reinstall, the information value was enormous. I will get back with you in day or two, let you know how it went.

                      Comment


                        #12
                        Originally posted by oshunluvr View Post
                        You should not have a removable device in fstab. That's not what fstab is for. I don't use timeshift, but I find it hard to believe it "requires" EXT4 because there is no legitimate reason for any application to specify a file system unless it uses file system specific features of which EXT has almost none being more than 30 years old. In fact the first timeshift wiki I looked at mentioned BTRFS in the first paragraph, so maybe you've relied on out-dated info.

                        Removable devices are best kept simple. EXFAT is compatible with MS, OS/x, and Linux. Repeating myself: Why EXT* at all

                        As far as boot requirements, if the USB device is not in fstab and does not hold some required component of your OS, there's no reason it should be needed to boot. The only thing that comes to mind is swap which if is on the USB device, would require it to be present for booting. That is, of course, a bad idea so unlikely that's the issue. Frankly, it seems your problem is Timeshift itself, or how you've set up your system - fstab in particular.

                        If it were my system, I would remove timeshift and all references to the USB device, reinstall grub(sudo grub-install /dev/whatever), and reboot. Once I had a system that can boot on it's own, then work out how to use USB devices and reinstall timeshift and learn how to use it without all the problems.
                        Answer: There are two ext4 partitions on the systems SSD one with root system and the other for file storage ext4 called SSD2 @ /dev/sda1. Then the external USB ext4 drive sdg1. In fstab in the SSD2 @ /dev/sda1 has a entry that was out of viewing area and there was the hook > /mnt/sdg1 . That is the second user and why it insisted USB sdg1 be attached to boot, I have to assume was a Timeshift deal. I simply removed /mnt/sdg1 out of the /dev/sda1 SSD2 line, and it fixed the problem.
                        /dev/sda1 /mnt/SSD1 ext4 defaults 00 > */mnt/sdg1*
                        /dev/sdg1 ***UUID*** /mnt/sdg1 ext4 default 00

                        Comment


                          #13
                          Yeah, that sounds very odd that your fstab ended up that way unless you did it, lol. Glad you figured that out.

                          Please Read Me

                          Comment


                            #14
                            Originally posted by TinyTim View Post
                            /dev/sdg1 ***UUID*** /mnt/sdg1 ext4 default 00

                            If this line is still in your fstab, it needs editing (or removing)
                            For UUID the line would be this:

                            UUID=**UUID** /mnt/sdg1 ext4 defaults 00

                            You don't use the "dev" name here at all, and it should be 'defaults', with an 's'.

                            Comment


                              #15
                              Thank you, I used ***UUID*** cause I did not want to type the long number. I have removed all references of that from the fstab. I found the problem in the fstab way outside the immediate viewing area; in the line same line with the main SSD drive partition called SSD2 was entered this: < /mnt/sdg1. I removed that, I put the answer in my question. It may have been TImeshift, but more than likely it was my learning error, and/or both of us. It is fixed.

                              Comment

                              Working...
                              X