gikoha’s blog

個人的メモがわり

Ubuntu NTFSパーティションがroマウントされていた

  • Windows/Linux共用ドライブのファイルが削除できないと思っていたら、共用ドライブのNTFSドライブがread onlyでマウントされていた
  • 原因はWindowsの予期せぬシャットダウン (ブルースクリーン)
  • ちなみにfstabには以下のように書いてあった
UUID=31517132445FAE4F /media/HDD1 ntfs defaults,uid=1000,gid=1000 0 0
  • 手動でマウントしてみたらエラーになっていた
% sudo mount -a
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
Could not mount read-write, trying read-only
  • その3151...の blkid から /dev/ポイントを検索する方法
% sudo blkid | grep 31517132445FAE4F 

/dev/sdb3: LABEL="HDD1" BLOCK_SIZE="512" UUID="31517132445FAE4F" TYPE="ntfs" PARTUUID="6500472d-2120-4f96-af61-b9055e7ff0f4"
  • その/dev/をntfsfixする方法
% sudo ntfsfix /dev/sdb3

Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdb3 was processed successfully.

% sudo mount -a          
  • 問題なく rwマウントできた

  • すべてのドライブのNTFSを直すには:

sudo blkid | grep ntfs | sed -e 's/\([^ \t:]*\).*/\1/g' | xargs -L 1 sudo ntfsfix