LoginSignup
3
0

More than 5 years have passed since last update.

raspberrypi CentOS7でNTFSを使おうとしたらハマった件

Posted at

ラズパイでCentOSを使おうとするのはやめたほうがいいんだろうか・・・
ググってもなかなか解決しないし。

今回は、デフォルトで入っているNTFSでマウントしたら、書き込みができなかった(読み込みはできた)。
結論から言うと、読み書きをするにはntfs-3gをビルドインストールしなくてはならない。

環境

raspberry pi2 on centos7

/etc/redhat-release.
CentOS Linux release 7.3.1611 (Core)
Linux version 4.4.26-v7.1.el7 (mockbuild@armv7-02.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) ) #1 SMP Sat Oct 22 16:14:43 UTC 2016

cpuinfo: ARMv7 Processor rev 5 (v7l)

事象

  • rootなのに書き込めない。信じられん。
# mount -t ntfs /dev/sda1 /mnt/hdd001
# cd /mnt/hdd001
# touch test
touch: cannot touch 'test': Permission denied
  • ちなみにraspberrypiにntfsはデフォルトで入ってるみたいなので、これでマウントして、あーでもないこーでもないってやってた。
/proc/filesystems.
__(snip)__
nodev   mqueue
        ntfs   <-
        fuseblk
nodev   fuse
nodev   fusectl

今回色々試行錯誤してやったこと

  • yumでntfs-3gのインストールを試みる
yum install ntfs -> No package ntfs available.
yum install ntfs-3g -> No package ntfs-3g available.
  • releaseverを7から7.3.1611に書き換え。
/etc/yum/vars/releasever.
7.3.1611
  • yum update
  • 再度 yum install ntfs

なんかいろいろアップデートされた。
だが、これでも解決せず。
ここで、yumでのインストールは諦める。

  • 別マシンのWindowsで書き込み

スクショとってないけど、できた。
ちなみに、Windowsで作成したファイルに対しての書き込みはできるんだよなぁ。

----ここまで読む必要なし。----


NTFS-3Gをインストール

https://www.tuxera.com/community/open-source-ntfs-3g/
stableのバージョンをwgetしてくる。ちなみにいま現在は2017.3.23が最新だった。
The latest stable version is ntfs-3g_ntfsprogs-2017.3.23, released on March 28, 2017.

# cd ~
# wget https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2017.3.23.tgz
# tar xvfz ntfs-3g_ntfsprogs-2017.3.23.tgz

解凍されるので、configureしてmakeしてmakeinstallする。

# cd ntfs-3g_ntfsprogs-2017.3.23/
# mkdir build
# ../configure
# make && make install ; echo $?

インストール確認

# ntfs-3g
ntfs-3g: No device is specified.

ntfs-3g 2017.3.23 integrated FUSE 27 - Third Generation NTFS Driver
                Configuration type 1, XATTRS are on, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2017 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage:    ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

News, support and information:  http://tuxera.com

おk。

マウントしてみる

# umount /dev/sda1
# mount -t ntfs-3g /dev/sda1 /mnt/hdd001/
# cd /mnt/hdd001
# touch test

書き込めた!

fstabに書いといた。

下記を追記。

/etc/fstab.
UUID=xxxxxxxxxxxxxxxxxxxxx /mnt/hdd001 ntfs-3g defaults 0 0
3
0
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
3
0