This script finds shares that were accidentally broken in the UI and fixes it.
Find a file
Cody Cook e0b7b00f0a Merge branch '610' into 'master'
Fix home folder and add btrfs subv checker

See merge request readynas-scripts/share_lun_ui_fix.sh!8
2019-04-01 11:30:57 -07:00
.gitlab-ci.yml Add shellcheck fixes and enhancements 2018-10-08 22:27:39 -07:00
README.md Fix spelling mistake 2018-10-02 12:28:07 -07:00
share_lun_ui_fix.sh There are several times where customers are 2019-04-01 11:30:57 -07:00

Share/LUN UI Fix Script

This script finds shares that were accidentally broken in the UI and fixes it.

Prerequisites

  • You need to be on ReadyNAS OS 6.9.4 or newer. This script contains configuration file data for 6.9.4 that may or may not work with older versions.
  • Either the ReadyNAS needs internet access or you need to copy/paste the data into a file on the NAS via SSH. ** For internet access, ensure you can reach the internet and DNS is working properly.
  • This does not work in Tech Support mode. You must be in Normal mode and readynasd needs to be running.

Running

Network-enabled ReadyNAS (Automatic)

To quickly resolve the shares and LUNs not showing in the UI, you can copy/paste the following command into a terminal and the script will automatically run.

root@readynasos:#/ curl -s https://gitlab.codycook.us/readynas-scripts/share_lun_ui_fix.sh/raw/master/share_lun_ui_fix.sh | bash

Refresh the UI and the shares should be restored.

Internet-disabled ReadyNAS (Manual)

  • Download the contents of https://gitlab.codycook.us/readynas-scripts/share_lun_ui_fix.sh/raw/master/share_lun_ui_fix.sh
  • Copy the data into your clipboard.
  • In the ReadyNAS terminal, type: vi /root/share_lun_ui_fix.sh
  • Push i to enter insert mode, then right click into the console. This will paste your clipboard (in most cases). Only click once.
  • Push esc and then type :wq then hit enter.
  • Type chmod +x /root/share_lun_ui_fix.sh then type /root/share_lun_ui_fix.sh
  • The script will run.

Acquiring debug information

If this script fails or produces an error, please run the following command and submit an issue.

root@readynasos:#/ curl -s https://gitlab.codycook.us/readynas-scripts/share_lun_ui_fix.sh/raw/master/share_lun_ui_fix.sh | bash -x

or if you used the manual process,

root@readynasos:#/ bash -x /root/share_lun_ui_fix.sh

Sample Output

Standard Output

root@rn524x:~# curl -s https://gitlab.codycook.us/readynas-scripts/share_lun_ui_fix.sh/raw/master/share_lun_ui_fix.sh | bash
===============================
Share and iSCSI Rebuild v6.9.4
===============================
NOTE: This version of readynasd creates share backups in /var/backups/shares.
      When possible, you should try and restore a valid backup config from this directory.
      This share config gets rebuilt every time readynasd restarts. Because of this, we'll make a backup of the existing share backups before proceeding.
Generating backup config...... done! Backup complete!
=============================================
====== Listing Available Share Backups ======
=============================================
total 1.3M
drwxr-x--- 1 root root  144 Oct  2 04:20 .
drwxr-xr-x 1 root root  866 Oct  2 10:31 ..
-rw-r--r-- 1 root root 750K Oct  2 04:20 shares.tar.0
-rw-r--r-- 1 root root 124K Oct  1 04:20 shares.tar.1.gz
-rw-r--r-- 1 root root 124K Sep 30 04:20 shares.tar.2.gz
-rw-r--r-- 1 root root 124K Sep 29 04:20 shares.tar.3.gz
-rw-r--r-- 1 root root 124K Sep 28 04:20 shares.tar.4.gz
=============================================
See the last modified dates and determine if you can restore from that config or not instead of using this script.
It is best to pick a date before the shares disappeared from readynasd.
=============================================
If you want to cancel and manually restore from one of these configs, CTRL-C now...
Otherwise, continuing in 10... 9... 8... 7... 6... 5... 4... 3... 2... 1... 0...
Querying readynasd for list of volumes...
4 volume(s) found.
Beginning in 3... 2... 1...
===============================
=== All right!  Time to go! ===
===============================
= Investigating volume /vol1...
= Objects found: fromharry
== Reviewing fromharry
=== Found share at /vol1/fromharry... recreating share configs.... done with /vol1/fromharry.
= done with /vol1
= Investigating volume /vol2...
= Objects found: luntest
== Reviewing luntest
=== Found LUN at /vol2/luntest... recreating iSCSI configs.... done with /vol2/luntest.
= done with /vol2
= Investigating volume /vol3...
No shares or LUNs found.
= done with /vol3
= Investigating volume /vol4...
= Objects found: outrunner
== Reviewing outrunner
=== Found share at /vol4/outrunner... recreating share configs.... done with /vol4/outrunner.
= done with /vol4
*** Restarting readynasd to finish changes... ***
=================================================
| Completed share creation! We were able to     |
| rebuild 2 shares and 1 LUNs.                  |
=================================================
root@rn524x:~#