Jump to content

Have I done something stupid?


Recommended Posts

Hi all,

 

This is my situation : I have an UnRaid array with 3 HGST drives in it.  Everything runs file.  Just one snag: Fix common problems reports that for some reason the write cache of these disks is disabled.  I can enable it with HDPARM no problem, but after the next reboot I have to redo it. 

 

So I figured I'd make a batch file to do this and have it run at startup.  Created the batch file, made it executable, tested it, worked fine.

 

Then came the moment I'd have to get this to run at startup.  I have little to no Linux experience, but I try.  I googled around and found that I could do this with a Cronjob (looked hard), but one site also said : "Put a script containing the command in your /etc directory. Create a script such as "startup.sh" using your favorite text editor. Save the file in your /etc/init.d/ directory."  I figured this was about the same as the Windows "startup" folder and did the following : mv startup.sh /etc/init.d 

This worked, but when I checked,  I found the /etc directory didn't contain a directory called init.d, but only a file.  Even more, the file contained only what I had put into that batch file! 😬

 

I rebooted the system and it started up.  Even more, it seems to  have worked, because Fix Common Problems doesn't report a problem any more.  All works fine (for now?), but I'm afraid I also overwrote important stuff that was in init.d before and I could run into problems because of this in the future.

 

So, have I done something stupid and, if so, how can I fix this?

 

Cheers!

Link to comment

The problem with what you did was the change was only in RAM so did not survive a reboot.  Unraid runs from RAM so when you reboot you get a fresh copy of Unraid unpacked from the archive on the flash drive and loaded into RAM.  The easiest way to do run a script that survives a reboot is be to install the User Scripts plugin and use that to run the script.   

 

Link to comment

Ah, that's good news I guess! :)  But how come Fix Common Problems doesn't find a problem with the write cache any more now?  Or does the system have to completely power down for that?

 

I'll have a look at that User Scripts plugin.  Didn't know that existed.... 

 

Thanks a lot!

Link to comment
3 minutes ago, BartDG said:

But how come Fix Common Problems doesn't find a problem with the write cache any more now?  Or does the system have to completely power down for that?

It is possible that the drive itself has remembered the new setting.   You probably need to go through a power cycle sequence to see if it sticks in such a case.

 

Link to comment

Indeed.  Which I guess is the reason it overwrote the file instead of putting it in a directory.  In hindsight, there doesn't seem to be an init.d file in UnRaid, so this wasn't really a problem I guess, but I wasn't comfortable with it nonetheless. 

I've now installed the User Scripts plugin and created a correct script for my problem.  Works excellently. 

 

Thanks again for the help, and the speed of which I got helped.  Not the first time I might add.  This really is one of the friendliest/most helpful communities I've ever had the pleasure of dealing with. 👍😀

 

Cheers!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...