Can't mount ext4 partition with write permissions
I got a new computer, so I decided to scavenge the old one and use it's 240GiB SSD as my games partition. After I formatted and configured it, I can mount it (and it even auto mounts with fstab), but always as read-only.
I've read countless guides and answers, but all of them addresses ntfs partitions or some other problem with ext4 that I don't have.
These are the steps I used to format and configure the partition:
First, I formatted it with parted, using sudo parted /dev/sdb
to get into the interactive CLI, then removed all the partitions with rm
, then mklabel gpt
to created the partition table, and finally mkpart primary ext 0G 240G
to create the partition and exited parted. Afterwards, I ran sudo mkfs.ext4 /dev/sdb1
to create the file system.
After that, I created the directory with sudo mkdir /ssd
, then created a group to access it with sudo groupadd ssd
, included my user in this group with sudo usermod -aG ssd $USER
and gave ownership to the new directory to this group with sudo chown -R :ssd /ssd
.
Finally, I got the UUID of the partition with blkid
and used it to edit my fstab with sudoedit /etc/fstab
and just copied the configs from my HD that was already working, only changing the UUID and mount point, and this was my final (and current) fstab:
UUID=5AA1-8CE8 /boot/efi vfat defaults,noatime 0 2
UUID=5a14b7be-2963-4f80-8ea8-383bcdee76fa / ext4 defaults,noatime,discard 0 1
UUID=fde6cd40-e72e-4377-a849-69816d215940 /hd ext4 defaults,noatime 0 0
UUID=99ea0800-f0ef-4d7f-a793-524d2f9afe8c /ssd ext4 defaults,noatime 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
After rebooting and checking that the partition was read-only, I unmounted it with sudo umount /ssd
and checked it with sudo fsck.ext4 /dev/sdb1
, but got no errors:
e2fsck 1.45.5 (07-Jan-2020)
/dev/sdb1: clean, 11/14655488 files, 1197492/58607360 blocks
Finally, I tried remounting it with read-write permissions using sudo mount -vo exec,rw /ssd
, but it was still mounted as a read-only partition.
Any help is appreciated.
Solution 1:
This drive appears to be properly mounted. There is no indication that it is mounted read only. Then, of course, by default, only the administrator can use it. If desired, the administrator must give write permission to either the entire partition, or selected folders created on the new partition.
Before determining that the partition is mount read only, check whether you can create a folder on that partition as root user:
sudo mkdir /ssd/testfolder
If that command succeeds, see the folder listed in the output of
ls /ssd
Make your user owner of the testfolder
so that user has full access:
sudo chown $USER:$USER /ssd/testfolder
$USER
will automatically be substituted by your own login name. Suply another user name if you want to do this for another user.
Now test if you can create a file on that folder:
echo Yes, it worked! > /ssd/testfolder/newfile
cat /ssd/testfolder/newfile
The cat
command should print the contents of the file.
If it does not succeed, then indeed your partition might be mounted read only. That, however, would point to an issue during mounting, because you did not set it up to mount read only.