Ubuntu 22.04.2 LTS系统下只读驱动器无法创建文件夹及修改路径问题求助
Hey there, let's work through this read-only drive issue step by step. I've tackled similar problems plenty of times, so here are the most practical fixes to try out:
Check the drive's mount status
First, let's confirm if the drive is actually mounted in read-only mode. Open a terminal and run:mount | grep /dev/sdXnReplace
/dev/sdXnwith your drive's identifier (you can find it usinglsblkordf -hT). Look for theroflag in the output—if it's there, remount the drive with read-write permissions:sudo mount -o remount,rw /dev/sdXnIf you don't know the exact device path, you can also use the mount point (like
/mnt/hdd):sudo mount -o remount,rw /mnt/hddVerify file system permissions
If the drive is mounted asrwbut you still can't create folders, check the permissions of the mount directory. Run:ls -ld /path/to/mount/pointEnsure your user account has write access (look for
win the user or group section). If not, change the ownership to your user:sudo chown -R $USER:$USER /path/to/mount/pointFor permanent fixes, you can add
uid=$(id -u),gid=$(id -g)to the mount options in/etc/fstabso the drive always mounts with your user's permissions.Check for disk errors
Linux often mounts drives as read-only to prevent data corruption if it detects file system errors. To fix this:- First unmount the drive (skip this if it's your system drive):
sudo umount /dev/sdXn - Run the file system check:
sudo fsck /dev/sdXn
If it's your system drive, you'll need to boot from a Ubuntu Live USB, then run
fsckon the system partition from there—since you can't fix a mounted system drive.- First unmount the drive (skip this if it's your system drive):
Fix /etc/fstab configuration
If the drive keeps mounting as read-only after reboot, check your/etc/fstabfile. Open it with:sudo nano /etc/fstabLook for the line corresponding to your drive. Make sure the mount options include
rw(notro), and verify the UUID is correct (you can get the right UUID withblkid). Save the file (Ctrl+O) and exit (Ctrl+X), then reboot to test.NTFS drive-specific fix
If your HDD is formatted as NTFS, Ubuntu might mount it as read-only by default if thentfs-3gpackage isn't installed. Install it with:sudo apt update && sudo apt install ntfs-3gThen remount the drive, and you should have write access.
备注:内容来源于stack exchange,提问作者Foo127

