Raspberry PiにUSB HDDを接続してsambaで接続できるようにします。 前記事 Raspberry Piにsamba導入 - おかゆさん進捗ありますか? の作業後からスタートします
USB HDDをフォーマット
Ubuntu上で作業します。 GParted でUSB HDDのパーティションを全削除、ext4のパーティションを一つ作成します。
Raspberry Pi に接続
USB HDDをRaspberry Piに接続します。接続後、マウントの設定をします。
fdiskで、USB HDDの位置を調べます。
$ sudo fdisk -l Disk /dev/mmcblk0: 31.9 GB, 31914983424 bytes 4 heads, 16 sectors/track, 973968 cylinders, total 62333952 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0009bf4f Device Boot Start End Blocks Id System /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA) /dev/mmcblk0p2 122880 62333951 31105536 83 Linux Disk /dev/sda: 250.1 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xd8f6a8ce Device Boot Start End Blocks Id System /dev/sda1 2048 488396799 244197376 83 Linux
今回の場合は/dev/sda1
のようです。次にblkid
でUUIDを調べます。
$ sudo blkid /dev/sda1 /dev/sda1: UUID="8d69ef9f-bcb9-4623-ae8a-1954243e3299" TYPE="ext4"
このUUIDを使ってマウントするようにします。エディタで/etc/fstab
に以下を追記します。
UUID=8d69ef9f-bcb9-4623-ae8a-1954243e3299 /media/hdd1 ext4 defaults 0 0
念の為/media/hdd1
を作っておきます。
sudo mkdir /media/hdd1
Raspbery Piを再起動し、/media/hdd1
がマウントされていればOKです。