question
Sometimes insert a U disk under ubuntu, and find that the content cannot be modified. For example, you cannot create new files and folders, and you cannot copy files to the U disk. The system prompts: read-only file system.
The reason is probably that the file system information of the U disk is wrong (saved in the front of a hard disk or U disk, which has all the file information).
Formatting the USB drive will naturally solve the problem, but it will delete all data on the USB drive.
To repair the U disk without deleting the files, you can use the following methods.
Solution
1 View U disk information
First insert the USB stick.
Open the command line and execute the following commands:
df -h
Use if you have insufficient permissions sudo
.
Display the information of all mounted hard disk U disks, for example:
文件系统 容量 已用 可用 已用% 挂载点
udev 3.9G 0 3.9G 0% /dev
tmpfs 786M 9.6M 776M 2% /run
/dev/sda5 272G 137G 121G 54% /
tmpfs 3.9G 208M 3.7G 6% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 786M 92K 786M 1% /run/user/1000
/dev/sdb1 284G 217G 68G 77% /media/admin/MyUDisk
As you can see, the file system of the U disk is /dev/sdb1, and the mount point is /media/admin/MyUDisk.
2 Uninstall the U disk
sudo umount /media/admin/MyUDisk
Do not unplug the U disk after uninstalling!
3 Repair U disk file system failure
sudo dosfsck -v -a /dev/sdb1
Note: This is /dev/sdb1
just an example, please refer to the actual situation!
The execution time of this command is variable, it may complete quickly, or it may take a few minutes, please be patient.
Re-mount the U disk to check whether it has been repaired.