How to Let Drives Spin Down

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
Can I just set the home directory location for my user to one of the shares I already have up and working? I don't have any permission issues with those.
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
I'm not sure I fully understand exactly what is going on. In the web gui, if you click on the Storage icon, you should see something like this:
Screen Shot 2016-02-04 at 5.49.39 AM.png

The first line is the volume, in my case Ark. The second line is a root dataset of the same name, created automatically. My experience is that you should not change any settings or share the root dataset. Instead, create datasets inside it and share them. So Attic, etc. are datasets that I created and are shared. The dataset Jim is my home directory; it was created automatically when I set up my user.

So in your case, you mention the dataset 'mainVolume'. That sounds like the root dataset and you should not be messing with it. By default its user/group are root/wheel and that's the way I would leave it. Here is the permissions dialog for a root dataset:
Screen Shot 2016-02-04 at 6.04.27 AM.png


My suggestion is to revert your root dataset to this state, remove any shares, get your home directory set up, and create a share for it and anything else you want.
 
Last edited:

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437
Looks like you got all the requirements down for spinning down the drives.. There is a script for checking drive status somewhere.. As for spinning down I find it pointless these days.. Could have a point in installation where it asks for your intentions on power saving settings but I find it has serious performance penalties and not enough savings to make worthwhile..
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
Sorry I wasted so much of your time, I didn't realize I had to create a dataset first. The way I read what you wrote, it looked like the dataset would be automatically created when I changed the home directory for the user. Anyway, the share is working correctly now and under the user I am using, I have the home directory pointed at the new dataset. I copied the script to notepad, replaced WDC with ST and saved to the home directory. It saved as "spincheck.sh.txt" so I changed it to "spincheck.sh". I then opened putty and logged in with the user that has the new home directory. I ran "chmod +x spincheck.sh" and was told "Operation not permitted". I don't really know what to do from here. I do appreciate all your help and patience with me and would understand if you have better things to do. I would like to figure this out though, not so much for spinning down the HDDs, but simply to learn my way around FreeNAS better. I did double check and my user has the permit sudo box checked, not sure if that makes a difference. Below is my devlist. I also don't know how to post code, I hope I did it right.


Code:
[root@freenas] ~# camcontrol devlist
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 8 lun 0 (pass0,da0)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 9 lun 0 (pass1,da1)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 10 lun 0 (pass2,da2)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 11 lun 0 (pass3,da3)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 12 lun 0 (pass4,da4)
<ATA ST4000DM000-1F21 CC52>  at scbus0 target 13 lun 0 (pass5,da5)
<ATA ST4000DM000-1F21 CC52>  at scbus0 target 14 lun 0 (pass6,da6)
<ATA ST4000VN000-1H41 SC46>  at scbus0 target 15 lun 0 (pass7,da7)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 16 lun 0 (pass8,da8)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 17 lun 0 (pass9,da9)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 18 lun 0 (pass10,da10)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 19 lun 0 (pass11,da11)
<ATA ST4000DM000-1F21 CC52>  at scbus0 target 20 lun 0 (pass12,da12)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 21 lun 0 (pass13,da13)
<ATA ST4000DM000-1F21 CC52>  at scbus0 target 22 lun 0 (pass14,da14)
<ATA ST4000DM000-1F21 CC54>  at scbus0 target 23 lun 0 (pass15,da15)
<HP HP SAS EXP Card 2.08>  at scbus0 target 24 lun 0 (ses0,pass16)
<SanDisk SDSSDA120G U21010RL>  at scbus2 target 0 lun 0 (ada0,pass17)
<ST2000DM001-9YN164 CC9C>  at scbus3 target 0 lun 0 (ada1,pass18)
<ST2000DM001-9YN164 CC9C>  at scbus5 target 0 lun 0 (ada2,pass19)
<ST2000DM001-9YN164 CC9C>  at scbus6 target 0 lun 0 (ada3,pass20)
 

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
Also maybe of note, is that in order to get my devlist, I had to run "camcontrol devlist" as root. I tried with the user I created, but was told "Permission denied".
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Also maybe of note, is that in order to get my devlist, I had to run "camcontrol devlist" as root. I tried with the user I created, but was told "Permission denied".
Wow, you have a bunch of disks there!
sudo before a command allows you to act more or less like root after it checks your password. I'm guessing, however it happened, you are not the owner of the script. So, in your home directory, do
sudo chown <userName> spincheck.sh
'chown' is change owner. Then you should be able to do the chmod command without sudo, because it's your file. But you could just do
sudo chmod +x spincheck.sh
to be sure. chmod is change mode, referring to permissions.
ls -l (lower-case L)
lets you see permissions, owner, and group for all files and directories in a directory. ls is list, the -l option is the long form of a list.

