Thursday, March 8, 2018

[solved] USB drive mounting as read-only

1. 80% fix

# pacman -S ntfs-3g

2. 10% fix

Occasionally, the FS correct, but a file corruption causes the dirty bit to be set. File splice or other permission errors will occur attempting to copy. Once that happens, you gotta fsck, the drive, but what is the drive reference? Plug in the drive and then...

# dmesg |tail

...then take the resultant drive number (eg, /dev/sdc1) and...

$ dosfsck /dev/sdc1

...or if not VFAT

$ fsck /dev/sdc1

3. 10% fix

This one is really annoying and began in 2020 with the latest versions of udiskie. Udiskie mounts the USB into /run/media/foo/, using the full UUID of the USB. And it's root only. It looks like problem 1 above but a check on the logs shows that it's attempting to mount an ext2 fs using ext4. Udiskie no longer mounts ext2 so it "mounts ext2 using an ext4 system" which it can only do read-only. This pisses people off.

$ journalctl -r
EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem EXT4-fs (sda1): warning: mounting unchecked fs, running e2fsck is recommended

...but yet you know it's an e2 fs...

$ df -Th
/dev/sda1 ext2 3.6G

...so WTF?

[Fail 1 ] doubled down on fs type..

$ mke2fs -t ext2 /dev/sda1

[Success] after 4 days wasted, I gave up and put VFAT fs. I mean, udiskie is going to mount with ext4 no matter what and I sure AF am not going to format a USB drive, or anything else under the sun, with ext4. So just format with something ext4 compatible like VFAT.

$ mkdosfs /dev/sda1

Problem solved. Mounts and reads as user.

HOWEVER... if you do run this version be sure to run either dosfsck, or fsck.msdos on the drive, or you may further corrupt the drive.

No comments: