1st storage server - FreeNAS!

Status
Not open for further replies.

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
I am still contemplating whether I should have 3 separate datasets or if I just create 1 dataset and place subfolders for media/music/general

Having separate datasets results in better configurability when setting up snapshots (and replications if to be used).
 
Joined
Apr 9, 2015
Messages
1,258
It also makes it easier to see which datasets are using the most data for the pool.
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Thanks for the replies. I am just playing around with my new server now that it is all up and running.

sf45AmC.jpg


When a new volume is created, there are the 2 entries as above with the lower being a dataset (119TiB). If I change permissions on that, can I use that to map the network drive to Windows? Or is it better (safer?) to create a new dataset?

Also, what is the compression ratio 82.92x?

Seeing that large storage available is certainly a good feeling :D

Edit: So after further reading, I have decided on adding a dataset with default recordsize to the primary pool (Tank) called "Server". Here is how it looks now

6HpKygK.jpg


I will post up instructions on how I created the Raid pool, setting permissions, users/groups, smb shares just in case it might help someone as I found the FreeNAS instructions good yet sometimes hard to implement
 
Last edited:

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Final configuration of FreeNAS volumes

To create the main pool, I used the volume manager. Because I am running 3 x 8 disk Raid-Z2 this is how I set it up.

niTCwU7.jpg


This is accessed via Storage -> Volumes -> Volume Manager

FreeNAS only takes a short period of time to establish. Once finished, this is what you are presented with

th5m6gV.jpg


Now navigate to System -> System Dataset and select the pool just created and leave all defaults selected and press save

Setting users/groups within FreeNAS

To be able to view shares on a windows system, users and groups need to be created.

To create a group, select Account -> Groups -> Add Group

IlODiKG.jpg


Give the group a name and hit OK

To create a user, select Account -> Users -> Add user

Fill in the following
  • Username
  • Primary group
  • Full name
  • Password
Untick the option Create a new primary group for the user

Under Auxiliary groups select the previously created group and press OK

l7Mx4hE.jpg

hJW63R8.jpg


Note: my group is called rentay

Creating dataset

Go to Volumes -> /mnt/Tank/ -> Create dataset

Select a name, change share type to Windows and change record size if you require
Press Add Dataset

Next, change permissions of Dataset

Select Dataset via Volumes -> (dataset name)
Press change permissions and set:

Owner (user): nobody
Owner (group): group you created prior
Permission type: Windows

LZi6g62.jpg


Setting up shares for Windows (smb)

Navigate to Sharing -> Windows (SMB) -> Add Windows (SMB) share

For path: this will be the share (or dataset) willing to be shared across the network

Give the share a name (anything will do here)
Leave all other settings as default

Then press OK

wY3RbSB.jpg


That is the networking/sharing side completed on FreeNAS' end. Now to establish settings within windows

Open a new explorer window and navigate to This PC (if on Windows 10).

Press Computer (next to File) then Map Network Drive

Under folder, input \\server hostname or ip\<smb share name>
Check both boxes for Reconnect at sign-in and Connect using different credentials
Press Finish

A username/password box should appear, choose different credentials and input your previously created user details (username & password).

All going well, the share should now be present on your Windows machine and ready to be accessed :)
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
It is now time to do something I have been postponing... installing Stux's awesome fan control script :)

Unfortunately, I cannot understand for the life of me how to get this to work let alone even place it in the root folder of the server :(

Is there any chance someone could guide me through this in really simple terms?! Lol maybe even a "how-to" guide would be really handy :D

It's probably really easy however coming from a Windows environment, all this Unix stuff is all rather daunting and I am totally lost

Any help would be greatly appreciated :cool:
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
these days I actually create a dataset in my pool called "server" and in that I have "logs", "bin" and "scripts" directories. I put all the scripts etc that I have for a given server in that. That way they're not on the boot drive.

the script goes in scripts, both the start script and the hybrid_fan_controller.pl script

chmod a+x <script> to set the execute bits.

And edit the start script to direct the log to your server/logs directory

And edit the fan controller script to change the various settings.

test the script using screen and then just run the script...

that way you can kill it and restart it... and your server will still be under fan control when you logout/lose your ssh.

And finally, once you're happy with the way its running, then setup the cron to run the start script.

You can use sftp to upload the scripts to your server if you have ssh enabled.

BTW, I also have a "replicas" dataset on the root of my pools, and I replicate a given FreeNAS instances into that dataset... so for example... I have two servers...

Rhea, and Titan

Rhea will have replicas/titan which contains replicated datasets from Titan... and Titan will have replicas/rhea containing Rhea's replicated datasets.

So, I would have replicas/titan/server as well... and that way all the server scripts/logs are backed up...
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
So, I am working through installing these scripts and am having a little difficulty :(

I have made 2 directories one being scripts and the other being logs.

Now, to create a script for the start fan control do I need to have .sh or .pl at the end?

It seems that my fans connected to FAN1, 2 & 5 are all getting upper critical errors in the Supermicro log. I think I have the wrong values for these fans. Stux, what are your lower and upper thresholds seeing we are running the same fans :D

Edit: Looks like I may have worked this all out except for 1 last thing lol
Ok, so I had to adjust some of my fan thresholds and I do not have any flashing red warning lights on the server. Now, when I either restart or shutdown/power on the server the fans go to Fan mode 1 (or Full mode) however the script doesn't seem to be activating the fan control script. Once the server has powered on, I can initiate the script by using the screen ./ command however the script to start on post init doesn't seem to be working :(

When I created the fan_startctrl script do I need to place an extension (either .pl or .sh?) and when I go to add this job to the Init/Shutdown scripts what do I place in the command? mnt/Tank/scripts/start_fanctrl or with the extension?

I'm nearly there and its just this last thing and then I am all done :)

Edit 2: I've finally fixed the error :D seems that I forgot to chmod the start_fanctrl.sh script. Damn, this was so tricky (for me at least) and I'm so happy that I've got it all working. Stux, you've definitely nailed it with this script, my server is now whisper quiet and only ramps up fractionally when the 24 drives get a bit warm :) Big thanks mate
 
Last edited:

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Installing script for fan control

It is recommended to place scripts and logs within a dataset instead of boot drive. The fan controller script can be found

https://forums.freenas.org/index.php?threads/script-hybrid-cpu-hd-fan-zone-controller.46159/


Log into server via SSH and create the following folders. Note: this is how I installed my scripts and logs. This will change between users and their preferences.


Scripts folder

mkdir /mnt/Tank/scripts

Log folder

mkdir /mnt/Tank/log

Now, change directory to the newly created scripts folder

cd /mnt/Tank/scripts


Next, place the downloaded hybrid_fan_controller.pl onto the shared server network drive

To open the above (within mnt/Tank/scripts) and edit accordingly:

nano –w hybrid_fan_controller.pl

Press ctrl+r then ctrl+t. Select the file within Nano and edit to the following values

· Debug=2

· Fan speeds for both CPU and HDD (1700 & 3300. These are UNC values of both the CPU fan and the HDD fan wall)

· Fan duty cycles – retain these at 30%

Press ctrl+o, then enter. To exit, press ctrl+x



Create another script called start_fanctrl

nano –w start_fanctrl.sh

Once nano text editor opens, copy the below and right click in editor which will paste the following



Code:
#!/bin/bash

echo "Starting Hybrid Fan Controller..."

/root/hybrid_fan_controller.pl &>> /root/fan_control.log &



Change the directories to the above created folders, so in my scenario


/mnt/Tank/scripts/hybrid_fan_controller.pl & /mnt/Tank/log/fan_control.log


Make the hybrid_fan_controller.pl script executable

chmod a+x hybrid_fan_controller.pl


Then make start_fanctrl.sh executable

chmod a+x start_fanctrl.sh

Testing fan control script


To test, type:

screen ./hybrid_fan_controller.pl


Monitor results, and when satisified that no more parameters need tweaking exit Screen by

Ctrl+a then d

Set script to run on startup

Go into WebGUI within FreeNAS and navigate to:

Tasks -> Init/Shutdown Scripts and click “Add Init/Shutdown Script”

oFrCffI.jpg


Type: Command
Command: mnt/Tank/scripts/start_fanctrl.sh
When: Post Init

And that's it :) Restart or shut down server to confirm start script is running correctly and all done :D
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Is there a good CPU/hdd temp monitoring script anyone would recommend installing?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Is there a good CPU/hdd temp monitoring script anyone would recommend installing?
Why do you think you need one? Burn in your CPU with mprime or something comparable, and make sure the temperature doesn't get too high. Set up SMART monitoring and email alerts on your server, and it will email you when your disks get too hot.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
Is there a good CPU/hdd temp monitoring script anyone would recommend installing?

The log file from the fan controller will log the max hd temp and the CPU temp. As long as it's not at max things are fine too.
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Why do you think you need one? Burn in your CPU with mprime or something comparable, and make sure the temperature doesn't get too high. Set up SMART monitoring and email alerts on your server, and it will email you when your disks get too hot.

Sometimes I just like to log in and check temps randomly. I guess I like fiddling lol

The log file from the fan controller will log the max hd temp and the CPU temp. As long as it's not at max things are fine too.

How can I view the log file?
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
tail -f /mnt/tank/logfilepath

Shows the last few lines, and new lines. Ctrl-c to terminate

IPMI will show you CPU temp.

I have a couple of scripts I use to show hd/CPU temps when I want to see them. Will upload next week.
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
tail -f /mnt/tank/logfilepath

Shows the last few lines, and new lines. Ctrl-c to terminate

IPMI will show you CPU temp.

I have a couple of scripts I use to show hd/CPU temps when I want to see them. Will upload next week.

That'd be awesome! Thanks :D
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
Code:
# cat show_cpu_temps.sh
#! /bin/sh
sysctl -a dev.cpu | egrep -E "dev.cpu\.[0-9]+\.temperature"


And when run, this produces the following output...

Code:
# ./show_cpu_temps.sh
dev.cpu.11.temperature: 40.0C
dev.cpu.10.temperature: 40.0C
dev.cpu.9.temperature: 37.0C
dev.cpu.8.temperature: 38.0C
dev.cpu.7.temperature: 36.0C
dev.cpu.6.temperature: 36.0C
dev.cpu.5.temperature: 39.0C
dev.cpu.4.temperature: 40.0C
dev.cpu.3.temperature: 38.0C
dev.cpu.2.temperature: 38.0C
dev.cpu.1.temperature: 40.0C
dev.cpu.0.temperature: 41.0C


This is how my fan controller reads the CPU temperatures in non-ipmi mode.

And for HD temps, the script is a bit more complicated, so I'll upload a copy, but its stripped out of my fan controller too... so ignore the blurb at the top, and most of the configurables. Can be made more or less verbose by modifying $debug, like the fan controller script.

sample output at debug=2:
Code:
# ./show_hd_temps.pl
2017-09-04 17:30:08: /dev/da0: 35
2017-09-04 17:30:08: /dev/da1: 37
2017-09-04 17:30:08: /dev/da2: 37
2017-09-04 17:30:08: /dev/da3: 35
2017-09-04 17:30:09: /dev/da4: 36
2017-09-04 17:30:09: /dev/da5: 33
2017-09-04 17:30:09: /dev/da6: 38
2017-09-04 17:30:09: /dev/da7: 37
2017-09-04 17:30:09: /dev/da8: 37
2017-09-04 17:30:09: /dev/da9: 33
2017-09-04 17:30:09: /dev/da10: 33
2017-09-04 17:30:09: /dev/da11: 34
2017-09-04 17:30:09: /dev/ada0: 33
2017-09-04 17:30:09: /dev/ada1: 33
2017-09-04 17:30:09: /dev/ada2: 31
2017-09-04 17:30:09: /dev/ada3: 32
2017-09-04 17:30:09: Maximum HD Temperature: 38


And I will sometimes use something like this meta-script (ie just type this direct into a shell)

Code:
# while 1
while? ./show_cpu_temps.sh
while? ./show_hd_temps.pl
while? sleep 30
while? end
 

Attachments

  • show_hd_temps.pl.zip
    2.8 KB · Views: 245

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
Code:
# cat show_cpu_temps.sh
#! /bin/sh
sysctl -a dev.cpu | egrep -E "dev.cpu\.[0-9]+\.temperature"


And when run, this produces the following output...

Code:
# ./show_cpu_temps.sh
dev.cpu.11.temperature: 40.0C
dev.cpu.10.temperature: 40.0C
dev.cpu.9.temperature: 37.0C
dev.cpu.8.temperature: 38.0C
dev.cpu.7.temperature: 36.0C
dev.cpu.6.temperature: 36.0C
dev.cpu.5.temperature: 39.0C
dev.cpu.4.temperature: 40.0C
dev.cpu.3.temperature: 38.0C
dev.cpu.2.temperature: 38.0C
dev.cpu.1.temperature: 40.0C
dev.cpu.0.temperature: 41.0C


This is how my fan controller reads the CPU temperatures in non-ipmi mode.

And for HD temps, the script is a bit more complicated, so I'll upload a copy, but its stripped out of my fan controller too... so ignore the blurb at the top, and most of the configurables. Can be made more or less verbose by modifying $debug, like the fan controller script.

sample output at debug=2:
Code:
# ./show_hd_temps.pl
2017-09-04 17:30:08: /dev/da0: 35
2017-09-04 17:30:08: /dev/da1: 37
2017-09-04 17:30:08: /dev/da2: 37
2017-09-04 17:30:08: /dev/da3: 35
2017-09-04 17:30:09: /dev/da4: 36
2017-09-04 17:30:09: /dev/da5: 33
2017-09-04 17:30:09: /dev/da6: 38
2017-09-04 17:30:09: /dev/da7: 37
2017-09-04 17:30:09: /dev/da8: 37
2017-09-04 17:30:09: /dev/da9: 33
2017-09-04 17:30:09: /dev/da10: 33
2017-09-04 17:30:09: /dev/da11: 34
2017-09-04 17:30:09: /dev/ada0: 33
2017-09-04 17:30:09: /dev/ada1: 33
2017-09-04 17:30:09: /dev/ada2: 31
2017-09-04 17:30:09: /dev/ada3: 32
2017-09-04 17:30:09: Maximum HD Temperature: 38


And I will sometimes use something like this meta-script (ie just type this direct into a shell)

Code:
# while 1
while? ./show_cpu_temps.sh
while? ./show_hd_temps.pl
while? sleep 30
while? end

That's unreal! Thanks a heap Stux :) great work as always

I'm guessing making the script executable (chmod a+x) to be able to run?
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
That's unreal! Thanks a heap Stux :) great work as always

I'm guessing making the script executable (chmod a+x) to be able to run?

That's correct
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
When I place the code in shell

Code:
# while 1
while? ./show_cpu_temps.sh
while? ./show_hd_temps.pl
while? sleep 30
while? end


I get the error "bash: while?: command not found". Is there something I am doing wrong?

I can run the scripts using screen ./ but I can't run in Shell?

Any advice would be great :)
 

Sir SSV

Explorer
Joined
Jan 24, 2015
Messages
96
I'm still having trouble trying to run the meta-script in Shell of FreeNAS.

I keep getting the same error? Not quite sure what I am doing wrong.

On another note, already transferred 16tb to the server! Loving it so far :D
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
When I place the code in shell

Code:
# while 1
while? ./show_cpu_temps.sh
while? ./show_hd_temps.pl
while? sleep 30
while? end


I get the error "bash: while?: command not found". Is there something I am doing wrong?

I can run the scripts using screen ./ but I can't run in Shell?

Any advice would be great :)
Why do you care to run it line by line? Just run the script. Can you explain your thoughts or desired outcome.

Sent from my XT1096 using Tapatalk
 
Status
Not open for further replies.
Top