Experiment on sata_args in grub.cfg

Study about Synology DSM bootloader’s grub.cfg setting.

This study will focus on the effect on the “set sata_args" arguments.

Before we start, lets take a look for the basic description from the developer"

bool “Modify SATA Hosts Port Number"
default y
<DSM> #18789
Reads Sata-Port-Mapping information and forces the sata hosts
to initialize specified number of ports. This makes the disk
name not skip some characters.

Notice – Do NOT set the port number out of the range that [0-9].
It supports as most 9 ports now.

For example, SataPortMap=4233 means the 1st host use 4 ports,
the 2nd host use 2 ports, the 3rd and 4th host use 3 ports.

bool “Modify Disk Name Sequence"
default y
<DSM> #19604
Add boot argument DiskIdxMap to modify disk name sequence. Each
two characters define the start disk index of the sata host. This
argument is a hex string and is related with SataPortMap.

For example, DiskIdxMap=030600 means the disk name of the first
host start from sdd, the second host start from sdq, and the third
host start sda.

bool “Re-map Disk Name Sequence"
default y
<DSM> #47418
Add boot argument sata_remap to remap data port sequence.

For example, sata_remap=0>4:4>0 means swap the first disk name
and the 5th. The following is the remap result.
ata1 – sde
ata2 – sdb
ata3 – sdc
ata4 – sdd
ata5 – sda

CPU: i3-8100
NIC: intel (real) and E1000e (virtual)
Vitualization platform: ESXi 6.7
Bootloader: Jun’s v1.04b
DSM 6.2.1 as per advise from Xpenology Forum, there are two SATA Controller.Bootloader is parked on SATA controller 0:0 (first disk of SATA controller 0)
Data disk is parked on SATA controller 1:0 (first disk of SATA controller 1)螢幕截圖 2018-11-07 上午10.38.06.png

Test 1: only change MAC address to the bootloader, no change in sata_args.

Result 1: bootloader on Disk 1, Data disk on Disk 5. and this will be our reference point.
螢幕截圖 2018-11-07 上午10.47.39.png

Test 2:

set sata_args=’SasIdxMap=0 SataPortMap=4′

# SasIdxMap=0 should make disk in true order

Result 2: no difference (which should be true as we had defined max disk of SATA Controller 1 is 4 )螢幕截圖 2018-11-07 上午10.55.17.png

Test 3:

set sata_args=’SasIdxMap=0 DiskIdxMap=0800 SataPortMap=48′

# DiskIdxMap=0800 should move SATA Controller 0 to Disk 9 (O8=8) & SATA Controller 1 to Disk 1 (00=0)
# SataPortMap=48  should define max disk of SATA Controller 0 to 4 & SATA Controller 1 to 8

Result 3: boot loader on Disk 9, and data disk on Disk 1螢幕截圖 2018-11-07 上午11.00.44.png

Test 4: we added 8 more data disk to SATA controller 1 (SATA controller 1:1~1:8)
# the disk 10 on SATA controller 1:8 should occupy the same Disk 9 slot as boot loader
螢幕截圖 2018-11-07 上午11.05.38.png

Result 4: disk 10 on SATA controller 1:8 not shown as expected.螢幕截圖 2018-11-07 上午11.10.20.png

Test 5:

set sata_args=’DiskIdxMap=0800 SataPortMap=48′

# removed SasIdxMap=0 to see if the disk 10 on SATA controller 1:8 will be shown as Disk 10 in DSM, since we will not force hard disk in their try order

Result 5: no Difference, 螢幕截圖 2018-11-07 上午11.17.13.png
I also unplugged Disk 3 with this setting, seems missing SasIdxMap=0 won’t affect the true order of disk within their controller.螢幕截圖 2018-11-07 上午11.21.09.png

Test 6:

set sata_args=’DiskIdxMap=0800 SataPortMap=08′

# Try if we can hide the boot loader disk in DSM by setting max disk of SATA controller 0 to 0.

Result 6: DSM won’t show up in Synology Assistant.

To conclude, we only need two arguments to control the disk order in fully virtualised environment:

DiskIdxMap=XXYYZZ (HEXadecimal number: XX is the location of first disk of 1st controller, YY  is the location of first disk of 2nd controller, ZZ is the location of first disk of 3rd controller)
SataPortMap=ABC (Decimal number: A is max disks of 1st controller, B is max disks of 2nd controller, C is max disks of 3rd controller)

if you would like to set XX or YY or ZZ other than 08, you may use Decimal to HEX converter from the internet. The simple 0-15 conversion is listed below:螢幕截圖 2018-11-07 上午11.32.22.png

