How to create highly scalable private cloud NAS with raspberry pi

We can use the idle USB disk drives or HDD drives and Raspberry Pi to create a highly scalable private cloud NAS

Device:

Raspberry pi 3 mode b+

Operating System:

Raspbian  version is Stretch or newer

Step 1:

if your raspbian is not Stretch or newer please upgrade it, otherwise just skip this step

#upgrade from Jessie to Stretch
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list
sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list.d/*.list
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y

Step 2:

install and start Docker

#install && start docker
sudo apt install wget -y
wget https://download.docker.com/linux/debian/dists/stretch/pool/stable/armhf/docker-ce_18.09.5~3-0~debian-stretch_armhf.deb
wget https://download.docker.com/linux/debian/dists/stretch/pool/stable/armhf/docker-ce-cli_18.09.5~3-0~debian-stretch_armhf.deb
wget https://download.docker.com/linux/debian/dists/stretch/pool/stable/armhf/containerd.io_1.2.5-1_armhf.deb

sudo dpkg -i containerd.io_1.2.5-1_armhf.deb
sudo dpkg -i docker-ce-cli_18.09.5~3-0~debian-stretch_armhf.deb
sudo dpkg -i docker-ce_18.09.5~3-0~debian-stretch_armhf.deb


Step 3:

install lvm2

#install lvm
sudo apt install lvm2 -y

Step 4:

create  Volume(if you insert one disk let us say it is /dev/sda and 4GB capacity)

4GB is a example ,if you have more just change it

#create physical Volumne
sudo pycreate /dev/sda
#crteate vilume group name is data
sudo vgcreate data /dev/sda
# create logic volum
sudo lvcreate -L 4GB data -n owncloud

Step 5:

mount

#mount 
sudo mkdir /mnt/owncloud
sudo mkfs.ext4 /dev/data/owncloud
sudo mkdir /mnt/owncloud
sudo mount /dev/data/owncloud /mnt/owncloud

Step 6:

run

#run
sudo docker run --name owncloud -d -p 8080:80 -v /mnt/owncloud:/var/www/html owncloud
#if you had ran once before
sudo docker start owncloud

Step7:

config(replace RASPBERRY_IP to your Raspberry Pi ip address)

open http:RASPBERRY_IP// :8080 in browser and finish the admin name and password config

/image/same/blog/2019/04/30/1f19d94414f54838b65826ecf22a282c.png

after input your admin name and password click   Finish Setup 

Then all finished


Scalability

if you want to add Disk (let us say it is /dev/sdb and  10GB capacity)


#add disk
sudo pycreate /dev/sdb
sudo vgextend data /dev/sdb
sudo vgdisplay data#show how much total and left 
sudo lvresize -r -L +10GB /dev/data/owncloud

then you will see your owncloud data had been add 10GB by `df -h` command

Conclusion:

This is a very easy way to use idle disks to create a private cloud NAS for you and your family

owncloud has Windows,Linux,Macosx,Android,IOS client to sync