nas:build_a_linux_nas
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
nas:build_a_linux_nas [2021/09/25 16:10] – peter | nas:build_a_linux_nas [2021/09/25 21:38] (current) – peter | ||
---|---|---|---|
Line 7: | Line 7: | ||
- [[NAS:Build a Linux NAS:Prepare the RAID Disks|Prepare the RAID Disks]] | - [[NAS:Build a Linux NAS:Prepare the RAID Disks|Prepare the RAID Disks]] | ||
- [[NAS:Build a Linux NAS:Create a Software RAID Array|Create a Software RAID Array]] | - [[NAS:Build a Linux NAS:Create a Software RAID Array|Create a Software RAID Array]] | ||
- | + | - [[NAS:Build a Linux NAS:Create a Filesystem|Create a Filesystem]] | |
- | + | - [[NAS:Build a Linux NAS:Mount the RAID Array|Mount the RAID Array]] | |
+ | - [[NAS:Build a Linux NAS:Create a Samba Share|Create a Samba Share]] | ||
+ | - [[NAS:Build a Linux NAS:Data Scrubing|Data Scrubing]] | ||
+ | - [[NAS:Build a Linux NAS:Power Consumption|Power Consumption]] | ||
+ | - [[NAS:Build a Linux NAS:Tune the System|Tune the System]] | ||
+ | - [[NAS:Build a Linux NAS: | ||
+ | - [[NAS:Build a Linux NAS:Monitor the System|Monitor the System]] | ||
+ | - [[NAS:Build a Linux NAS:Support recovering from a faulty disk|Support recovering from a faulty disk]] | ||
---- | ---- | ||
- | ---- | + | ===== Resources |
- | + | ||
- | ===== Create a Software RAID Array ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 | + | |
- | + | ||
- | or | + | |
- | + | ||
- | sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 --spare-devices=1 / | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * This device represents the RAID 5 of /dev/sdb1, /dev/sdc1 and / | + | |
- | * Obviously other RAID types could be used instead. | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Ensure the RIAD Array is reassembled automatically each time the system boots ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo mdadm --detail --scan | sudo tee -a / | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * In the background, mdadm will sync the data of these disks. | + | |
- | * This can take a very long time as it requires reading and writing a lot of data depending on the size of the disks. | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Check the RAID Status ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo mdadm --detail /dev/md0 | + | |
- | </ | + | |
- | + | ||
- | returns: | + | |
- | + | ||
- | <code bash> | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Create a Filesystem ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo mkfs.ext4 /dev/md0 | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Mount the Array ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo mkdir /mnt/nas | + | |
- | sudo mount /dev/md0 /mnt/nas | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Check the Mount ===== | + | |
- | + | ||
- | <code bash> | + | |
- | lsblk | + | |
- | </ | + | |
- | + | ||
- | returns: | + | |
- | + | ||
- | <code bash> | + | |
- | NAME | + | |
- | sda 8:0 0 232.9G | + | |
- | ├─sda1 | + | |
- | ├─sda2 | + | |
- | ├─sda3 | + | |
- | ├─sda4 | + | |
- | sdb 8:32 | + | |
- | ├─md0 | + | |
- | sdc 8:48 | + | |
- | ├─md0 | + | |
- | sdd 8:64 | + | |
- | ├─md0 | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Test writing to the mounted array ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo touch / | + | |
- | ls -al /mnt/nas/ | + | |
- | </ | + | |
- | + | ||
- | returns: | + | |
- | + | ||
- | <code bash> | + | |
- | total 24 | + | |
- | drwxr-xr-x 3 root root 4096 Feb 14 11:19 . | + | |
- | drwxr-xr-x 4 root root 4096 Feb 14 11:19 .. | + | |
- | drwx------ 2 root root 16384 Feb 14 11:19 lost+found | + | |
- | -rw-r--r-- 1 root root 0 Feb 14 11:19 test | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Ensure the array always get mounted on boot ===== | + | |
- | + | ||
- | <code bash> | + | |
- | echo '/ | + | |
- | </ | + | |
- | + | ||
- | returns: | + | |
- | + | ||
- | <code bash> | + | |
- | /dev/md0 /mnt/nas ext4 defaults, | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Create Samba Share ===== | + | |
- | + | ||
- | Save a backup of the default Samba Config. | + | |
- | + | ||
- | <code bash> | + | |
- | sudo cp / | + | |
- | </ | + | |
- | + | ||
- | Now edit the Samba Config file, **/ | + | |
- | + | ||
- | <file bash / | + | |
- | [global] | + | |
- | workgroup=WORKGROUP | + | |
- | server min protocol = SMB2 | + | |
- | server max protocol = SMB3 | + | |
- | server string = NAS | + | |
- | log file = / | + | |
- | + | ||
- | [data] | + | |
- | path = / | + | |
- | available = yes | + | |
- | valid users = peter | + | |
- | read only = no | + | |
- | browseable = yes | + | |
- | writable = yes | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Create a Samba user ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo smbpasswd -a peter | + | |
- | </ | + | |
- | + | ||
- | returns: | + | |
- | + | ||
- | <code bash> | + | |
- | Added user peter. | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | ===== Test Access to the Share ===== | + | http:// |
- | Within a Web Browser, enter | + | https:// |
- | <code bash> | + | https://h3x.no/2011/07/09/tuning-ubuntu-mdadm-raid56 |
- | //192.168.1.5/data | + | |
- | </code> | + | |
- | <WRAP info> | + | https:// |
- | **NOTE:** | + | |
- | * **192.168.1.5**: The IP Address of the NAS. | + | https://www.linuxquestions.org/ |
- | * Obviously use whatever IP address that device has. | + | |
- | * **data**: | + | |
- | </WRAP> | + | |
nas/build_a_linux_nas.1632586220.txt.gz · Last modified: 2021/09/25 16:10 by peter