Similarly, you don't need to log in as root to do camcontrol devlist. sudo will let you do it. Another option is simply typing 'su'. When it asks for a password, you have to enter the root password. Then you have super privileges for the rest of the session, or until you type 'exit' to get back to your user.

The home directory creation thing - When you first make a user, you have the option to have a home directory automatically created for him. I don't know if that can be done retroactively. But sounds like you got that part figured out.
 

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
So I ran sudo chown <userName> spincheck.sh then it ask for a password, I entered my users password, then another command prompt came up. There was no confirmation or anything. I then ran chmod +x spincheck.sh and was told
"Operation not permitted". Next I ran "sudo chmod +x spincheck.sh" and was told "Operation not permitted". I ran chmod -ls then chmod -l then chmod -ls spincheck.sh then chmod -l spincheck.sh and each time returned "usage: chmod [-fhv] [-R [-H | -L | -P]] mode file ...". Next I typed su and entered root password, then entered sudo chmod +x spincheck.sh which returned "Sorry, user root is not allowed to execute '/bin/chmod +x spincheck.sh' as root on freenas.local". Next I typed sudo ./spincheck.sh and was told "Sorry, user root is not allowed to execute './spincheck.sh' as root on freenas.local". You are right about about devlist too, I can get it using sudo.
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Yeah, chmod -ls and such doesn't make sense. Can you just go into your user's home directory and run
Code:
ls -l

and post the result? Let's see what it says about spincheck.sh.

When you typed su, then the root password, you were esssentially turned into root. At that point, there is no need to use sudo, and it may actually make the commands fail.

Either use sudo with each command OR use su once by itself, then it sticks for the session. Don't do both.
 

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
Behemoth is my user.
Code:
drwxrwxr-x+ 2 Behemoth  wheel  4 Feb  4 13:02 ./
drwxrwxr-x+ 6 root  wheel  7 Feb  4 06:43 ../
-rw-r--r--  1 root  wheel  0 Feb  4 06:43 .windows
-rwxrwxr-x+ 1 Behemoth  wheel  2411 Feb  4 13:02 spincheck.sh*
 

rsquared

Explorer
Joined
Nov 17, 2015
Messages
81
When you created the dataset, did you choose Windows permissions? If so, that would explain why you can't chmod.
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
When you created the dataset, did you choose Windows permissions? If so, that would explain why you can't chmod.
Well, in any case the script has execute privileges for everyone, so at some point chmod +x must have worked. And it is owned by Behemoth, presumably the user name.

@paylesspizzaman, the script should run now. Either do sudo ./spincheck.sh, or, if you have done su already, do it without the sudo.

This will not create the log unless you add the | tee spincheck.log
 

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
I ran it first as my user then as SU. This is what I got.
Code:
[Behemoth@freenas] ~% sudo ./spincheck.sh
Password:
sudo: unable to execute ./spincheck.sh: No such file or directory

[Behemoth@freenas] ~% su
Password:
[Behemoth@freenas] /mnt/MainVolume/Behemoth-Home# ./spincheck.sh
./spincheck.sh: Command not found.
[Behemoth@freenas] /mnt/MainVolume/Behemoth-Home#
 

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
I have to leave for work now. Not sure if I can continue over VPN or not, but I will try when I get to work if I'm not busy. Thanks again for all your time and help. If at any point you want to give up on me, I won't get upset.
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
That's puzzling. Are you sure the directory that you showed the listing for previously and the one you're trying to run the script in are the same?

