# Selfhosted NAS with Raspberry Pi 4
###### tags: `research` `network` `DIY` `tutorials`
![](https://i.imgur.com/xiyYWft.png)
**This is first blog which i wrote with sharing another topic out of Security. And it is the most of part i like i bring more new technology for my room. So in this session, i will talk about adventure to building NAS. Hope u can setup it for your own and have good time to learning new somestuff on network :coffee:**
## So this so refference for my topic:
* https://www.youtube.com/watch?v=gyMpI8csWis&t=968s&ab_channel=NetworkChuck
* https://www.raspberrypi.com/tutorials/nas-box-raspberry-pi-tutorial/
## What is NAS?
**Network-attached storage (NAS) allows you to save files from your computer and mobile devices to external hard drives via your home or office wireless network. Using Raspberry Pi, you can connect your existing storage devices — such as external portable hard drives and USB flash drives — to create secure backups of all your important files, accessible from anywhere in the world.**
![](https://i.imgur.com/J9aek31.png)
**Have some different on architecture SAN and NAS. So visualization to distinguishing btw**
==> **A NAS is a single storage device that operates on data files, while a SAN is a local network of several devices. [Reference Link](https://www.lifewire.com/san-vs-nas-818005) :smiley:**
- So i find the solution for external storage without bring physical disk from me by NAS
- And the market is very very popular and it have more type of NAS u can choose such as PC became NAS, Raspberrypi became NAS, ...![](https://i.imgur.com/ntgIcji.png)
- And SYSNOLOGY is once of best NAS solution for anyone but it will cost to much to build it so with another method we can build NAS solution by Raspberrypi. Very Easy - GUI setup - Cheap :thinking_face:
## How to build it?
![](https://i.imgur.com/zSDHUhi.png)
### Shopping
- Raspberrypi 3-4 or 5 **(Maybe soon and Higher is recommended)**
- HDD or SDD or whatever external Disk can connect with Rasp4
- FlaskCard - Boot OS for NAS
- USB or Laptop can read flaskCard to boot OS
- LAN Cable - Really importance - Affected for speed of NAS
- And external Cable for connect HDD or SDD to Rasp4 - Recommend using USB 3.0 or Higher (Base on Rasp)
### So if you have all of it and so take a look it some my recommend addition
- Need to using a Official Power supply for Rasp to get stability![](https://i.imgur.com/h3xejCL.png)
- Need to buy a box have power supply to storage physical disk to get stability ![](https://i.imgur.com/4wu6Aqa.png)
==> But don't worry but if you have it NAS will active with stability :smiling_face_with_smiling_eyes_and_hand_covering_mouth: and not yet to need all of that. The choices base on your budget
### Get OS For NAS
![](https://i.imgur.com/NJc9isW.png)
- So you need choose the right version for next step tool so choice raspbian OS Lite 32 or 64 bit.
- You can download all of that on [Official Link](https://www.raspberrypi.com/software/)
- U can use Raspberry Pi Imager ==> To boot OS for your flaskcard **(Recommend using above or equal 16 Gb)**. Choose the option on one to easily open SSH and connect to LAN (if you don't have a cable for internet).
==> Easily step but you need more careful for setup the name or password really importance (Try to change default name pi because on 2022 some of version raspbian need you change default name and password)
==> Take a look for OS install on reference on top of blog
### If you have HDD or SDD on NTFS format you need to format that to ext4:
- So basically, u need to know why we do that kind on 2 reason:
- First, NTFS format is for Windows Disk format - Using that kind format on windows. It is your basic format on all of your disk you have now if you use windows ![](https://i.imgur.com/MH3eOUH.png)
- Second, ext4 is linux format partion. Really helpful for next step so you can handle all of step to DIY NAS, you need format HDD or SSD for ext4 firstly
- So method we can change very easily:
- If you can SSH with raspberry via `ssh username@hostname` you can have console for on your own terminal like ![](https://i.imgur.com/ygvzUZC.png)
- So typing on that command on that link [Link](https://phoenixnap.com/kb/linux-create-partition) so you will partition of your disk for ext4 format
- Before format u need to unmount all of disk and choose gpt to initilize disk again ==> Remember choose ext4 format
### OpenMediaVault
- We’re going to be using a free piece of software called OpenMediaVault to manage our network storage. OpenMediaVault offers an easy-to-use, web-based interface, and multiple add-on options for advanced users.`from raspberry`![](https://i.imgur.com/Fqyuzf4.png)
- To install OpenMediaVault, run: `sudo wget -O - https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash`
- Reboot that after finished
- Typing the IP address of your Rasp in browser and you will get the web![](https://i.imgur.com/yffnLvC.png)
- Basic loggin with default `user: admin` and `password: openmediavault`
- Login succesful, quickly change your password for access this monitor becasue it can control all of your rasp
### NAS Setup
- Go to **storage** tab and click **Disks** ==> View your all of disk attach with raspberrypi if not try again or reboot ![](https://i.imgur.com/pRmAFd5.png)
- After check everything is *okay*, go for clicking on **File Systems**. You likely won’t see anything here, so select **Create**. Here, you can select your storage device and select **OK** and close.![](https://i.imgur.com/lbU5IcP.png). After that Select the file system to mount it and apply changes.
- Navigate continuous on Shared folder tab, click create icon and set up with your drive and click oke. Remember set up priviledge if you have more user on raspberrypi ![](https://i.imgur.com/JQJAmad.png)Save and apply changes. **Lastly, we need to make sure computers on your network can find the folder (IF 500 Err occur you need check your network or check or the format of your disk - 2 reason can make error occurring)**.
- Navigate to Services and select SMB/CIFS ![](https://i.imgur.com/pz8suEx.png) go for setting to enable SMB service
- Go for it on **Shares** and add shared folder and save that ![](https://i.imgur.com/VQV9JCz.png)
- So reach NFS tab and **enable** it and save ![](https://i.imgur.com/Kc1X61r.png)
- Click **Shares** and do it with your shared folder and add user u want on that ![](https://i.imgur.com/zCM0CWs.png)
- Now your NAS is really work
### Using NAS via same Network with Raspberry
#### With window OS
![](https://i.imgur.com/jzrQ8eo.png)
- Choose `add network location` on ThisPC. So add with syntax to connect to your nas `//<IP Raspberrypi>/<Name_Shared_Folder>`
- Typing your username and password of user u permit to access your NAS
- And Click next and you get the NAS on your window
- So remember you if you access it via with your private IP of Rasp and u work on once of network ==> The speed can have maximumspeed
#### Using on Android
- There are many way you can associate with NAS and software is think is very easily use is [AndSMB](https://play.google.com/store/apps/details?id=lysesoft.andsmb&hl=vi&gl=US)![](https://i.imgur.com/nr9ozQA.png)
- Open it and add your setting on NAS like on windows OS which u need work. Remmember you need work on same network with raspbeerypi
### Using NAS remote anywhere
- So you need using PortForward - NAT port of your public network for your Raspberrypi [Maybe it can help](https://www.cfos.de/en/cfos-personal-net/port-forwarding.htm)
- If not work after u nat port, first you need check your gateway u config is right ? if it right go forward to ISP for open nat service for your network because some of ISP can block of network
- To **deny** the usually replaced by **ISP** for your public IP, you need config your public IP address for **DNS** - Buy it or find fome free version like **noip**. Install it on Raspberrypi and assign it with Ip of Raspberrypi on your network ![](https://i.imgur.com/6EkBAAN.png)
- And try it again on step above on Window OS and Android ==> NAS is activate
### Hopeful u can success for creating your own NAS. Becareful and stay safe and don't miss protect it on next session or other topic ... :smile:. Happy hacking and researching :100: