LoginSignup
0
1

More than 1 year has passed since last update.

RaspberryPiに外付けのHDDのマウント

Last updated at Posted at 2023-05-12

外付けHDDのマウント

  • 外付けのHDDをRaspberryPiのUSBに接続し、マウントを確認する
pi@raspberrypi:~ $ df
ファイルシス   1K-ブロック      使用     使用可 使用% マウント位置
/dev/root         30433312   3777304   25362888   13% /
devtmpfs            340460         0     340460    0% /dev
tmpfs               472044         0     472044    0% /dev/shm
tmpfs               188820      2236     186584    2% /run
tmpfs                 5120         4       5116    1% /run/lock
/dev/mmcblk0p1      261108     51636     209472   20% /boot
/dev/sda2       3906885932 383741628 3523144304   10% /mnt/hdd
tmpfs                94408        20      94388    1% /run/user/1000
  • マウント用のフォルダを作成する(RaspberryPiは外付けのHDDを接続し、割付をしないとそのまま使えないため)
  • フォルダの権限を読み書き可能とする
sudo mkdir /mnt/hdd
sudo chmod 777 /mnt/hdd
  • 自動マウントを設定する前準備(設定後、USBからHDDを抜いたままだとRaspberryPiが起動しないので、注意すること)
  • 自動マウントの設定情報にはHDDデバイスのUUIDをセットする必要があるため、PARTUUIDを先に取得する
pi@raspberrypi:~ $ sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="bootfs" LABEL="bootfs" UUID="C336-AC83" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="e327fd70-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="eaaa4faa-eab6-400c-950f-dc96ae4e0400" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="e327fd70-02"
/dev/sda1: PARTLABEL="Microsoft reserved partition" PARTUUID="<xxxx_xxxx-xxxx>"
/dev/sda2: LABEL="HDCZ-UT" BLOCK_SIZE="512" UUID="368AE5D88AE59521" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="<xxxx_xxxx-xxxx>"
  • 自動マウントの設定
  • 【/etc/fstab】を編集する(注意:ここを間違えるとメモリーカードが壊れてしまうため、慎重に作業すること)
  • PARTUUID=d9e942c4-331c-466a-8fdc-83f60561f7b6 /mnt/hdd ntfs defaults.nofail 0 0
pi@raspberrypi:~ $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=e327fd70-01  /boot           vfat    defaults          0       2
PARTUUID=e327fd70-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
PARTUUID=d9e942c4-331c-466a-8fdc-83f60561f7b6 /mnt/hdd ntfs defaults.nofail 0 0
  • 最後に再起動して、dfコマンドで以下のようになっていればOK
    image.png
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