How about pic passthrough?

So far we have been testing on fully virtual environment and have no information on how does the setting affect on barematel environment or virtual environment with pic passthrough.

The problem of deploying the finding of the above study to a VM with pci pasthrough is that we are not sure how many controller is there before the pci device.

SATA Controller 0 (max disk set to 1, location from disk 16)
SATA Controller 1 (max disk set to 8, location from disk 8)
PCI device 0 (max disk set to 8, location from disk 0)

Before we understand the number of controller between sata controller 1 to pci device 0, we cannot sure what we can fill in XX and xx below.

set sata_args=’DiskIdxMap=1008XXXX00 SataPortMap=18xx8′

Test 1: assume there is no controller in between, set

set sata_args=’DiskIdxMap=100800 SataPortMap=188′

Result 1: surprisingly, the bootloader disk is now disapper, data disk start with Disk 10.螢幕截圖 2018-11-07 下午2.04.11.png

Test 2: assume there is one controller in between:

set sata_args=’DiskIdxMap=10081100 SataPortMap=1818′

Result 2: nothing changed螢幕截圖 2018-11-07 下午2.04.11.png

Test 3: assume there is one controller in between:

set sata_args=’DiskIdxMap=1008111200 SataPortMap=18118′

Result 3: nothing changed螢幕截圖 2018-11-07 下午2.04.11.png

It seems like the assumption of some controller is in between sata controller 1 to pci device 0 is wrong, or wont affect our result. So we should try another method: sata_remap

Test 1: try to remap the Disk 10 to Disk 1

set sata_args=’DiskIdxMap=100800 SataPortMap=188 sata_remap=9>0′

# by doing this, Disk 10~ should be moved to Disk 1~

Result 1: nothing changed.螢幕截圖 2018-11-07 下午2.04.11.png

Test 2: try to remap the Disk 10 to Disk 1

set sata_args=’DiskIdxMap=100800 SataPortMap=188 sata_remap=9>0:0>9′

#by doing this, Disk 1-9 should exchange the location with with Disk 10~

Result 2: nothing changed.螢幕截圖 2018-11-07 下午2.04.11.png

Remap doesn’t work to me too.

Test 1: So I try again with SasIdxMap=0:

set sata_args=’SasIdxMap=0 DiskIdxMap=100800 SataPortMap=188′

Result 1: Finally something happened, the first data disk now start with Disk 2.螢幕截圖 2018-11-09 上午9.34.49.png

Edit: by double check the serial number on my harddisk. I found that this Disk number order is correct. The issue is just my sata connector cable lable is wrong.

By fixing my sata cable inside the box. I get the below result (my 4th bay is really empty): 😁

Extra Test: Try suggestion from jun (link)

set sata_args=’SasIdxMap=0xfffffff8 DiskIdxMap=0C SataPortMap=1′

Result: Disk Station Not Installed螢幕截圖 2018-11-07 下午3.01.02.png

So far still no luck on it. Please let me know if you have and ideas.


[2019/11/01 comment]

I have a friend need me to handle his grub.cfg, who use a single 16i LSI raid card.
According to above study, we cannot enter “16″ in the sataportmap, as it will be treat as 1&6 to sate controller.
After some testing, the finally solution is to ignore the max port from all data controller, except one for the bootloader. As he only has one raid card and max HDD to use is 16. so I have put the disk number of his boot loader to “17″. result is succesful, please refer to below data_arg setting.

set sata_args=’SasIdxMap=0 DiskIdxMap=1700′IMAGE 2019-11-01 14:01:24.jpg

對「Experiment on sata_args in grub.cfg」的一則回應

Add yours

  1. Hello, I have been looking for information on this topic that you describe and there is not much, thank you for sharing your knowledge

    I have a question, I have a baremetal installation with a sas controller in it mode for 12 disks, and I have 4 sata connections on the motherboard, I would like to be able to have the 16 disks organized both in physical order and in logical order, how could I do the mapping? Thank you very much for your help from Spain

  2. 博主你好,本人愚钝,英文能力有限,读懂该篇文章十分费力,无意中看到你的自我介绍才发现你是香港人,会粤语,不知道博主能否做个中文版,让我们这种英语能力不好的也可以读懂你的文章?哪怕是粤语也可以,我是广州人,能看明白,谢谢!



WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s

在 WordPress.com 建立免費網站或網誌.

向上 ↑

用 WordPress.com 建立自己的網站
%d 位部落客按了讚: