Add subvolume migration feature and clean up logging. Speed up process.
This commit is contained in:
parent
e0b7b00f0a
commit
40a03a2499
2 changed files with 177 additions and 128 deletions
112
README.md
112
README.md
|
@ -1,11 +1,12 @@
|
|||
# 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 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.
|
||||
* 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.
|
||||
|
@ -44,58 +45,61 @@ root@readynasos:#/ bash -x /root/share_lun_ui_fix.sh
|
|||
### 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. |
|
||||
=================================================
|
||||
===================================
|
||||
* 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:~#
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue