@ -0,0 +1,110 @@ |
|||
# Common settings that generally should always be used with your language specific settings |
|||
|
|||
# Auto detect text files and perform LF normalization |
|||
* text=auto |
|||
|
|||
# |
|||
# The above will handle all files NOT found below |
|||
# |
|||
|
|||
# Documents |
|||
*.bibtex text diff=bibtex |
|||
*.doc diff=astextplain |
|||
*.DOC diff=astextplain |
|||
*.docx diff=astextplain |
|||
*.DOCX diff=astextplain |
|||
*.dot diff=astextplain |
|||
*.DOT diff=astextplain |
|||
*.epub diff=astextplain |
|||
*.pdf diff=astextplain |
|||
*.PDF diff=astextplain |
|||
*.rtf diff=astextplain |
|||
*.RTF diff=astextplain |
|||
*.md text diff=markdown |
|||
*.mdx text diff=markdown |
|||
*.tex text diff=tex |
|||
*.adoc text |
|||
*.textile text |
|||
*.mustache text |
|||
*.tab text |
|||
*.tsv text |
|||
*.txt text eol=lf |
|||
*.sql text |
|||
*.csv text eol=crlf |
|||
|
|||
# Graphics |
|||
*.png binary |
|||
*.jpg binary |
|||
*.jpeg binary |
|||
*.gif binary |
|||
*.tif binary |
|||
*.tiff binary |
|||
*.ico binary |
|||
*.eps binary |
|||
# SVG treated as text by default. |
|||
*.svg text |
|||
# If you want to treat it as binary, |
|||
# use the following line instead. |
|||
# *.svg binary |
|||
|
|||
# Scripts |
|||
*.bash text eol=lf |
|||
*.fish text eol=lf |
|||
*.ksh text eol=lf |
|||
*.py text eol=lf |
|||
*.php text eol=lf |
|||
*.sh text eol=lf |
|||
*.zsh text eol=lf |
|||
# These are explicitly windows files and should use crlf |
|||
*.bat text eol=crlf |
|||
*.cmd text eol=crlf |
|||
*.ps1 text eol=crlf |
|||
|
|||
# Visual Dialog Script |
|||
*.dsc text eol=crlf |
|||
*.dsp text eol=crlf |
|||
|
|||
# Config files |
|||
*.ini text eol=crlf |
|||
*.conf text eol=lf |
|||
|
|||
# Serialisation |
|||
*.json text |
|||
*.toml text |
|||
*.xml text |
|||
*.yaml text |
|||
*.yml text |
|||
|
|||
# Archives |
|||
*.7z binary |
|||
*.bz binary |
|||
*.bz2 binary |
|||
*.bzip2 binary |
|||
*.gz binary |
|||
*.lz binary |
|||
*.lzma binary |
|||
*.rar binary |
|||
*.tar binary |
|||
*.taz binary |
|||
*.tbz binary |
|||
*.tbz2 binary |
|||
*.tgz binary |
|||
*.tlz binary |
|||
*.txz binary |
|||
*.xz binary |
|||
*.Z binary |
|||
*.zip binary |
|||
*.zst binary |
|||
|
|||
# Text files where line endings should be preserved |
|||
*.patch -text |
|||
|
|||
# |
|||
# Exclude files from exporting |
|||
# |
|||
|
|||
.gitattributes export-ignore |
|||
.gitignore export-ignore |
|||
.gitkeep export-ignore |
|||
.github/ export-ignore |
|||
images/ export-ignore |
|||
@ -0,0 +1,3 @@ |
|||
github: 007revad |
|||
buy_me_a_coffee: 007revad |
|||
custom: ["https://www.paypal.me/007revad"] |
|||
@ -0,0 +1,136 @@ |
|||
## 2025 series or later Plus models |
|||
|
|||
### UPDATE 7 Oct 2025 |
|||
|
|||
**DSM 7.3** has removed the many of the restrictions that were in DSM 7.2.2 for 2025 Plus models. |
|||
|
|||
See https://kb.synology.com/en-global/DSM/tutorial/Drive_compatibility_policies |
|||
|
|||
The restrictions that remain in DSM 7.3 for 2025 Plus models are: |
|||
1. You cannot create a cache or volume on 3rd party NVMe drives. |
|||
2. You still see lots of warnings in storage manager when using unverified 3rd party drives. |
|||
|
|||
Both 1 and 2 can be solved with [Synology HDD db](https://github.com/007revad/Synology_HDD_db) |
|||
|
|||
<br> |
|||
|
|||
### Unverified 3rd party drive limitations and unofficial solutions for DSM 7.2.2 |
|||
|
|||
| Action | Works | Result | Solution | |
|||
|--------|--------------|--------|----------| |
|||
| Setup the NAS with Synology drives | yes | | | |
|||
| Setup the NAS with 3rd party SSDs | yes | Lots of warnings | Remove warnings with [Synology HDD db](https://github.com/007revad/Synology_HDD_db) | |
|||
| Setup the NAS with unverified 3rd party HDDs | **No!** | | See <a href="#setting-up-a-new-2025-or-later-plus-model-with-only-unverified-hdds">Setup with unverifed HDDs</a> | |
|||
| Migrate unverified 3rd party drives from other Synology | yes | Lots of warnings | Remove warnings with [Synology HDD db](https://github.com/007revad/Synology_HDD_db) | |
|||
| Migrate unverified 3rd party drives and NVMe cache from other Synology | yes | Lots of warnings | Remove warnings with [Synology HDD db](https://github.com/007revad/Synology_HDD_db) | |
|||
| Replace migrated 3rd party drives with 3rd party drives | **No!** | | Use [Synology HDD db](https://github.com/007revad/Synology_HDD_db) | |
|||
| Gradually replace migrated 3rd party drives with Synology drives | yes | Lots of warnings until all 3rd party drives replaced | Use [Synology HDD db](https://github.com/007revad/Synology_HDD_db) See [Migration and Drive Replacement](https://github.com/007revad/Synology_HDD_db/discussions/468#discussioncomment-13086639) | |
|||
| Expand migrated 3rd party storage pool with 3rd party drives | **No!** | | Use [Synology HDD db](https://github.com/007revad/Synology_HDD_db) | |
|||
| Use 3rd party drive as hot spare | **No!** | | Use [Synology HDD db](https://github.com/007revad/Synology_HDD_db) | |
|||
| Create a cache with 3rd party SSDs | **No!** | | Use [Synology HDD db](https://github.com/007revad/Synology_HDD_db) | |
|||
| Delete and create storage pool on migrated 3rd party drives | **No!** | | See <a href="#deleting-and-recreating-your-storage-pool-on-unverified-hdds">Recreating storage pool</a> | |
|||
|
|||
<br> |
|||
|
|||
### Setting up a new 2025 or later plus model with only unverified HDDs in DSM 7.2.2 |
|||
|
|||
Credit to Alex_of_Chaos on reddit |
|||
|
|||
DSM won't install on a 2025 or later series plus model if you only have unverified HDDs. But we can get around that. |
|||
|
|||
1. Start telnet by entering `http://<NAS-IP>:5000/webman/start_telnet.cgi` into your browser's address bar. |
|||
- Replace `<NAS-IP>` with the IP address of the Synology NAS. |
|||
2. Open a telnet client (powershell, PuTTY etc) on your computer and connect to the Synology with 'telnet <NAS-IP>`. |
|||
- Replace `<NAS-IP>` with the IP address of the Synology NAS. |
|||
3. Log into telnet with: |
|||
- `root` for the login |
|||
- `101-0101` for the password |
|||
4. Execute the following command: (using a while loop in case DSM is running in a VM) |
|||
``` |
|||
while true; do touch /tmp/installable_check_pass; sleep 1; done |
|||
``` |
|||
5. Refresh the web installation page and install DSM. |
|||
6. Then in the telnet window, or via SSH, execute the following command: |
|||
``` |
|||
/usr/syno/bin/synosetkeyvalue /etc.defaults/synoinfo.conf support_disk_compatibility no |
|||
``` |
|||
7. If Storage Manager is already open close then open it, or refresh the web page. If refreshing the page or restarting Storage Manager is not working, try restarting your Synology NAS. |
|||
8. You can now create your storage pool from Storage Manager. |
|||
|
|||
<br> |
|||
|
|||
### Deleting and recreating your storage pool on unverified HDDs in DSM 7.2.2 |
|||
|
|||
You can't download Synology HDD db to a volume because you've just deleted your storage pool. So you'd first need to download Synology HDD db to a system folder and run it from there. |
|||
|
|||
You can do this via SSH or via a scheduled task. |
|||
|
|||
#### Via SSH |
|||
|
|||
1. Create and cd to /opt |
|||
``` |
|||
sudo mkdir /opt && sudo chmod 775 /opt |
|||
``` |
|||
|
|||
2. Create /opt |
|||
``` |
|||
sudo mkdir -m775 /opt |
|||
``` |
|||
|
|||
2. cd to /opt |
|||
``` |
|||
cd /opt || (echo "Failed to CD to /opt"; exit 1) |
|||
``` |
|||
|
|||
3. Download syno_hdd_db.sh to /opt |
|||
``` |
|||
sudo curl -O "https://raw.githubusercontent.com/007revad/Synology_HDD_db/refs/heads/main/syno_hdd_db.sh" |
|||
``` |
|||
|
|||
4. Download syno_hdd_vendor_ids.txt to /opt |
|||
``` |
|||
sudo curl -O "https://raw.githubusercontent.com/007revad/Synology_HDD_db/refs/heads/main/syno_hdd_vendor_ids.txt" |
|||
``` |
|||
|
|||
5. Then set permissions on /opt/syno_hdd_db.sh |
|||
``` |
|||
sudo chmod 750 /opt/syno_hdd_db.sh |
|||
``` |
|||
|
|||
6. Finally run syno_hdd_db. You don't need any options at this point. |
|||
``` |
|||
sudo -s /opt/syno_hdd_db.sh |
|||
``` |
|||
|
|||
8. If Storage Manager is already open close then open it, or refresh the web page. |
|||
9. You can now create your storage pool from Storage Manager. |
|||
|
|||
#### Via a scheduled task |
|||
|
|||
First setup email notifications (if you haven't already): |
|||
|
|||
1. Go to **Control Panel** > **Notification** > **Email** > click **Setup**. |
|||
|
|||
Then create the scheduled task: |
|||
|
|||
1. Go to **Control Panel** > **Task Scheduler** > click **Create** > **Scheduled Task** > **User-defined script**. |
|||
2. Enter a task name. |
|||
3. Select **root** as the user (The script needs to run as root). |
|||
4. Untick **Enable**. |
|||
5. Click **Task Settings**. |
|||
6. Tick **Send run details by email** and enter your email address. |
|||
7. In the box under **User-defined script** paste the following: |
|||
``` |
|||
mkdir -m775 /opt |
|||
cd /opt || (echo "Failed to CD to /opt"; exit 1) |
|||
curl -O "https://raw.githubusercontent.com/007revad/Synology_HDD_db/refs/heads/main/syno_hdd_db.sh" |
|||
curl -O "https://raw.githubusercontent.com/007revad/Synology_HDD_db/refs/heads/main/syno_hdd_vendor_ids.txt" |
|||
chmod 750 /opt/syno_hdd_db.sh |
|||
/opt/syno_hdd_db.sh -e |
|||
``` |
|||
8. Click **OK** > **OK** > type your password > **Submit** to save the scheduled task. |
|||
9. Now select the scheduld task and click **Run** > **OK**. |
|||
10. Check your emails to make sure the scheduled task ran without any error. |
|||
11. If Storage Manager is already open close then open it, or refresh the web page. |
|||
12. You can now create your storage pool from Storage Manager. |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
stx_ihm from QNAP firmware, renamed dhm_tool for Synology DSM |
|||
|
|||
SeaDragon_DHMr - Seagate drive utilities |
|||
Copyright (c) 2017-2021 Seagate Technology LLC and/or its Affiliates, All Rights Reserved |
|||
SeaDragon_DHMr Version: 2.5.1-2_2_3 X86_64 |
|||
Build Date: Oct 3 2022 |
|||
|
|||
MD5 cf67c1d5006913297f85ca7f9d1795ba |
|||
SHA-1 163b384afabc491c97f3aa4ee7916601a9a680dd |
|||
SHA-256 86dd0e3c5ded507d23dfeb2ca04a2e086c97a86e2ab96dc6fdeab686a8202795 |
|||
SHA-384 3d806909d445605787ceb155bc1555e01d02efe324378c9c71e6b53d91bba6bf8dbadef38dd882b43caf8dbd93eaff6c |
|||
SHA-512 a2d87d91fd4cc298708946c9a611027dce290ba17a48c65e712b5d7e72ba04c6b5303c90efeb178a8fc690241b405691a15cc88200ab3b28319198df6bd6ad16 |
|||
@ -0,0 +1,8 @@ |
|||
MD5 01381dabbe86e13a2f4a8017b5552918 |
|||
SHA-1 f24a4c06b4865a5948eddc2f43fcdb7700398c7d |
|||
SHA-256 14f7f87a5822050eab7c30a064912a6efe99f49bf6b896bbb38c2ba003803e78 |
|||
Vhash 4885c57da971db5c59998566ee02855f |
|||
SSDEEP 1536:ZJ048w/2Iaosz0SlWcCyeyudm5gupvatDVF4Utc3Lyk+pboAZ4NMMy6MajiRTrbc:0hfosz0j0ehm57vaTDc3Lmo/iRTrM4q |
|||
TLSH T13EE33D02F3648C7DD4F85B34469A82B7A7B4F8455232171F7B4097192F86F688F2A9E3 |
|||
|
|||
https://www.virustotal.com/gui/file/14f7f87a5822050eab7c30a064912a6efe99f49bf6b896bbb38c2ba003803e78/detection |
|||
@ -0,0 +1,2 @@ |
|||
dtc-1.6.1 source code - Author David Gibson |
|||
https://git.kernel.org/pub/scm/utils/dtc/dtc.git |
|||
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
@ -0,0 +1,183 @@ |
|||
## All my scripts, tools and guides |
|||
|
|||
<img src="https://hitscounter.dev/api/hit?url=https%3A%2F%2F007revad.github.io%2F&label=Visitors&icon=github&color=%23198754&message=&style=flat&tz=UTC"> |
|||
|
|||
|
|||
#### Contents |
|||
- [Plex](#plex) |
|||
- [Synology docker](#synology-docker) |
|||
- [Synology recovery](#synology-recovery) |
|||
- [Other Synology scripts](#other-synology-scripts) |
|||
- [Synology hardware restrictions](#synology-hardware-restrictions) |
|||
- [2025 plus models](#2025-plus-models) |
|||
- [How To Guides](#how-to-guides) |
|||
- [Synology dev](#synology-dev) |
|||
|
|||
*** |
|||
|
|||
### Plex |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_Plex_Backup">Synology_Plex_Backup</a>** |
|||
- A script to backup Plex to a tgz file foror DSM 7 and DSM 6. |
|||
- Works for Plex Synology package and Plex in docker. |
|||
|
|||
- **<a href="https://github.com/007revad/Asustor_Plex_Backup">Asustor_Plex_Backup</a>** |
|||
- Backup your Asustor's Plex Media Server settings and database. |
|||
|
|||
- **<a href="https://github.com/007revad/Linux_Plex_Backup">Linux_Plex_Backup</a>** |
|||
- Backup your Linux Plex Media Server's settings and database. |
|||
|
|||
- **<a href="https://github.com/007revad/Plex_Server_Sync">Plex_Server_Sync</a>** |
|||
- Sync your main Plex server database & metadata to a backup Plex server. |
|||
- Works for Synology, Asustor, Linux and supports Plex package or Plex in docker. |
|||
|
|||
[Back to Contents](#contents) |
|||
|
|||
### Synology docker |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_Docker_Export">Synology_Docker_export</a>** |
|||
- Export all Synology Container Manager or Docker containers' settings as json files to your docker shared folder. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_ContainerManager_IPv6">Synology_ContainerManager_IPv6</a>** |
|||
- Enable IPv6 for Container Manager's bridge network. |
|||
|
|||
- **<a href="https://github.com/007revad/ContainerManager_for_all_armv8">ContainerManager_for_all_armv8</a>** |
|||
- Script to install Container Manager on a RS819, DS119j, DS418, DS418j, DS218, DS218play or DS118. |
|||
|
|||
- **<a href="https://github.com/007revad/Docker_Autocompose">Docker_Autocompose</a>** |
|||
- Create .yml files from your docker existing containers. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_docker_cleanup">Synology_docker_cleanup</a>** |
|||
- Remove orphan docker btrfs subvolumes and images in Synology DSM 7 and DSM 6. |
|||
|
|||
[Back to Contents](#contents) |
|||
|
|||
### Synology recovery |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_DSM_reinstall">Synology_DSM_reinstall</a>** |
|||
- Easily re-install the same DSM version without losing any data or settings. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_Recover_Data">Synology_Recover_Data</a>** |
|||
- A script to make it easy to recover your data from your Synology's drives using a computer. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_clear_drive_error">Synology clear drive error</a>** |
|||
- Clear drive critical errors so DSM will let you use the drive. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_DSM_Telnet_Password">Synology_DSM_Telnet_Password</a>** |
|||
- Synology DSM Recovery Telnet Password of the Day generator. |
|||
|
|||
- **<a href="https://github.com/007revad/Syno_DSM_Extractor_GUI">Syno_DSM_Extractor_GUI</a>** |
|||
- Windows GUI for extracting Synology DSM 7 pat files and spk package files. |
|||
|
|||
- **<a href="https://github.com/007revad/Synoboot_backup">Synoboot_backup</a>** |
|||
- Back up synoboot after each DSM update so you can recover from a corrupt USBDOM. |
|||
|
|||
[Back to Contents](#contents) |
|||
|
|||
### Other Synology scripts |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_app_mover">Synology_app_mover</a>** |
|||
- Easily move Synology packages from one volume to another volume. |
|||
|
|||
- **<a href="https://github.com/007revad/Video_Station_for_DSM_722">Video_Station_for_DSM_722</a>** |
|||
- Script to install Video Station in DSM 7.2.2 |
|||
|
|||
- **<a href="https://github.com/007revad/SS_Motion_Detection">SS_Motion_Detection</a>** |
|||
- Installs previous Surveillance Station and Advanced Media Extensions versions so motion detection and HEVC are supported. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_Config_Backup">Synology_Config_Backup</a>** |
|||
- Backup and export your Synology DSM configuration. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_CPU_temperature">Synology_CPU_temperature</a>** |
|||
- Get and log Synology NAS CPU temperature via SSH. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_SMART_info">Synology_SMART_info</a>** |
|||
- Show Synology smart test progress or smart health and attributes. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_Cleanup_Coredumps">Synology_Cleanup_Coredumps</a>** |
|||
- Cleanup memory core dumps from crashed processes. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_toggle_reset_button">Synology_toggle_reset_button</a>** |
|||
- Script to disable or enable the reset button and show current setting. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_Download_Station_Chrome_Extension">Synology_Download_Station_Chrome_Extension</a>** |
|||
- Download Station Chrome Extension. |
|||
|
|||
- **<a href="https://github.com/007revad/Seagate_lowCurrentSpinup">Seagate_lowCurrentSpinup</a>** |
|||
- This script avoids the need to buy and install a higher wattage power supply when using multiple large Seagate SATA HDDs. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_created_date">Synology_created_date</a>** |
|||
- Script to show you the created year and month of your Synology NAS or expansion unit. |
|||
|
|||
[Back to Contents](#contents) |
|||
|
|||
### Synology hardware restrictions |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_HDD_db">Synology_HDD_db</a>** |
|||
- Add your SATA or SAS HDDs and SSDs plus SATA and NVMe M.2 drives to your Synology's compatible drive databases, including your Synology M.2 PCIe card and Expansion Unit databases. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_enable_M2_volume">Synology_enable_M2_volume</a>** |
|||
- Enable creating volumes with non-Synology M.2 drives. |
|||
- Enable Health Info for non-Synology NVMe drives (not in DSM 7.2.1 or later). |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_M2_volume">Synology_M2_volume</a>** |
|||
- Easily create an M.2 volume on Synology NAS. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_enable_M2_card">Synology_enable_M2_card</a>** |
|||
- Enable Synology M.2 PCIe cards in Synology NAS that don't officially support them. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_enable_eunit">Synology_enable_eunit</a>** |
|||
- Enable an unsupported Synology eSATA Expansion Unit models. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_enable_Deduplication">Synology_enable_Deduplication</a>** |
|||
- Enable deduplication with non-Synology SSDs and unsupported NAS models. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_SHR_switch">Synology_SHR_switch</a>** |
|||
- Easily switch between SHR and RAID Groups, or enable RAID F1. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_enable_sequential_IO">Synology_enable_sequential_IO</a>** |
|||
- Enables sequential I/O for your SSD caches, like DSM 6 had. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_Information_Wiki">Synology_Information_Wiki</a>** |
|||
- Information about Synology hardware. |
|||
|
|||
[Back to Contents](#contents) |
|||
|
|||
### 2025 plus models |
|||
|
|||
- **<a href="https://github.com/007revad/Transcode_for_x25">Transcode_for_x25</a>** |
|||
- Installs the modules needed for Plex or Jellyfin hardware transcoding in DS425+ and DS225+. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md">2025 series or later Plus models</a>** |
|||
- Unverified 3rd party drive limitations and unofficial solutions. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md#setting-up-a-new-2025-or-later-plus-model-with-only-unverified-hdds">Setup with only 3rd party drives</a>** |
|||
- Setting up a new 2025 or later plus model with only unverified HDDs. |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md#deleting-and-recreating-your-storage-pool-on-unverified-hdds">Recreating storage pool on migrated drives</a>** |
|||
- Deleting and recreating your storage pool on unverified HDDs. |
|||
|
|||
[Back to Contents](#contents) |
|||
|
|||
### How To Guides |
|||
|
|||
- **<a href="https://github.com/007revad/Synology_SSH_key_setup">Synology_SSH_key_setup</a>** |
|||
- How to setup SSH key authentication for your Synology. |
|||
|
|||
[Back to Contents](#contents) |
|||
|
|||
### Synology dev |
|||
|
|||
- **<a href="https://github.com/007revad/Download_Synology_Archive">Download_Synology_Archive</a>** |
|||
- Download all or part of the Synology archive. |
|||
|
|||
- **<a href="https://github.com/007revad/Syno_DSM_Extractor_GUI">Syno_DSM_Extractor_GUI</a>** |
|||
- Windows GUI for extracting Synology DSM 7 pat files and spk package files. |
|||
|
|||
- **<a href="https://github.com/007revad/ScriptNotify">ScriptNotify</a>** |
|||
- DSM 7 package to allow your scripts to send DSM notifications. |
|||
|
|||
- **<a href="https://github.com/007revad/DTC_GUI_for_Windows">DTC_GUI_for_Windows</a>** |
|||
- GUI for DTC.exe for Windows. |
|||
|
|||
[Back to Contents](#contents) |
|||
@ -0,0 +1,411 @@ |
|||
#!/usr/bin/env bash |
|||
# shellcheck disable=SC2002,2207 |
|||
#------------------------------------------------------------------------------------ |
|||
# Companion script for syno_hdd_db |
|||
# Schedule companion script to run as root at shut-down |
|||
# |
|||
# https://www.synology-forum.de/threads/neue-version-7-3-2-86009.140586/post-1265124 |
|||
#------------------------------------------------------------------------------------ |
|||
# TODO |
|||
# Check running on DSM version that needs it |
|||
# What to do if @database is on the NVMe volume? |
|||
|
|||
scriptver="v1.0.0" |
|||
script=Synology_HDD_shutdown |
|||
#repo="007revad/Synology_HDD_db" |
|||
scriptname=syno_hdd_shutdown |
|||
|
|||
ding(){ |
|||
printf \\a |
|||
} |
|||
|
|||
# Save options used for getopt |
|||
args=("$@") |
|||
|
|||
if [[ $1 == "--trace" ]] || [[ $1 == "-t" ]]; then |
|||
trace="yes" |
|||
fi |
|||
|
|||
# Check script is running as root |
|||
if [[ $( whoami ) != "root" ]]; then |
|||
ding |
|||
echo -e "ERROR This script must be run as sudo or root!" |
|||
exit 1 # Not running as sudo or root |
|||
fi |
|||
|
|||
# Get NAS model |
|||
model=$(cat /proc/sys/kernel/syno_hw_version) |
|||
#modelname="$model" |
|||
|
|||
|
|||
# Show script version |
|||
#echo -e "$script $scriptver\ngithub.com/$repo\n" |
|||
echo "$script $scriptver" |
|||
|
|||
# Get DSM full version |
|||
productversion=$(synogetkeyvalue /etc.defaults/VERSION productversion) |
|||
buildphase=$(synogetkeyvalue /etc.defaults/VERSION buildphase) |
|||
buildnumber=$(synogetkeyvalue /etc.defaults/VERSION buildnumber) |
|||
smallfixnumber=$(synogetkeyvalue /etc.defaults/VERSION smallfixnumber) |
|||
|
|||
# Get CPU arch and platform_name |
|||
arch="$(uname -m)" |
|||
platform_name=$(synogetkeyvalue /etc.defaults/synoinfo.conf platform_name) |
|||
|
|||
# Show DSM full version and model |
|||
if [[ $buildphase == GM ]]; then buildphase=""; fi |
|||
if [[ $smallfixnumber -gt "0" ]]; then smallfix="-$smallfixnumber"; fi |
|||
echo "$model DSM $productversion-$buildnumber$smallfix $buildphase" |
|||
|
|||
# Show CPU arch and platform_name |
|||
echo "CPU $platform_name $arch" |
|||
|
|||
# Show options used |
|||
if [[ ${#args[@]} -gt "0" ]]; then |
|||
echo -e "Using options: ${args[*]}\n" |
|||
else |
|||
echo "" |
|||
fi |
|||
|
|||
# Check Synology has synonvme |
|||
if ! which synonvme >/dev/null; then |
|||
ding |
|||
echo "${model} does not have synonvme!" |
|||
exit 2 # NAS model does support NVMe |
|||
fi |
|||
|
|||
# Check Synology has libsynonvme.so.1 |
|||
if [[ ! -e /usr/lib/libsynonvme.so ]]; then |
|||
ding |
|||
echo "${model} does not have libsynonvme.so.1!" |
|||
exit 2 # NAS model does support NVMe |
|||
fi |
|||
|
|||
#set -x |
|||
|
|||
# Get script location |
|||
# https://stackoverflow.com/questions/59895/ |
|||
source=${BASH_SOURCE[0]} |
|||
while [ -L "$source" ]; do # Resolve $source until the file is no longer a symlink |
|||
scriptpath=$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd ) |
|||
source=$(readlink "$source") |
|||
# If $source was a relative symlink, we need to resolve it |
|||
# relative to the path where the symlink file was located |
|||
[[ $source != /* ]] && source=$scriptpath/$source |
|||
done |
|||
scriptpath=$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd ) |
|||
scriptfile=$( basename -- "$source" ) |
|||
echo "Running from: ${scriptpath}/$scriptfile" |
|||
|
|||
# Warn if script located on M.2 drive |
|||
scriptvol=$(echo "$scriptpath" | cut -d"/" -f2) |
|||
vg=$(lvdisplay | grep /volume_"${scriptvol#volume}" | cut -d"/" -f3) |
|||
md=$(pvdisplay | grep -B 1 -E '[ ]'"$vg" | grep /dev/ | cut -d"/" -f3) |
|||
if cat /proc/mdstat | grep "$md" | grep nvme >/dev/null; then |
|||
ding |
|||
echo -e "WARNING Don't store this script on an NVMe volume!" |
|||
exit 3 # Script is stored on NVMe volume |
|||
fi |
|||
|
|||
shutdown_log="${scriptpath}/${scriptname}.log" |
|||
# Delete old shutdown_log |
|||
if [[ -f "$shutdown_log" ]]; then |
|||
rm "$shutdown_log" |
|||
fi |
|||
|
|||
progbar(){ |
|||
# $1 is pid of process |
|||
# $2 is string to echo |
|||
string="$2" |
|||
local dots |
|||
local progress |
|||
dots="" |
|||
while [[ -d /proc/$1 ]]; do |
|||
dots="${dots}." |
|||
progress="$dots" |
|||
if [[ ${#dots} -gt "10" ]]; then |
|||
dots="" |
|||
progress=" " |
|||
fi |
|||
echo -ne " ${2}$progress\r"; /usr/bin/sleep 0.3 |
|||
done |
|||
} |
|||
|
|||
progstatus(){ |
|||
# $1 is return status of process |
|||
# $2 is string to echo |
|||
# $3 line number function was called from |
|||
local tracestring |
|||
local pad |
|||
tracestring="${FUNCNAME[0]} called from ${FUNCNAME[1]} $3" |
|||
pad=$(printf -- ' %.0s' {1..80}) |
|||
[ "$trace" == "yes" ] && printf '%.*s' 80 "${tracestring}${pad}" && echo "" |
|||
if [[ $1 == "0" ]]; then |
|||
echo -e "$2 " |
|||
else |
|||
ding |
|||
echo -e "Line ${LINENO}: ERROR $2 failed!" |
|||
echo "$tracestring ($scriptver)" |
|||
if [[ $exitonerror != "no" ]]; then |
|||
exit 1 # Skip exit if exitonerror != no |
|||
fi |
|||
fi |
|||
exitonerror="" |
|||
#echo "return: $1" # debug |
|||
} |
|||
|
|||
package_status(){ |
|||
# $1 is package name |
|||
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}" |
|||
# local code |
|||
synopkg status "${1}" >/dev/null |
|||
code="$?" |
|||
# DSM 7.2 0 = started, 17 = stopped, 255 = not_installed, 150 = broken |
|||
# DSM 6 to 7.1 0 = started, 3 = stopped, 4 = not_installed, 150 = broken |
|||
if [[ $code == "0" ]]; then |
|||
#echo "$1 is started" # debug |
|||
return 0 |
|||
elif [[ $code == "17" ]] || [[ $code == "3" ]]; then |
|||
#echo "$1 is stopped" # debug |
|||
return 1 |
|||
elif [[ $code == "255" ]] || [[ $code == "4" ]]; then |
|||
#echo "$1 is not installed" # debug |
|||
return 255 |
|||
elif [[ $code == "150" ]]; then |
|||
#echo "$1 is broken" # debug |
|||
return 150 |
|||
else |
|||
return "$code" |
|||
fi |
|||
} |
|||
|
|||
package_is_running(){ |
|||
# $1 is package name |
|||
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}" |
|||
synopkg is_onoff "${1}" >/dev/null |
|||
code="$?" |
|||
return "$code" |
|||
} |
|||
|
|||
wait_status(){ |
|||
# Wait for package to finish stopping or starting |
|||
# $1 is package |
|||
# $2 is start or stop |
|||
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}" |
|||
local num |
|||
if [[ $2 == "start" ]]; then |
|||
state="0" |
|||
elif [[ $2 == "stop" ]]; then |
|||
state="1" |
|||
fi |
|||
if [[ $state == "0" ]] || [[ $state == "1" ]]; then |
|||
num="0" |
|||
package_status "$1" |
|||
while [[ $? != "$state" ]]; do |
|||
sleep 1 |
|||
num=$((num +1)) |
|||
if [[ $num -gt "20" ]]; then |
|||
break |
|||
fi |
|||
package_status "$1" |
|||
done |
|||
fi |
|||
} |
|||
|
|||
package_stop(){ |
|||
# $1 is package name |
|||
# $2 is package display name |
|||
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}" |
|||
# Docker can take 12 minutes to stop 70 containers |
|||
timeout 30m synopkg stop "$1" >/dev/null & |
|||
pid=$! |
|||
string="Stopping ${2}" |
|||
progbar "$pid" "$string" |
|||
wait "$pid" |
|||
progstatus "$?" "$string" "line ${LINENO}" |
|||
|
|||
# Allow package processes to finish stopping |
|||
wait_status "$1" stop & |
|||
pid=$! |
|||
string="Waiting for ${2} to stop" |
|||
progbar "$pid" "$string" |
|||
wait "$pid" |
|||
progstatus "$?" "$string" "line ${LINENO}" |
|||
} |
|||
|
|||
stop_packages(){ |
|||
# Check package is running |
|||
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}" |
|||
if package_is_running "$pkg"; then |
|||
|
|||
# Stop package |
|||
package_stop "$pkg" "$pkg_name" |
|||
|
|||
# Check package stopped |
|||
if package_is_running "$pkg"; then |
|||
#stop_pkg_fail="yes" |
|||
ding |
|||
echo -e "Line ${LINENO}: ERROR Failed to stop ${pkg_name}!" |
|||
# echo "${pkg_name} status $code" |
|||
#process_error="yes" |
|||
return 1 |
|||
else |
|||
echo "$pkg" >> "$shutdown_log" |
|||
#stop_pkg_fail="" |
|||
fi |
|||
|
|||
if [[ $pkg == "ContainerManager" ]] || [[ $pkg == "Docker" ]]; then |
|||
# Stop containerd-shim |
|||
killall containerd-shim >/dev/null 2>&1 |
|||
fi |
|||
# else |
|||
# skip_start="yes" |
|||
fi |
|||
} |
|||
|
|||
skip_dev_tools(){ |
|||
# $1 is $package |
|||
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}" |
|||
local skip1 |
|||
local skip2 |
|||
skip1="$(synogetkeyvalue "/var/packages/${package}/INFO" startable)" |
|||
skip2="$(synogetkeyvalue "/var/packages/${package}/INFO" ctl_stop)" |
|||
if [[ $skip1 == "no" ]] || [[ $skip2 == "no" ]]; then |
|||
return 0 |
|||
else |
|||
return 1 |
|||
fi |
|||
} |
|||
|
|||
|
|||
# Get list of volumes with shared folders |
|||
readarray -t shares_array < <(synoshare --enum | tail -n +5) |
|||
for share in "${shares_array[@]}"; do |
|||
|
|||
#echo "share: $share" # debug ################################################ |
|||
|
|||
if [[ $buildnumber -gt "64570" ]]; then |
|||
# DSM 7.2.1 and later |
|||
# synoshare --get-real-path is case insensitive |
|||
path="$(synoshare --get-real-path "$share" | cut -d"/" -f2)" |
|||
else |
|||
# DSM 7.2 and earlier |
|||
# synoshare --getmap is case insensitive |
|||
path="$(synoshare --getmap "$share" | grep volume | cut -d"[" -f2 | cut -d"]" -f1)" |
|||
# I could also have used: |
|||
# web_pkg_path=$(/usr/syno/sbin/synoshare --get "$share" | tr '[]' '\n' | sed -n "9p") |
|||
fi |
|||
|
|||
# Ignore external USB and eSATA volumes |
|||
if echo "$path" | grep -q -E 'volume[0-9]'; then |
|||
volumes_array+=("$path") |
|||
fi |
|||
done |
|||
|
|||
#echo -e "\nvolumes_array:" # debug ################## |
|||
#for v in "${volumes_array[@]}"; do echo "$v"; done # debug ################## |
|||
#echo -e "\n" # debug ################## |
|||
|
|||
# Sort array to remove duplicates |
|||
IFS=$'\n' |
|||
volumes_array_sorted=($(sort -u <<<"${volumes_array[*]}")) |
|||
unset IFS |
|||
|
|||
#echo -e "\nvolumes_array_sorted:" # debug ########### |
|||
#for v in "${volumes_array_sorted[@]}"; do echo "$v"; done # debug ########### |
|||
#echo -e "\n" # debug ########### |
|||
|
|||
#exit |
|||
|
|||
# Check there is an NVMe volume |
|||
nvme_vols=() |
|||
for vol in "${volumes_array_sorted[@]}"; do |
|||
|
|||
#echo "$vol" # debug ######################################################### |
|||
|
|||
vg=$(lvdisplay | grep /volume_"${vol#volume}" | cut -d"/" -f3) |
|||
md=$(pvdisplay | grep -B 1 -E '[ ]'"$vg" | grep /dev/ | cut -d"/" -f3) |
|||
if cat /proc/mdstat | grep "$md" | grep nvme >/dev/null; then |
|||
nvme_vols_qty=$((nvme_vols_qty +1)) |
|||
nvme_vols+=("$vol") |
|||
fi |
|||
done |
|||
if [[ $nvme_vols_qty -lt "0" ]]; then |
|||
ding |
|||
echo -e "No NVMe volumes found." |
|||
exit 4 # Script not needed |
|||
fi |
|||
|
|||
|
|||
#echo "nvme_vols_qty $nvme_vols_qty" # debug ###################### |
|||
#for v in "${nvme_vols[@]}"; do echo "$v"; done # debug ###################### |
|||
#echo "" # debug ###################### |
|||
|
|||
#exit |
|||
|
|||
|
|||
# Get list of packages installed on NVMe volume |
|||
if ! cd /var/packages; then |
|||
ding |
|||
echo -e "Failed to cd to /var/packages!" |
|||
exit 5 # Failed to cd to /var/packages |
|||
fi |
|||
declare -A package_names |
|||
declare -A package_names_rev |
|||
#package_infos=( ) |
|||
while IFS= read -r -d '' link && IFS= read -r -d '' target; do |
|||
if [[ ${link##*/} == "target" ]] && echo "$target" | grep -q 'volume'; then |
|||
# Check symlink target exists |
|||
if [[ -a "/var/packages${link#.}" ]] ; then |
|||
|
|||
# Skip broken packages with no INFO file |
|||
package="$(printf %s "$link" | cut -d'/' -f2 )" |
|||
if [[ -f "/var/packages/${package}/INFO" ]]; then |
|||
package_volume="$(printf %s "$target" | cut -d'/' -f1,2 )" |
|||
|
|||
#echo "package_volume: $package_volume" # debug ############################### |
|||
|
|||
# Check if package is on NVMe volume |
|||
# shellcheck disable=SC2076 |
|||
if [[ "/${nvme_vols[*]}" =~ "$package_volume" ]]; then |
|||
package_name="$(synogetkeyvalue "/var/packages/${package}/INFO" displayname)" |
|||
if [[ -z "$package_name" ]]; then |
|||
package_name="$(synogetkeyvalue "/var/packages/${package}/INFO" package)" |
|||
fi |
|||
|
|||
#echo "package_name: $package_name" # debug ############################### |
|||
|
|||
# Skip packages that are dev tools with no data |
|||
if ! skip_dev_tools "$package"; then |
|||
#package_infos+=("${package_volume}|${package_name}") |
|||
package_names["${package_name}"]="${package}" |
|||
package_names_rev["${package}"]="${package_name}" |
|||
fi |
|||
fi |
|||
fi |
|||
fi |
|||
fi |
|||
done < <(find . -maxdepth 2 -type l -printf '%p\0%l\0') |
|||
|
|||
#echo -e "\npackage_infos:" |
|||
#for p in "${package_infos[@]}"; do echo "$p"; done |
|||
|
|||
#echo -e "\npackage_names:" |
|||
#for p in "${package_names[@]}"; do echo "$p"; done |
|||
|
|||
#echo -e "\npackage_names_rev:" |
|||
#for p in "${package_names_rev[@]}"; do echo "$p"; done |
|||
|
|||
|
|||
# Loop through pkgs_sorted array and process package |
|||
for pkg in "${package_names[@]}"; do |
|||
pkg_name="${package_names_rev["$pkg"]}" |
|||
#process_error="" |
|||
stop_packages |
|||
|
|||
#echo "stop_package: $pkg" # debug ############################################ |
|||
|
|||
done |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,24 @@ |
|||
# You can add your drive's vendor id and vendor name here. |
|||
# |
|||
# Only edit this file if the script warns you about a missing vendor id. |
|||
|
|||
0x025e="Solidigm" |
|||
0x05dc="Lexar" |
|||
0x0ed1="aigo" |
|||
0x10ec="TEAMGROUP" |
|||
0x137e="Patriot" |
|||
0x1458="Gigabyte" |
|||
0x1462="MSI" |
|||
0x196e="PNY" |
|||
0x1987="Phison" |
|||
0x1b1c="Corsair" |
|||
0x1bdc="Apacer" |
|||
0x1c5c="SK Hynix" |
|||
0x1cc4="UMIS" |
|||
0x1cfa="Corsair" |
|||
0x1d79="Transcend" |
|||
0x1dbe="ADATA" |
|||
0x1e0f="KIOXIA" |
|||
0x1e49="ZHITAI" |
|||
0x1e4b="FIKWOT" |
|||
0x1f40="Netac" |
|||