How to shutdown/reboot/stop array from terminal (CLI) on unRaid 6


Recommended Posts

How do I make a safe array stop, reboot, shutdown in unRaid 6 from terminal?

 

The stop-array here does not work for me anymore (maybe due to my btrf dual drive cache?): https://wiki.lime-technology.com/How-To's

 

When I inspect WebGui's reboot /usr/local/emhttp/plugins/dynamix/include/Boot.php it seems it runs either (but I'm not certain I read the code correctly)

/sbin/reboot

/sbin/poweroff

Is it safe to run these to get proper shutdown of array?

 

In this old post 2014 by dlandon it says DON'T use reboot, but I'm guessing that is deprecated: 

Quote

 

The cli commands built into unRAID are:

- 'powerdown' - to shutdown the server.

 

Do not use:

- 'reboot' - to reboot the server. <-- does not process event scripts.

- 'powerdown -r' - to reboot the server. <-- doesn't reboot - shuts down.

- 'shutdown now' - to shutdown the server. <-- does not process event scripts.

- 'Ctrl-Alt_Del' - to shutdown the server. <-- does not process event scripts.

 


 

 

How can I stop array like in 'good' old days when this don't work: https://wiki.lime-technology.com/Console#To_cleanly_Stop_the_array_from_the_command_line

/usr/local/sbin/emhttp_event stopping_scvs
/usr/local/sbin/emhttp_event unmounting_disks
/usr/local/sbin/samba stop
for i in /dev/md*
do
  echo umount ${i}
  /sbin/umount ${i}
done
/usr/local/sbin/mdcmd stop 

In the above 'mdcmd stop' gives error. I have attached my arraystop script which does the above and a bit more.

arraystop

Link to comment
9 minutes ago, Alex R. Berg said:

How do I make a safe array stop, reboot, shutdown in unRaid 6 from terminal?

 

The stop-array here does not work for me anymore (maybe due to my btrf dual drive cache?): https://wiki.lime-technology.com/How-To's

 

When I inspect WebGui's reboot /usr/local/emhttp/plugins/dynamix/include/Boot.php it seems it runs either (but I'm not certain I read the code correctly)

/sbin/reboot

/sbin/poweroff

Is it safe to run these to get proper shutdown of array?

Yes those two commands will work and properly shut things down.

 

Personally due to muscle memory, I use

 

powerdown -r   for a reset

and 

powerdown     for a shutdown

 

11 minutes ago, Alex R. Berg said:

In this old post 2014 by dlandon it says DON'T use reboot, but I'm guessing that is deprecated: 

The powerdown plugin is deprecated (its been integrated into the OS).  The commands themselves are not.

  • Upvote 3
Link to comment
  • 3 months later...
On 8/18/2017 at 4:18 AM, Alex R. Berg said:

How can I stop array like in 'good' old days when this don't work: https://wiki.lime-technology.com/Console#To_cleanly_Stop_the_array_from_the_command_line

 

In the above 'mdcmd stop' gives error. I have attached my arraystop script which does the above and a bit more.

 

Hi Alex and unRAID community, I'm hoping you can help me out. My unRAID has never really been stable, but that's another matter. Currently I have 2 drives knocked offline and I have replacement drives on standby. I tried stopping the array via the GUI and now I can't access the main page on any computer. I went to the console on the unRAID box itself and saw I still had a directory path of "mnt/Disks" with nothing in it. I also got an email notification that has me worried sick now:

Quote

Event: unRAID array errors
Subject: Notice [TOWER] - array turned good
Description: Array has 0 disks with read errors
Importance: normal

 

I ran your script hoping to close any open files, etc. that might be hanging up the array. When I ran your script I got the following results:

Check running screens
  UID   PID   PENDING   BLOCKED   IGNORED    CAUGHT STAT TTY        TIME COMMAND
    0 10566  00000000  00000000  00000000  73d1fef9 R+   pts/0      0:00 ps

 

Searching for PID 10566 came up empty so I ran your script again. This time I got a different PID, same CAUGHT

Check running screens
  UID   PID   PENDING   BLOCKED   IGNORED    CAUGHT STAT TTY        TIME COMMAND
    0 12492  00000000  00000000  00000000  73d1fef9 R+   pts/0      0:00 ps

 

so I ran it a third time. Again, a different PID, same CAUGHT

