U盤只讀檔案系統
阿新 • • 發佈:2018-12-26
Linux下使用U盤時,在沒有解除安裝的情況下擅自拔出U盤後,U盤成為只讀檔案系統,說下修復的辦法。
環境:
OS: Linux 3.9.4-1-ARCH
U盤:FAT32
今天向U盤上拷了檔案後,沒有解除安裝就拔了U盤,再插上電腦,稍等片刻時,發現成為只讀檔案系統。嘗試使用sudo chmod a+w /U
,顯示為只讀檔案系統。只好檢視列印的系統資訊
檢視系統列印資訊:
$ demsg | less
看到如下內容:
[29153.253989] usb 2-1.2.3.3: new full-speed USB device number 40 using ehci-pci [29153.423524] usb 2-1.2.3.3: not running at top speed; connect to a high speed hub [29153.431450] scsi20 : usb-storage 2-1.2.3.3:1.0 [29154.435792] scsi 20:0:0:0: Direct-Access Generic Flash Disk 8.07 PQ: 0 ANSI: 2 [29154.437255] sd 20:0:0:0: [sdb] 8212480 512-byte logical blocks: (4.20 GB/3.91 GiB) [29154.438207] sd 20:0:0:0: [sdb] Write Protect is off [29154.438214] sd 20:0:0:0: [sdb] Mode Sense: 03 00 00 00 [29154.438930] sd 20:0:0:0: [sdb] No Caching mode page present [29154.438934] sd 20:0:0:0: [sdb] Assuming drive cache: write through [29154.442123] sd 20:0:0:0: [sdb] No Caching mode page present [29154.442128] sd 20:0:0:0: [sdb] Assuming drive cache: write through [29154.473636] sdb: sdb1 [29154.476380] sd 20:0:0:0: [sdb] No Caching mode page present [29154.476388] sd 20:0:0:0: [sdb] Assuming drive cache: write through [29154.476404] sd 20:0:0:0: [sdb] Attached SCSI removable disk [29155.527602] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. [29167.626139] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 2111071) [29167.626143] FAT-fs (sdb1): Filesystem has been set read-only [29167.626154] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 2111071)
寫的很明白,被不適當的解除安裝造成有些資料錯誤,請使用fsck修復。
使用fsck修復:(sdb1是U盤的分割槽)
$ sudo fsck -fy /dev/sdb1
含義:肯定回答修復損壞的扇區,保險起見可以不加f與y。
修復後,正常解除安裝U盤,再插上U盤:
$ dmesg | less
看到:
[29665.364058] usb 2-1.2.3.3: new full-speed USB device number 43 using ehci-pci [29665.543688] usb 2-1.2.3.3: not running at top speed; connect to a high speed hub [29665.551693] scsi23 : usb-storage 2-1.2.3.3:1.0 [29666.555758] scsi 23:0:0:0: Direct-Access Generic Flash Disk 8.07 PQ: 0 ANSI: 2 [29666.557362] sd 23:0:0:0: [sdb] 8212480 512-byte logical blocks: (4.20 GB/3.91 GiB) [29666.557984] sd 23:0:0:0: [sdb] Write Protect is off [29666.557987] sd 23:0:0:0: [sdb] Mode Sense: 03 00 00 00 [29666.558605] sd 23:0:0:0: [sdb] No Caching mode page present [29666.558608] sd 23:0:0:0: [sdb] Assuming drive cache: write through [29666.561606] sd 23:0:0:0: [sdb] No Caching mode page present [29666.561609] sd 23:0:0:0: [sdb] Assuming drive cache: write through [29666.893013] sdb: sdb1 [29666.895352] sd 23:0:0:0: [sdb] No Caching mode page present [29666.895357] sd 23:0:0:0: [sdb] Assuming drive cache: write through [29666.895361] sd 23:0:0:0: [sdb] Attached SCSI removable disk
開啟U盤,可以正常讀寫了。
(完)