Can't write to mounted ext4 hard drive in Ubuntu 18.04

25,310

The HDD mount made by the gnome-disk-manager should be ok
I guess you just have to fix perms on HDD :
Open a terminal CTRL+ALT+T and enter the command below

sudo chown $USER:$USER /mnt/stuff

If this does not the trick, go next:


The last line of /etc/fstab should be your HDD
You may edit this last line
Main change is in the mount options (defaults) and fsck option (2)

sudo nano /etc/fstab #(or sudo gedit /etc/fstab)
#
# Edit the last line
UUID=c0c74b6f-dedb-4a3e-b5d8-52cca8a0958e /mnt/stuff ext4 defaults        0       2

Save the file and change (take) ownership on HDD

# Remount the HDD
sudo umount -f /mnt/stuff
sudo mount -a
sudo chown $USER:$USER /mnt/stuff
# non recursive change of ownership should be enough, but
# if still cannot write on it, go for a (longer) recursive change of ownership
# sudo chown -R $USER:$USER /mnt/stuff
# -R is for recursive
Share:
25,310

Related videos on Youtube

SpencerDub
Author by

SpencerDub

Updated on September 18, 2022

Comments

  • SpencerDub
    SpencerDub over 1 year

    I just built a new computer. I'm running Ubuntu 18.04, and I'm not dual-booting.

    Ubuntu is installed on my SSD, but I'd like to also use an internal HDD (connected via SATA to my motherboard) for additional storage. I've been following this set of instructions to set things up. The HDD is formatted as ext4 and automatically mounts at boot, but that's as far as I've got. I'm stuck on Step 4, moving folders from ~/home/ to the HDD and making symbolic links.

    I can't drag folders from Home to the mounted HDD via the file explorer. I also cannot create new directories in the mounted HDD via the file explorer. When I check the permissions of the mounted HDD (via right-click->Properties->Permissions), it says "The permissions of 'drivename' could not be determined."

    From doing some further research, I suspect this is a permissions issue; however, I have been unable to determine what specifically I need to do. How do I troubleshoot this and write to my internal HDD?

    Edit: The contents of my /etc/fstab file are as follows:

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sdb1 during installation
    UUID=b928c257-beab-4352-81d0-9ae12955bf96 /               ext4    errors=remount-ro 0       1
    # /boot/efi was on /dev/sdb3 during installation
    UUID=5B6B-1052  /boot/efi       vfat    umask=0077      0       1
    # /home was on /dev/sdb4 during installation
    UUID=8d372b78-f15c-4c85-b853-becfafa28d69 /home           ext4    defaults        0       2
    # swap was on /dev/sdb2 during installation
    UUID=1972e189-a0fe-448d-93db-c17028c913c8 none            swap    sw              0       0
    /dev/disk/by-uuid/c0c74b6f-dedb-4a3e-b5d8-52cca8a0958e /mnt/stuff auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Stuff 0 0
    

    Edit 2: Here's the relevant entry from running lsblk -fm -e 7:

    sda  ext4         c0c74b6f-dedb-4a3e-b5d8-52cca8a0958e /mnt/stuff   1.8T root  disk  brw-rw----
    
  • SpencerDub
    SpencerDub almost 5 years
    The sudo chown $USER:$USER /mnt/stuff command seems to have done it. Thank you. What did that specifically do?
  • cmak.fr
    cmak.fr almost 5 years
    it gives to your user the ownership on the drive
  • Rafael
    Rafael over 3 years
    ... but this is crazy ... then only that user can write on the entire disk. This seems like a patch rather than a right answer.
  • Nav
    Nav about 3 years
    @Rafael: I agree this is crazy. On another site, one person mentioned doing a chmod 777. But perhaps we need a better way to create file/folder permissions for external hard disks. For now I think I'll just format the partition back to NTFS.
  • doug65536
    doug65536 almost 3 years
    Don't put it in fstab if it is removable and you expect the machine to boot with the drive disconnected. The kernel will freak out during boot if a partition in fstab won't mount.