Check running screens
  UID   PID   PENDING   BLOCKED   IGNORED    CAUGHT STAT TTY        TIME COMMAND
    0 12608  00000000  00000000  00000000  73d1fef9 R+   pts/0      0:00 ps

 

I still can't access the GUI so i need to shut down. So, my questions are:

* Is it ok to shutdown the unRAID via command line... and if so, how at this point (what's the proper command(s))?

* How do I bring up the array with 2 failed disks if I encounter a situation where unRAID thinks parity needs to be rebuilt with 2 disks knocked offline and the contents are being emulated?

* Also, just curious as to what is this thing that is CAUGHT?

 

Thank you so much for your help, Alex and unRAID community!!!

Edited by Joseph
Clarification
Link to comment

Hi Joseph, 

 

It may be your array just registered the disk as not in the array, possibly the disks are still ok.

 

If possible capture the /var/log/syslog* before rebooting, it is deleted on boot, and may contain important information. Have you seen this: 

 

If the disks are mounted I think its the mdcmd comm which does the array dismount, but it has behaved weirdly for me lately, though I havn't had parity errors afterwards.

 

You can find open files using (useful if umount fails)

sudo lsof | grep mnt

 

If you have unmounted and executed the mdcmd I would use powerdown -r 

 

I have added an updated version of my arraystop script with some more details and some private stop commands like stop docker.

 

Good luck

 

arraystop

Link to comment
3 hours ago, Alex R. Berg said:

If possible capture the /var/log/syslog* before rebooting, it is deleted on boot, and may contain important information. Have you seen this: 

 

If the disks are mounted I think its the mdcmd comm which does the array dismount, but it has behaved weirdly for me lately, though I havn't had parity errors afterwards.

 

You can find open files using (useful if umount fails)

sudo lsof | grep mnt

 

If you have unmounted and executed the mdcmd I would use powerdown -r 

 

I have added an updated version of my arraystop script with some more details and some private stop commands like stop docker.

 

* Thanks for the updated script. I'll give it a shot.

* The disks are not mounted but there's still a "/mnt" path that contains a "/disks" path. Nothing shows up under the "/mnt/disks" path. The email notification suggested the array turned good at some point while I was trying to take it off line. (again, this has me concerned)

* sudo lsof | grep mnt: reports nothing

* /usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument

* See attached syslog.

 

syslog

Link to comment
17 minutes ago, Joseph said:

 

* Thanks for the updated script. I'll give it a shot.

 

Results:

Check running screens
  UID   PID   PENDING   BLOCKED   IGNORED    CAUGHT STAT TTY        TIME COMMAND
    0 30699  00000000  00000000  00000000  73d1fef9 R+   pts/0      0:00 ps
Check running screens, press Enter to continue...
./arraystop: line 5: /usr/sbin/cache_dirs: No such file or directory
Stopping Emby Server...
Stop OK: Not installed
Stopping Transmission...
Stop OK: Already stopped
stopping docker ...
/usr/local/sbin/mdcmd stop
/usr/local/sbin/mdcmd: line 11: echo: write error: Invalid argument
ABOVE NO LONGER WORKS
if disk won't unmount lazy mode may be used to at least avoid further opened files: umount -l. But reboot after doing this, on reboot reiserfs journaling will do some self repair when mounting disks

Check files in use with lsof \| grep mnt
Kill processes with using mnt with fuser -km /mnt/user

Reboot: powerdown -r (or reboot)
Reboot: powerdown (or poweroff)

From the syslog posted above

 

Dec 13 09:36:07 Tower kernel: mdcmd (30): import 29 sdq 3907018532 0 ST4000VN0001-1SF178_Z4F0APX6
Dec 13 09:36:09 Tower kernel: md: import disk29: (sdq) ST4000VN0001-1SF178_Z4F0APX6 size: 3907018532 
Dec 13 09:36:09 Tower emhttp: import 30 cache device: sdd
Dec 13 09:36:09 Tower emhttp: import 31 cache device: sde
Dec 13 09:36:09 Tower emhttp: check_pool: /sbin/btrfs filesystem show 1e110a1d-e24f-4cdf-a087-31b6323b2a10 2>&1
Dec 13 09:38:50 Tower kernel: sd 5:0:3:0: timing out command, waited 180s
Dec 13 09:41:50 Tower kernel: sd 5:0:3:0: timing out command, waited 180s
Dec 13 09:41:50 Tower kernel: sd 5:0:3:0: [sdi] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x00
Dec 13 09:41:50 Tower kernel: sd 5:0:3:0: [sdi] tag#0 CDB: opcode=0x88 88 00 00 00 00 01 5d 50 a2 c0 00 00 00 08 00 00
Dec 13 09:41:50 Tower kernel: blk_update_request: I/O error, dev sdi, sector 5860532928
Dec 13 09:44:50 Tower sudo:     root : TTY=pts/0 ; PWD=/boot ; USER=root ; COMMAND=/usr/bin/lsof
Dec 13 09:44:50 Tower kernel: sd 5:0:3:0: timing out command, waited 180s
Dec 13 09:44:50 Tower kernel: sd 5:0:3:0: [sdi] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x00
Dec 13 09:44:50 Tower kernel: sd 5:0:3:0: [sdi] tag#0 CDB: opcode=0x88 88 00 00 00 00 01 5d 50 a2 c0 00 00 00 01 00 00
Dec 13 09:44:50 Tower kernel: blk_update_request: I/O error, dev sdi, sector 5860532928
Dec 13 09:44:50 Tower kernel: Buffer I/O error on dev sdi1, logical block 5860532864, async page read
Dec 13 09:44:50 Tower kernel: sd 5:0:3:0: timing out command, waited 180s
Dec 13 09:44:50 Tower kernel: sd 5:0:3:0: [sdi] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x00
Dec 13 09:44:50 Tower kernel: sd 5:0:3:0: [sdi] tag#0 CDB: opcode=0x88 88 00 00 00 00 01 5d 50 a2 c1 00 00 00 01 00 00
Dec 13 09:44:50 Tower kernel: blk_update_request: I/O error, dev sdi, sector 5860532929
Dec 13 09:44:50 Tower kernel: Buffer I/O error on dev sdi1, logical block 5860532865, async page read

Is this implying there's issues with the Parity Disk 2 (sdq) and cache disks (sdd, sde)?

Link to comment

The "CAUGHT" thing is because "screen" isn't running.  Don't worry about it.

 

At the end of the day, you're going to be better off with a simple 

powerdown -r

 

Because

  1. It almost everything listed in the script.  (Notable exception is killing screen, but you can have the Tips&Tweaks plugin do that for you at shutdown / restart)
  2. Does it correctly, in the correct order, and is not tied to the setup of the script creator (IE: its not stopping VMs, unmounting the docker image (problem if it exists on an array drive))
  3. There's probably a ton more that it does that this script doesn't do (eg: stops mover if its running prior to umounting the drives)
  4. Is updated accordingly as unRaid changes / evolves
17 hours ago, Joseph said:

saw I still had a directory path of "mnt/Disks" with nothing in it

Won't affect anything.  Its just UD not deleting the folder it creates for its mounts

 

17 hours ago, Joseph said:

* How do I bring up the array with 2 failed disks if I encounter a situation where unRAID thinks parity needs to be rebuilt with 2 disks knocked offline and the contents are being emulated?

Create a separate thread for this.  Include your diagnostics.  People that are most capable of helping you are not going to see this in a thread subject of Stopping The Array from the CLI

 

22 minutes ago, Joseph said:

Is this implying there's issues with the Parity Disk 2 (sdq) and cache disks (sdd, sde)?

Certainly looks that way (but could simply be cabling).  But, see the line above.

 

Other Comment:

 

The very rare times that I get the webUI stuck on unmounting drives, its usually because I've got an SSH session open to /mnt/user/... which will definitely prevent a umount.  Closing the session fixes that.

 

Even rarer, when for whatever reason an application has crashed and left a file open preventing a umount via GUI / CLI powerdown I simply reset the server.  (And then cancel the parity check. - All the applicable services have already been stopped, No apps should be left running, the file systems have already been synced.  IE: No parity Check errors should result)

  • Like 1
Link to comment
2 minutes ago, Squid said:

Create a separate thread for this.  Include your diagnostics.  People that are most capable of helping you are not going to see this in a thread subject of Stopping The Array from the CLI

 

Certainly looks that way (but could simply be cabling).  But, see the line above.

Will do....thanks!!!

Link to comment
  • 5 years later...

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.