Thomas Buck 1 vuosi sitten
vanhempi
commit
2faf68d842

+ 164
- 0
input/projects/nas_2018.md Näytä tiedosto

@@ -0,0 +1,164 @@
1
+title: Building my own NAS
2
+description: FreeNAS / TrueNAS based x86 server
3
+parent: projects
4
+date: 2018-03-01
5
+update: 2022-06-04
6
+comments: true
7
+---
8
+
9
+With growing storage needs I sooner or later had to build a proper NAS.
10
+Before that, I was using mutliple 4TB disks in my desktop to store stuff like music, movie, photo and tv-series collections, backed-up to a wild assortment of plain 3.5" HDDs put into a USB-SATA bay.
11
+
12
+To have a centralised place for all these files, as well as for running server software like a media library with live transcoding, I decided to go with FreeNAS / TrueNAS, based on FreeBSD.
13
+
14
+This is what the result looks like, currently living on a shelf in my storage room.
15
+
16
+<!--%
17
+lightgallery([
18
+    [ "img/nas_shelf_1.jpg", "" ],
19
+    [ "img/nas_shelf_2.jpg", "" ],
20
+    [ "img/nas_shelf_3.jpg", "" ],
21
+])
22
+%-->
23
+
24
+And these are the parts I went with.
25
+
26
+<!--%
27
+tableHelper([ "align-right", "align-last-right", "align-right monospaced"],
28
+    [ "Part", "Description", "Cost" ], [
29
+        [ "HDD", ("5x 10TB Seagate IronWolf", "https://www.seagate.com/de/de/products/nas-drives/ironwolf-hard-drive/"), "1399.75€" ],
30
+        [ "<s>CPU</s>", ("<s>Intel Xeon E3 1230 v6 (3.5GHz, 4 cores +HT)</s>", "https://www.intel.com/content/www/us/en/products/sku/97474/intel-xeon-processor-e31230-v6-8m-cache-3-50-ghz/specifications.html"), "<s>239.53€</s>" ],
31
+        [ "CPU", ("Intel Celeron G3900 (2.8GHz, 2 cores)", "https://www.intel.com/content/www/us/en/products/sku/90741/intel-celeron-processor-g3900-2m-cache-2-80-ghz/specifications.html"), "35.99€" ],
32
+        [ "MoBo", ("ASRock C236 WSI", "https://www.asrockrack.com/general/productdetail.asp?Model=C236%20WSI#Specifications"), "192.49€" ],
33
+        [ "RAM", ("Kingston ValueRAM (2x16GB, DDR4, ECC)", "https://www.kingston.com/en/memory"), "334.75€" ],
34
+        [ "SSD", ("Kingston A400 SSD (120GB)", "https://www.kingston.com/en/ssd/a400-solid-state-drive"), "36.19€" ],
35
+        [ "SATA", ("5x SATA Cable 70cm", "https://www.mindfactory.de/product_info.php/0-70m-Good-Connections-SATA-6Gb-s-Anschlusskabel-SATA-Stecker-auf-SATA-S_687522.html"), "19.50€" ],
36
+        [ "Case", ("Lian Li PC TU 200 (used)", "https://amzn.to/3xfTYlK"), "150.00€" ],
37
+        [ "PSU", ("Corsair SF450 (used)", "https://www.corsair.com/de/de/Kategorien/Produkte/Netzger%C3%A4te/SF-Series%E2%84%A2-80-PLUS-Gold-Power-Supplies/p/CP-9020104-EU"), "0.00€" ],
38
+        [ "Cooler", ("ProlimaTech Samuel 17 (used)", "http://www.prolimatech.com/en/products/detail.asp?id=157"), "0.00€" ],
39
+        [ "Tape", "HP LTO-3 tape drive (used)", "0.00€" ],
40
+        [ "UPS", ("APC Back-UPS BX700U", "https://amzn.to/3MfN3xd"), "77.99€" ],
41
+        [ "Fan", ("140mm be quiet! Silent Wings 3 PWM", "https://www.bequiet.com/en/casefans/717"), "19.26€" ],
42
+        [ "SCSI", ("LSI20320IE SCSI HBA", "https://docs.broadcom.com/doc/12352276"), "19.00€"],
43
+        [ "", "Sum", "2284.92€" ]
44
+    ]
45
+)
46
+%-->
47
+
48
+Luckily I was able to buy the case, power supply, CPU cooler and tape drive as a used set from a friend of mine for a good price.
49
+To be honest, because of the issues mentioned below, I haven't yet gotten around to installing the cooler I got from him.
50
+Currently I'm still using the stock Intel cooler that was included with the Celeron.
51
+
52
+## CPU
53
+
54
+As you can see from the parts list, there was some trouble with the CPU I selected initially.
55
+This was caused by a misunderstanding of mine in regards to the mainboard.
56
+Turns out the C236 can not boot without a graphics adapter available, probably because of the UEFI.
57
+It has an option available to configure the UEFI via a serial port, but this still requires some kind of graphics output to work.
58
+The Intel Xeon I had did not have any kind of integrated graphics, so the system simply was not booting at all.
59
+
60
+To get going, I then bought the cheapest option I could find that would fit the requirements, a Celeron G3900 for only 35€.
61
+This one has Intel HD Graphics 510 included and still supports ECC memory.
62
+I sold the Xeon on eBay to someone in Italy without significant loss.
63
+I initially went with the beefier Xeon for running VMs and transcoding media streams, but it turns out the Celeron seems to be more than powerful enough for my needs, at least for now.
64
+
65
+## ZFS
66
+
67
+To have a "proper" NAS I of course decided to go with ECC RAM to avoid any data corruption in RAM.
68
+To at least somewhat match the size of my array, I went with 32GB.
69
+
70
+With multi-TB drives in use currently, considering their mean time between bit failures, a higher level of redundancy is really required.
71
+Otherwise, when a drive dies and all data needs to be re-read when resilvering the RAID array, the probability of hitting another failure is relatively high.
72
+For this reason I decided to go with RaidZ-2, so two drives for redundancy, allowing two drives to die and the data still be readable.
73
+
74
+Looking at my storage requirements at the time of starting this project and considering some healthy rate of growth, I decided to go with five 10TB disks, resulting in 50TB raw space and about 30TB of usable space after redundancy.
75
+
76
+In June 2022, about four years after starting this project, I've now used up 16TB, so I think this was a good decision compared to 5x8TB or even 5x4TB.
77
+
78
+## Case
79
+
80
+The Lian-Li PC TU 200 case I selected only fits 4 hard disks by default.
81
+But thanks to its modular nature, I was easily able to design a [3D printed mount for a fifth disk](https://www.printables.com/model/131619-lian-li-hdd-cage-extension).
82
+
83
+<!--%
84
+lightgallery([
85
+    [ "img/nas_hdd_1.jpg", "View inside opened NAS case" ],
86
+    [ "img/nas_hdd_2.jpg", "Closer view of mount" ],
87
+    [ "img/nas_hdd_3.jpg", "Closer view of mount" ],
88
+])
89
+%-->
90
+
91
+One thing I'm not quite happy with is the airflow inside the case.
92
+The front fits a 140mm fan that directly hits the disks.
93
+Nonetheless the temperature of the disks is just below 50°C, which is a bit high for my liking.
94
+Sometime in the future, I want to replace the case with a full-size ATX one with easier accessible drive bays and more space for fans and cable routing.
95
+
96
+<!--%
97
+lightgallery([
98
+    [ "img/nas_hdd_temp.png", "Hard disk temperatures" ],
99
+    [ "img/nas_cpu.png", "CPU usage of NAS" ],
100
+    [ "img/nas_power.png", "Power usage as reported by UPS" ],
101
+])
102
+%-->
103
+
104
+The screenshots above also show the average CPU usage, with shows the Celeron is plenty enough for now.
105
+The power usage is reported by the UPS via USB.
106
+Blank spots in the third graph are caused by the data-polling daemon running on my desktop PC, which is turned off at night.
107
+The spike at the end of the month in all three graphs is caused by the monthly ZFS scrub.
108
+To collect this data I'm using [InfluxDB and Telegraf](influxdb.html).
109
+
110
+## Tape Backup
111
+
112
+As you can see from the parts list above, I also got an LTO-3 tape drive with the case I bought used.
113
+I kinda got into this idea thanks to my friend [Philipp](https://www.phschoen.de/), who also uses a tape drive like this to backup his NAS.
114
+He even put [the scripts he wrote for that on GitHub](https://github.com/phschoen/LTO-backup-script).
115
+
116
+I have to admit however that I still haven't gotten around to actually implementing that.
117
+The drive is connected using a PCIexpress SCSI HBA and is properly recognized by the OS, but I haven't used it otherwise.
118
+
119
+## Software
120
+
121
+Installing and configuring TrueNAS (still called FreeNAS at the time I was setting it up) is pretty straight-forward. [Download](https://www.truenas.com/download-truenas-core/) the ISO, take a close look at the [official documentation](https://www.truenas.com/docs/core/gettingstarted/) and follow it!
122
+
123
+Besides a Debian VM configured for [my IoT needs](smarthome.html) using [my Ansible scripts](sovereign.html), I run a Rancher instance for Docker containers, which currently only runs a [PiHole](https://pi-hole.net/) productively, besides being used for some experiments here and there.
124
+I'm also using the great TrueNAS plugin system to run a local [Plex](https://www.plex.tv/) and [Nextcloud](https://nextcloud.com/), although I'm not quite satisfied with these parts of my setup.
125
+But they do the job for now.
126
+
127
+<!--%
128
+lightgallery([
129
+    [ "img/nas_rancher.png", "Screenshot of Rancher UI" ],
130
+    [ "img/nas_pi_hole.png", "Screenshot of Pi-Hole UI" ],
131
+])
132
+%-->
133
+
134
+## Link Aggregation Experiments (January 2020)
135
+
136
+Both the C236 as well as my desktop PC have two 1Gbit/s Ethernet NICs.
137
+So I decided to get a [Netgear GS308T Managed Switch](https://amzn.to/3xiy41n) and attempt to use link aggregation to achieve faster connection speeds and actually be able to saturate my RAID.
138
+
139
+Unfortunately I haven't been able to get it to work at all.
140
+I configured both the FreeBSD in TrueNAS as well as my Arch Linux desktop as described on the net, but the result was my whole home network completely breaking down in strange ways.
141
+WiFi devices could no longer connect outside through the router, even though the router wasn't involved at all in the aggregate links.
142
+
143
+In the end I have to admit I've given up.
144
+To be honest, I don't really need the faster speeds.
145
+But if anyone has suggestions, I'm open to try it again!
146
+
147
+## Four-Year Update (June 2022)
148
+
149
+Recently I was greeted by this log message in the TrueNAS web UI.
150
+
151
+    Device: /dev/ada5, 584 Currently unreadable (pending) sectors
152
+    Device: /dev/ada5, 584 Offline uncorrectable sectors
153
+
154
+Taking a look at the ZFS pool status, some read errors cropped up on two (!) drives already.
155
+Guess I should have made sure not to get drives from a single batch 🤷
156
+
157
+<!--%
158
+lightgallery([
159
+    [ "img/nas_zfs_pool.png", "ZFS pool status" ],
160
+])
161
+%-->
162
+
163
+Unfortunately hard disk prices are still high and I'm currently not able to afford two new drives.
164
+So for now I'm making sure I have a working backup and hope for the best 😅

+ 1
- 1
input/projects/smarthome/influxdb.md Näytä tiedosto

@@ -15,7 +15,7 @@ Some kind of database, preferably for time series data, like [InfluxDB](https://
15 15
 And a way of visualizing that data, like [Grafana](https://grafana.com/).
16 16
 
17 17
 The installation of all of these tools is in my case [handled by an ansible script](/sovereign.html).
18
-They are running on a VM on my NAS.
18
+They are running on a VM on [my NAS](nas_2018.html).
19 19
 
20 20
 I also have some other fun scripts running that feed data into Influx.
21 21
 This includes [fritzinfluxdb](https://github.com/karrot-dev/fritzinfluxdb), which polls statistics from a Fritz.Box and includes a nice pre-made Grafana dashboard.

BIN
static/img/nas_cpu.png Näytä tiedosto


BIN
static/img/nas_cpu_small.png Näytä tiedosto


BIN
static/img/nas_hdd_1.jpg Näytä tiedosto


BIN
static/img/nas_hdd_1_small.jpg Näytä tiedosto


BIN
static/img/nas_hdd_2.jpg Näytä tiedosto


BIN
static/img/nas_hdd_2_small.jpg Näytä tiedosto


BIN
static/img/nas_hdd_3.jpg Näytä tiedosto


BIN
static/img/nas_hdd_3_small.jpg Näytä tiedosto


BIN
static/img/nas_hdd_temp.png Näytä tiedosto


BIN
static/img/nas_hdd_temp_small.png Näytä tiedosto


BIN
static/img/nas_pi_hole.png Näytä tiedosto


BIN
static/img/nas_pi_hole_small.png Näytä tiedosto


BIN
static/img/nas_power.png Näytä tiedosto


BIN
static/img/nas_power_small.png Näytä tiedosto


BIN
static/img/nas_rancher.png Näytä tiedosto


BIN
static/img/nas_rancher_small.png Näytä tiedosto


BIN
static/img/nas_shelf_1.jpg Näytä tiedosto


BIN
static/img/nas_shelf_1_small.jpg Näytä tiedosto


BIN
static/img/nas_shelf_2.jpg Näytä tiedosto


BIN
static/img/nas_shelf_2_small.jpg Näytä tiedosto


BIN
static/img/nas_shelf_3.jpg Näytä tiedosto


BIN
static/img/nas_shelf_3_small.jpg Näytä tiedosto


BIN
static/img/nas_zfs_pool.png Näytä tiedosto


BIN
static/img/nas_zfs_pool_small.png Näytä tiedosto


Loading…
Peruuta
Tallenna