I started with an out-of-the-box 4TB Western Digital Blue drive. I put it into a Sabrent enclosure, powered it up and plugged it in. First step is to find the drive:
pi@raspberry:/mnt$ sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
UUID NAME FSTYPE SIZE MOUNTPOINT LABEL MODEL
sda 3.7T WDC_WD40EZRZ-22GXCB0
mmcblk0 3.7G
4AD7-B4D5 ├─mmcblk0p1 vfat 256M /boot boot
2887d26c-6ae7-449d-9701-c5a4018755b0 └─mmcblk0p2 ext4 3.4G / rootfs
Now to format it:
pi@raspberry:/mnt $ sudo mkfs.ext4 /dev/sda
Create a directory:
pi@raspberry:/mnt $ sudo mkdir /mnt/ext_storage
Mount the drive in the directory:
pi@raspberry:/mnt $ sudo mount /dev/sda /mnt/ext_storage
Reboot:
pi@raspberry:/mnt $ sudo reboot
You'll get kicked out. Login again. Verify that it's mounted:
pi@raspberry:/mnt/ext_storage $ sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
UUID NAME FSTYPE SIZE MOUNTPOINT LABEL MODEL
7dd94502-35a2-4bd3-a218-7cf76e350c7b sda ext4 3.7T /mnt/ext_storage WDC_WD40EZRZ-22GXCB0
mmcblk0 3.7G
4AD7-B4D5 ├─mmcblk0p1 vfat 256M /boot boot
2887d26c-6ae7-449d-9701-c5a4018755b0 └─mmcblk0p2 ext4 3.4G / rootfs
pi@raspberry:/mnt/ext_storage $ sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="80a50d6c-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="80a50d6c-02"
/dev/sda: UUID="7dd94502-35a2-4bd3-a218-7cf76e350c7b" TYPE="ext4"
/dev/mmcblk0: PTUUID="80a50d6c" PTTYPE="dos"
Now set up Samba:
sudo chown pi /mnt/ext_storage
sudo apt-get update
sudo apt-get install samba samba-common-bin
sudo nano /etc/samba/smb.conf
[ext_storage]
path = /mnt/ext_storage
writeable=Yes
create mask=0777
directory mask=0777
public=no
sudo smbpasswd -a pi
sudo systemctl restart smbd
After doing the above, I had a few issues. First, the external hard drive wasn't remounting when the Pi was rebooted. To fix this. I added the following to /etc/rc.local:
sudo mount /dev/sda /mnt/ext_storage
Next, some directories like the user home directory and the non-existent printer directories were showing up on some Samba clients like Macintosh and AppleTV VLC Player. The solution was to comment out the following sections in /etc/samba/smb.conf:
[home]
[printers]
[print$]
No comments:
Post a Comment