This script finds shares that were accidentally broken in the UI and fixes it.
Go to file
Cody Cook 6a00479546 Merge branch 'FixSnapper' into 'master'
Fix snapper

See merge request readynas-scripts/share_lun_ui_fix.sh!11
2019-04-01 23:57:12 -07:00
.gitlab-ci.yml Add shellcheck fixes and enhancements 2018-10-08 22:27:39 -07:00
README.md Add subvolume migration feature and clean up logging. Speed up process. 2019-04-01 23:07:08 -07:00
share_lun_ui_fix.sh Fix snapper integration by correctly using the right directory for snapshot configurations. 2019-04-01 23:57:12 -07:00

README.md

Share/LUN UI Fix Script

This script finds shares that were accidentally broken in the UI and fixes it. Additionally, performs migration of created folders in the roots of volumes to btrfs subvolume.

Prerequisites

  • You should use this script with ReadyNAS OS 6.10.0 or newer. This script contains configuration file data for 6.10.0 that may or may not work with older versions of ReadyNASOS.
  • 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.10.0 *
===================================
= [Info] Share config backups folder exist (/var/backups/shares)
== [Task] Backing up existing share config backup folder
=== [Info] Completed share config backup folder.
=== [Task] Listing backup folder for a quick analysis
2019-04-01 22:56:12.198942551 -0700 71680 /var/backups/shares/shares.tar.0
2019-04-01 22:50:02.066740050 -0700 2058 /var/backups/shares/shares.tar.1.gz
2019-04-01 21:40:46.250729403 -0700 2012 /var/backups/shares/shares.tar.2.gz
2019-04-01 15:30:49.968039883 -0700 1754 /var/backups/shares/shares.tar.3.gz
2019-04-01 15:28:44.033709334 -0700 1753 /var/backups/shares/shares.tar.4.gz
==== [Info] Review backup folder listing and decide to continue or restore.
==== [Decide] To cancel and manually restore from an above config, CTRL-C now... Otherwise, continuing in 5... 4... 3... 2... 1... 0...
= [Task] Discovering volumes
== [Info] 1 volume(s) found.
== [Task] Investigating volume /data...
=== [Info] Number of items found : 6
=== [Info] Items found: Documents ImFake LUN1 Music Pictures Videos
=== [Task] Reviewing Documents
=== [Info] Found share at /data/Documents
=== [Task] Recreating share configs.
==== [Info] Done with Share /data/Documents.
=== [Task] Reviewing ImFake
=== [Task] Adding /data/ImFake to subvolume migration list.
=== [Task] Reviewing LUN1
=== [Task] Recreating config for LUN at /data/LUN1..
==== [Info] done with LUN /data/LUN1.
=== [Task] Reviewing Music
=== [Info] Found share at /data/Music
=== [Task] Recreating share configs.
==== [Info] Done with Share /data/Music.
=== [Task] Reviewing Pictures
=== [Info] Found share at /data/Pictures
=== [Task] Recreating share configs.
==== [Info] Done with Share /data/Pictures.
=== [Task] Reviewing Videos
=== [Info] Found share at /data/Videos
=== [Task] Recreating share configs.
==== [Info] Done with Share /data/Videos.
== [Task] Subvolume Migrations required: 1
== [Info] Subvolume Migrations list:  ImFake
=== [Warning] Do not interrupt this process. Doing so may result in an incomplete migration.
=== [Decide] If you want to terminate now, CTRL-C...Continuing in 5... 4... 3... 2... 1... 0...
=== [Task] Subvolume Migrating /data/ImFake
=== [Task] Creating replacement btrfs subvolume
==== [Task] Migrating data to the new subvolume
===== [Success] migrating /data/ImFake to a btrfs subvolume.
=== [Info] Found share at /data/ImFake
=== [Task] Recreating share configs.
=== [Info] done with /data/ImFake.
= [Info] done with /data
= [Task] Restarting readynasd to apply changes.
[Stats] Rebuilt Share configs: 5
[Stats] Rebuilt LUN configs: 1
[Stats] Migrated folders to subvolumes: 1
root@rn524x:~#