We can't let the machines win - any of them. Otherwise they might start giving US commands. :)
 
Last edited:

paylesspizzaman

Explorer
Joined
Sep 1, 2015
Messages
92
I destroyed the old dataset, created a new one, selected the dataset as the home directory for my user Behemoth, copied the original spincheck.sh to the new dataset and ran a few commands. What do all the letters in front mean? Also, does this prove the file is in the correct location?
Code:
[Behemoth@freenas] ~% ls -l
total 27
drwxrwxr-x+ 2 Behemoth  wheel  3 Feb  4 18:33 ./
drwxrwxr-x+ 6 root  wheel  7 Feb  4 18:30 ../
-rwxrwxr-x+ 1 Behemoth  wheel  2411 Feb  4 13:02 spincheck.sh*
[Behemoth@freenas] ~% sudo ./spincheck.sh
Password:
sudo: unable to execute ./spincheck.sh: No such file or directory
[Behemoth@freenas] ~% su
Password:
[Behemoth@freenas] /mnt/MainVolume/BehemothTest# ls -l
total 27
drwxrwxr-x+ 2 Behemoth  wheel  3 Feb  4 18:33 ./
drwxrwxr-x+ 6 root  wheel  7 Feb  4 18:30 ../
-rwxrwxr-x+ 1 Behemoth  wheel  2411 Feb  4 13:02 spincheck.sh*
[Behemoth@freenas] /mnt/MainVolume/BehemothTest# ./spincheck.sh
./spincheck.sh: Command not found.
 

Montel Bahn

Dabbler
Joined
Oct 12, 2015
Messages
40
OMG,

Permission to speak freely? What the fsck's the difference between 'Standby' and Spindown? Specifically in the GUI behavior?

Old thread from 2012:
'View Disks has entries for both "HDD Standby" and "Advanced Power Management." I don't understand if these are configured together, are complimentary or antagonistic in their use, are there any other settings i must configure/turn on. I want the drives to spin down after not being used but with the new fn8.0.4 I am not sure if they are doing that by using the HDD Standby. Documentation and forums are scant in discussion AFAIK.'

ZFS is designed to use commodity hardware and obviously there is huge demand for HDD spindown. If someone is backing up their precious files every few days and doing a scrub once a month on 8 drives, they don't need to hear the disk drive heads seeking continuously in their office. Home NAS HDDs alone easily use 50-100$/year in electricity at 10cents/KwH. (for 4 to 8 drives).

This is a frequent topic in the forums, and I know FreeNAS is Free.. as in beer, but I'm a noob and even I can see this gives OSS, FreeBSD and IX a bad image.
Why document a feature, give the toggle box, or drop down option, then lead us all down a rat hole of troubleshooting.
(BTW, is there a section in release notes, or anywhere, that explains 'Known issues"?)
{{Seems to me there are LOTS of known issues that span many releases over YEARS!}}

Now to stop ranting and provide what little technical debugging info can be expected of my humble self...

Is it simply that the suggested swap partitions, of 2GB per drive, are not letting my pool 'sleep'?
What are they used for anyways?? I have 48GB of ram and only 12TB of usable storage?
This doesn't seem like a 'sane default'.

More likely it seems like the collectd process won't STFU.

I KNOW these can be complex issues, but seriously? No explanations forthcoming?
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
I destroyed the old dataset, created a new one, selected the dataset as the home directory for my user Behemoth, copied the original spincheck.sh to the new dataset and ran a few commands. What do all the letters in front mean? Also, does this prove the file is in the correct location?
I'm a bit befuddled why the shell is unable to find the script when it is right there.

The letters in front are permissions. You'll need to start doing a bit of independent research. Briefly, the first is d if directory, otherwise -.

There are 9 more:
3 for user, 3 for group, then 3 for everyone else.
Each group of three is r for read, w for write, and x for execute.

So for spincheck.sh,
owner and group both have read, write, and execute permission.
everyone else has read and execute permission.
 
Top