Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 63

Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 73

Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 89

Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 102

Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 111

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91

Deprecated: Return type of AIOSEO\Plugin\Common\Models\Model::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 409

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174
Intel NUC に USB-HDDを増設する | reyfox blog

reyfox blog

reyfox tech info

CentOS HDD Linux

Intel NUC に USB-HDDを増設する

投稿日:

Intel NUC に USB3.0のHDDを増設、フォーマットして使えるようにします。
なお、OSはCentOS7となります。

まずは普通にUSBのコネクタにHDDを接続します。

lsusb コマンドで認識しているかの確認

lsusb コマンドで認識しているかチェックします。
lsusb コマンドがない場合は、yum でインストールします。


# lsusbを含むパッケージのインストール
yum install usbutils
lsusb
Bus 002 Device 002: ID 04bb:014a I-O Data Device, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 8087:0aaa Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I-O Data のHDDが認識されています。
ここから、フォーマットを行っていきます。
昔は fdisk で行っていましたが、現在のHDDは大容量となるため、parted を使用します。

parted で gpt パーティションに変更

lsusb
parted -l
# 略 #
モデル: I-O DATA HDCL-UT (scsi)
ディスク /dev/sdb: 3001GB
セクタサイズ (論理/物理): 512B/4096B
パーティションテーブル: msdos
ディスクフラグ:

番号  開始    終了    サイズ  タイプ   ファイルシステム  フラグ
 1    1049kB  2199GB  2199GB  primary  xfs
# 上記サイズが2TBになっていますが、これは fdisk で一度設定したためのミスとなります #
# 略 #

ディスク /dev/sdb の部分を控えておきます。
大体は、/dev/sda がシステム、 HDDをつなぐごとに /dev/sdb /dev/sdc となっていきます。

lsusb
parted /dev/sdb
# parted を /dev/sdb に対して実行

GNU Parted 3.1
/dev/sdb を使用
GNU Parted へようこそ! コマンド一覧を見るには ‘help’ と入力してください。
(parted) mklabel gpt
警告: いま存在している /dev/sdb のディスクラベルは破壊され、このディスクの全データが失われます。続行しますか?
はい(Y)/Yes/いいえ(N)/No? y
(parted) mkpart primary xfs 0% 100%
(parted) p
モデル: I-O DATA HDCL-UT (scsi)
ディスク /dev/sdb: 3001GB
セクタサイズ (論理/物理): 512B/4096B
パーティションテーブル: gpt
ディスクフラグ:

番号 開始 終了 サイズ ファイルシステム 名前 フラグ
1 1049kB 3001GB 3001GB xfs primary

(parted) quit

太文字部分が入力となります。
まず gpt パーティションに切り替え、ファイルシステムを xfs として、0%から100%までを使用を宣言します。
quit で parted を抜けます。

mfks コマンドで xfs ファイルシステムを作成

CentOSの古いバージョンは ext3 だったり、ext4 が使用されていますが、
CentOS7では xfs が採用されています。
ext4 でも良かったのですが、OSのファイルシステムと合わせるため、xfs にしました。


mkfs -t xfs /dev/sdb1
mkfs.xfs: /dev/sdb1 appears to contain an existing filesystem (xfs).
mkfs.xfs: Use the -f option to force overwrite.
mkfs -t xfs -f /dev/sdb1

すでに xfs があると言われてますが、無視して -f をつけフォーマットします。

マウント用ディレクトリの作成とマウント


mkdir -p /var/mnt/hdd1
mount /dev/sdb1 /var/mnt/hdd1

/var/mnt/hdd1 というディレクトリを作成し、そこに /dev/sdb1 を割り当てます。

df -h にて、正常にマウントされているかチェックできます。


df -h
ファイルシス   サイズ  使用  残り 使用% マウント位置
/dev/sda4        439G  1.2G  437G    1% /
devtmpfs         7.6G     0  7.6G    0% /dev
tmpfs            7.6G     0  7.6G    0% /dev/shm
tmpfs            7.6G  8.8M  7.6G    1% /run
tmpfs            7.6G     0  7.6G    0% /sys/fs/cgroup
/dev/sda2       1014M  181M  834M   18% /boot
/dev/sda1        200M   12M  189M    6% /boot/efi
tmpfs            1.6G     0  1.6G    0% /run/user/0
/dev/sdb1        2.8T   33M  2.8T    1% /var/mnt/hdd1

/dev/sdb1 が 2.8TB で認識されました。
あとは普通に /var/mnt/hdd1 にファイルを書き込むだけでHDDに書き込まれるようになります。

起動時に自動的にマウントさせるようにする

起動時に自動的にマウントさせるには、/etc/fstab に下記のように書き込みます。

vi /etc/fstab
# 追記
/dev/sdb1/          /var/mnt/hdd1              xfs    defaults        0 0

-CentOS, HDD, Linux

執筆者:

関連記事

grafanaにCPU使用率及びメモリ使用率グラフを追加

grafana+prometheusでサーバ監視をしグラフィカルなダッシュボードを作る 上記記事でgrafana+prometheusでダッシュボードを作成しました。今回はここにCPU使用率とメモリ使 …

CentOS7上でiperfを使いネットワークの速度を測定

iperf というソフトを使うと、ネットワークの速度を測定できます。主にLAN内の速度(スループット)を測るために使用します。 iperf のインストール yum install epel-relea …

CentOS7で内向き専用DNSサーバを立てる

内向きDNSとは、LAN内でだけドメイン名を解決できるDNSサーバを言います。今回は、LAN内だけでドメイン名を解決するDNSサーバを立て、デフォルトのDNSとして動作するように設定します。なお、内向 …

CentOS7の初期設定

CentOS7 を Intel NUC にインストールしましたが今の所家庭内ネットワークからのみの想定で、外部からのアクセスはすべてルータでフィルタリングしているため、利便性のため下記の設定を行います …

CentOS7にSambaサーバを立ててWindows/Macとファイルを共有する

Linux上にsambaサーバを立てて、Windows及びMacとファイル共有をします。 ストレージは以前増設した3TBのHDDを用いて3TBすべてを共有してNASのように使用します。 Intel N …


Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174