0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

NTFS のマウントエラーを解消する

Last updated at Posted at 2023-07-06

昔は Linux から NTFS へ書き込みは控えていたのだけど、最近はどうなのかな?

「filesystems - Can Linux corrupt the data on an NTFS partition? - Unix & Linux Stack Exchange」
https://unix.stackexchange.com/questions/617400/can-linux-corrupt-the-data-on-an-ntfs-partition
のようなウワサもあるが、条件さえ揃っていればある程度は書き込みもできる模様。

今回は、ntfsfix を使った記録。

環境

Ubuntu22.04 LTS

エラー

NTFS のハードディスクに録画していたファイルをエンコード使用としたらエラー。

OSError: [Errno 30] Read-only file system: '../../202106/202106110046000202-放送大学アーカイブス・知の扉.ts'

あれれーと思って確認すると

$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=32574168k,nr_inodes=8143542,mode=755,inode64)
.
.
.
/dev/sda2 on /media/nanbuwks/202106 type fuseblk (ro,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)
.
.
.

ふむ、確かに ro になってますね。
ファイルマネージャから mount したので umount は sudo なしでできます。

$ umount /dev/sda2

改めてmount すると

$ sudo mkdir /media/nanbuwks/202106
$ sudo mount /dev/sda2 /media/nanbuwks/202106
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

なるほど、ちゃんとシャットダウンできてなかっただけでしょうね。

修復

umount して ntfsfix してみます。


$ sudo umount /media/nanbuwks/202106
$ sudo ntfsfix /dev/sda2
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/sda2 was processed successfully.

うまくいったかな?

確認

$ sudo mount /dev/sda2 /media/nanbuwks/202106

今度はエラーは発生していません。

$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=32574168k,nr_inodes=8143542,mode=755,inode64)
.
.
.
/dev/sda2 on /media/nanbuwks/202106 type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
.
.
.

問題ないようです。

NTFS を Linux で使うことについて

https://qiita.com/nanbuwks/items/529ae636d103c3c25667
という記事を以前に書いています。
なので過信は禁物。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?