Linux下无法挂载U盘

今日在拷贝文件时,可能是没注意到文件还没写入U盘,强行将其拔出,不料却出现无法挂载的情况:

Error mounting /dev/sdb4 at /media/xxx/xx: Command-line`mount -t "ntfs" -o"uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177""/dev/sdb4" "/media/eden/文檔"' exited with non-zero exit status14: The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/dev/sdb4': Operation not permitted
The NTFS partition is in an unsafe state. Please resume andshutdown
Windows fully (no hibernation or fast restarting), or mount thevolume
read-only with the 'ro' mount option.

究其原因,估计是拔出时文件还未写完,出现故障,逐步排查如下:

1、打开终端,输入sudo fdisk -l 可列出所有的分区情况,找到自己U盘的分区;

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x13bcd83a

   设备 启动      起点          终点     块数   Id  系统
/dev/sda1   *          63   163846934    81923436    7  HPFS/NTFS/exFAT
分区 1 未起始于物理扇区边界。
/dev/sda2       163846996   859797503   347975254    f  W95 扩展 (LBA)
分区 2 未起始于物理扇区边界。
/dev/sda5       163846998   404500634   120326818+   7  HPFS/NTFS/exFAT
分区 5 未起始于物理扇区边界。
/dev/sda6       404500698   645138269   120318786    7  HPFS/NTFS/exFAT
分区 6 未起始于物理扇区边界。
/dev/sda7       645138333   693843008    24352338    7  HPFS/NTFS/exFAT
分区 7 未起始于物理扇区边界。
/dev/sda8       693843968   697843711     1999872   82  Linux 交换 / Solaris
/dev/sda9       697845760   797843455    49998848   83  Linux
/dev/sda10      797845504   857843711    29999104   83  Linux
/dev/sda11      857845760   859797503      975872   83  Linux

Disk /dev/sdb: 8004 MB, 8004304896 bytes
255 heads, 63 sectors/track, 973 cylinders, total 15633408 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcad4ebea

   设备 启动      起点          终点     块数   Id  系统
/dev/sdb4   *         256    15633407     7816576    7  HPFS/NTFS/exFAT


2、得知分区为:/dev/sdb4,创建挂载目录:

sudo mkdir /media/xxx/yyy          (xxx为用户名,yyy为挂载的U盘的名字)

3、挂载U盘:

mount -t ntfs-3g  /dev/sdb4  /media/xxx/yyy/ -o force

如此做之后,还是会出现错误:

$MFTMirr does not match $MFT (record 0).
Failed to mount '/dev/sdb6': 输入/输出错误
NTFS is either inconsistent, or there is a hardware fault, or it's a
SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
then reboot into Windows twice. The usage of the /f parameter is very
important! If the device is a SoftRAID/FakeRAID then first activate
it and mount a different device under the /dev/mapper/ directory, (e.g.
/dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
for more details
.

4、还是不行,网上一搜,用以下命令,大功告成:

sudo ntfsfix /dev/sdb6

Mounting volume... FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... FAILED
Correcting differences in $MFTMirr record 0...OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdb6 was processed successfully.

看来以后自己得小心插拔U盘了。


你可能感兴趣的:(Linux学习)