-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edit dtb to allow eSATA volumes #28
Comments
dtc is a device tree compiler from Linux. It's used to decompile and compile device tree blobs. I got the dtc binary from one of these repos, which all have the exact same dtc binary:
I've just asked pocopico and PeterSuh-Q3 about the scource code for the dtc binary. I have searched the Xpenology forum but searching for 'dtc source' found too many irrelevant results. There is source code available from https://git.kernel.org/pub/scm/utils/dtc/dtc.git for the v1.6.1 used by a few of my scripts. It's been decades since I last compiled a binary file from C source so when I found the pre-compiled binary on the xpenology boot loader repos, and it worked for what I needed, I just used it. If you're able to compile dtc v1.6.1 from the source here I'd love to know if it creates the same file. Let me know if you find the source for dtc as I'd like to add it my repo, or at least a link to the source. |
Do you have 2 eSATA drives or 1 eSATA device that contains 2 SSD drives? I do intend updating this script to make any eSATA drive supported, and show up in storage manager. |
Thank you for clarification. Curious why Synology decided to use (a part of?) this tool under the hood of DSM. At least on my DS1522+ with 7.2.1-69057 Update 4 this binary is not found.
After a quick research I've found the dtc repository which seems to be actively maintained. It visually has all the necessary files to be compiled and installed using standard developer tools. But I haven't checked it myself. |
DSM doesn't include dtc. That's why this script (and a couple of my other scripts) include dtc (and download dtc if it's not installed and not with the script). |
I have 2 SATA drives (Samsung SSD 870 EVO). Each one is connected to DS1522+ using a SATA to eSATA cable with USB power like this. Both are visible from DSM console just like internal devices (i.e. /dev/sataX, where X is 6 and 7 for eSATA-connected drives in my case), but not listed by About a year ago I tested a dual-bay 2.5" to 3.5" SATA adapter with my DS1522+. It supports a JBOD mode, but I didn't manage to make my Synology device show more than 1 drive either due to a lack of port multiplier support in the SATA controller, or due to Synology checking some additional info about one-to-many adapters. Additional debug info that might be useful for understanding: Linux SATA ports mapping
Synology slot mapping
model.dts (generated by
|
I wish I could get these for $1.50. Prices here range from $10 to $80!?!?! for the same cable. The Synology Does the eSATA port of Synology products support eSATA disk enclosures with port multipliers? page says: All Synology products do not support eSATA disk enclosures with port multipliers. The installed drives on eSATA disk enclosures with port multipliers may not be recognized by Synology products. If you would like to use external disk enclosures with multiple drives, we recommend you to use Synology Expansion Units. So it sounds like if you can find a eSATA multi-drive enclosure that has the same port multiplier chip as the DX and RX expansion units it might work. |
I ordered two cables looking the same on Ali.
It is not only the chip that matters, but also its firmware. As far as I remember, last time after many hours of googling I bumped into a small piece of info that DSM validates some data inside eSATA multi-drive enclosure in order to consider it original. And the author of that message didn't manage to make it work as intended. |
But my idea in this issue was actually not about non-original multi-drive eSATA enclosures, but about directly connected eSATA drives. I suggest you could extend the enable_eunit script functionality to make external drives be shown/treated by DSM as internal ones enabling users to use spare eSATA ports as slots for connecting additional drives. Is it safe to replace
with
inside model.dts, than recompile model.dtb and copy it to /etc.defaults/model.dtb? Is it probable that I will brick my device? If bricked, what options are there to restore it? I suppose |
In case you are interested in a non-original eSATA port multipliers topic, I think it was a small piece of info on Reddit by mchamst3r that I mentioned above:
|
No. Don't try that. You may brick the Synology. EDIT Actually you would not brick the Synology, But you may lose your storage pool and volume(s). |
That comment on reddit is interesting. But I'd do it a different way so anyone can can connect any eSATA DAS and have it appear to DSM as if it is a Synology expansion unit. The would require a script that:
We may be limited to DAS with up to 5 drive bays. It would probably only required editing synoinfo.conf, model.dtb and storage_panel.js The part I'm not sure of how to do is step 3, which I'd need to edit model.dtb like this:
I actually have a DX213 so I should be able to experiment on getting the information from the DX213. |
I found 2 spare SATA drives for testing and pulled out all my production drives (internal M2, internal and external SATA) so that not to loose any data/settings in case I bricked the device. Then I connected the first SATA drive to an internal slot and installed a clean version of DSM 7.2.1-69057 Update 4. Next I logged in it via SSH, used your dtc binary to modify /etc.defaults/model.dtb and edited /etc.defaults/synoinfo.conf. After that my device booted successfully, no warnings were shown by DSM. Finally, I connected the second SATA drive to one of eSATA ports, and DSM reported it as the sixth drive. The procedure step by step for myself and anyone else desiring to experiment# 1. Do everything as root
sudo su
# 2. Modify device tree
mkdir /volume1/test && cd /volume1/test
wget https://raw.githubusercontent.com/007revad/Synology_enable_eunit/main/bin/dtc && chmod +x ./dtc
./dtc -I dtb -O dts -o ./model.dts /etc.defaults/model.dtb
vi ./model.dts
## make changes to esata_port items, be careful with syntax and indents
./dtc -I dts -O dtb -o ./model.dtb.new ./model.dts
mv /etc.defaults/model.dtb /etc.defaults/model.dtb.backup
cp ./model.dtb.new /etc.defaults/model.dtb && chmod 644 /etc.defaults/model.dtb
# 3. Modify configuration file
cp /etc.defaults/synoinfo.conf /etc.defaults/synoinfo.conf.backup && chmod 755 /etc.defaults/synoinfo.conf.backup
vi /etc.defaults/synoinfo.conf
## make maxdisks equal to the number of internal_slot items in the changed model.dts
# 4. Reboot I repeated the procedure with my production drives. So far my DS1522+ has been working flawlessly for 12+ hours with 7 SATA drives all being considered internal. The only extra thing I had to do for my production drives is grow /dev/md0 and /dev/md1 partitions to include system volumes on my 2 eSATA-connected drives since they had already been initialised. Despite having |
I have also looked through some Synology DSM binaries (synodiskport, libsynodiskmap.so.1, libhwcontrol.so, libsynosata.so.1) with IDA. I think it is also possible to patch one of them so that any |
The ideal way would be to have a Synology and a non-Synology expantion units with similar hardware together with a disk station having 2 eSATA ports so that both eSATA multi-drive enclosures could be connected simultaneously.
As mentioned above I suppose it would require binary patching since the friend-or-foe logic is hidden somewhere inside. There is also a terminology issue in the function names of the Synology binaries: there are The libhwcontrol.so binary contains dozens of functions related to expansion units so it might be of primary interest for patching. However there are some relevant functions in the following libraries: |
Very nice.
As the eSATA drives are now showing in storage manager as internal SATA drives I wonder if you could have created the storage pool in storage manager (which would have mirrored md0 and md1 to the SSDs for you). We can probably get those drives to show up in the storage manager overview page. Xpenology devs can make it show as many drives are installed. But as long as the storage page shows the drives and their health you don't really need the overview page. I definitely prefer to avoid binary patching if possible. |
Synology uses both ebox and eunit as short names for expansion units. I assume ebox may be left over from a time when Synology might have referred to them as expansion boxes. I've not seen PCIeEunit before but it may be for expansion units that use the infiniband port or the minisas port. I have no idea what PMP is for, but it reminds me of portable media players from before mobile phones were invented. For C and javascript I usually paste the function into chatGPT and ask it what is that code doing and then I can work out what needs changing :o)
2 of my other scripts patch libhwcontrol.so.1 to make DSM think 3rd party NVMe drives are Synology NVMe drives. It's definitely the 1st file I'd look at. |
At the final step of my experiment with the spare drives the Storage Manager suggested that it created a storage pool on the sixth drive. What was more important for me is the storage pool I had already had before the procedure was automatically recognised (same as before) and assembled (crucial thing as it should have been done manually for eSATA-connected drives) on boot. I mirrored md0 and md1 manually but I suppose the Storage Manager could have done it for me. PMP stands for port multiplier, as far as I understood. |
Dave, thank you for advice about |
Nice find. Searching through the 42,000 lines of storage_panel.js can be overwhelming (especially when you're not sure what string to search for). At least you only had to search for 1019+.
What are you using to view storage_panel.js? |
No, actually I started from the 5-bay tower image loaded by the page, then I found the HTML element class name in
It is Chrome Developer Tools |
Hi @007revad,
I appreciate a lot what you have done for Synology community and this script is another example of hard work. Thank you very much for your effort.
I noticed the script downloads and runs /bin/dtc. Would be grateful if you could describe at least in the readme file what /bin/dtc is, where it comes from. Even better, if you could share its source code, if you are the author.
I don't have any official Synology expansion unit, so I can't actually test your script. However, I have 2 SATA SSDs connected to my DS1522+ using eSATA cables. These is a storage volume inside them (created by means of putting these disks inside the device), and it actually works great, if I leave 2 problems aside: 1) each time the device reboots, it requires me to manually press on assemble the volume (storage pool) button in the storage manager; 2) the disks aren't listed in the storage manager, so I have to either use command line tools to manage them, or remove some internal disks and put the external ones inside.
Given you understand how DSM gathers information about external units and know how to make changes to the device model (dtb), my feature request is to allow eSATA volumes on directly connected HDDs/SSDs (i.e. make DSM think these disks are internal ones). What do you think about my idea?
Regards,
The text was updated successfully, but these errors were encountered: