轉載自https://blog.csdn.net/sachin_woo/article/details/100066529
洗白
首先應明白洗白是否必要,洗白有兩個作用,一是可以使用QuickConnect;二是可以使用Video Station解碼。洗白需要找到正確的
MAC
及S/N
碼,至於其來源有各種途徑,一是有算號器;二是利用退換貨政策的漏洞。但是有風險,羣暉如果發現同一個MAC/SN
兩個同時在線,可能會封號。如果不使用上述兩個功能,可以不洗白。
要修改MAC/SN,需要修改啓動配置文件grub.cfg,有兩種方法:
- 直接PE啓動,然後加載ssd第一個分區就能找到文件
- SSH在線修改
個人覺得SSH在線修改更方便,具體操作如下:
1. 開放SSH端口
在控制面板裏面–>終端機和SNMP下,啓動SSH功能.
2. SSH工具掛載synoboot1分區
用ssh工具如putty連接到羣暉的ip地址,用創建羣暉的管理用戶登陸.
例如,用戶名:admin 密碼 123456
輸入如下命令:
sudo -i //獲取root超級權限
mkdir -p /tmp/boot //在/tmp目錄下創建一個臨時目錄,名字隨意,如:boot
cd /dev //切換到dev目錄
mount -t vfat synoboot1 /tmp/boot/ //將synoboot1 分區掛載到boot
cd /tmp/boot/grub //切換到grub目錄
vim grub.cfg //修改grub.cfg文件
按鍵盤上的 i 鍵(小寫狀態),進入文檔編輯模式,此時就可以輸入新的SN,MAC1的新值,刪除舊值.
修改完成後.
按鍵盤上的Esc鍵,返回到命令模式,輸入:wq,然後回車保存並退出.如果修改亂了,想不保存並退出,則是輸入:q,然後回車.
此時可以再 vi grub.cfg 進去看看是否修改成功.
最後重啓主機即可:
reboot
硬盤顯示
針對問題2,硬盤盤符亂,這款B款蝸牛有兩個SATA控制器,有6個SATA接口(包含一個mSATA接口).處理器控制2個能引導的接口(內存旁邊的一個和mSATA),板載控制器控制4個硬盤架的接口但不能引導.
1. 硬盤位的順序
裝好DSM後硬盤順序應該是處理器控制的兩個接口在前(假設爲1、2),控制硬盤架上的四個接口在後(假設爲3、4、5、6).所以只要是放在硬盤架上的硬盤在DSM都會標識在3號到6號盤之間.
若需要將硬盤架上的順序改爲1、2、3、4號標識,可以修改引導盤裏的grub.conf配置文件來實現.
修改盤序號需要在extra_args_918變量裏增加兩個值SataPortMap=24和DiskIdxMap=0400.
即:
# /grub/grub.conf
# 從第31行開始
......
set extra_args_918='SataPortMap=24 DiskIdxMap=0400' #將兩項加在這後面
set common_args_918='syno_hdd_powerup_seq=0 HddHotplug=0 syno_hw_version=DS918+ vender_format_version=2 console=ttyS0,115200n8 withefi elevator=elevator quiet syno_port_thaw=1'
# for testing on VM
set sata_args='SataPortMap=1'
......
修改完成後保存重啓,我的硬盤是從左至右放在左邊兩個盤位中的所以是3號和4號位.
如果盤位順序還是有誤,需要把主板連接的SATA物理更換一下,交換位置就正常了.
簡單解釋下這兩個值:
具體的含義可以參考此處的第229行和249行:
SataPortMap=24
配置系統有兩個SATA控制器,第一個控制器有2個接口,第二個控制器有4個接口.
DiskIdxMap=0400
將第一個SATA控制器的接口序號設置爲從5開始,第二個SATA控制器的接口號從1開始(04和00都爲16進制).
2. 用SSD引導後隱藏啓動盤
直接把啓動鏡像寫入到mSATA盤裏面,存儲空間管理員裏面會有一個14G左右的盤始於未使用狀態,就是mSATA盤裏除開啓動分區後的剩餘空間,像下面一樣:
可以將其初始化並利用起來,但14G的空間利用起來也沒什麼價值,且本來自帶的SSD就很弱,用來存資料也有一定崩盤的風險.爲了防止看着礙眼,可以用上面的方法把這個盤隱藏掉.
還是需要通過修改引導盤裏的grub.conf配置文件來實現.
需要在sata_args變量裏增加DiskIdxMap=1000這個值,且在啓動時選擇第三項啓動項(VMware/ESXI)啓動.
即:
# /grub/grub.conf
# 從第31行開始
......
set extra_args_918=''
set common_args_918='syno_hdd_powerup_seq=0 HddHotplug=0 syno_hw_version=DS918+ vender_format_version=2 console=ttyS0,115200n8 withefi elevator=elevator quiet syno_port_thaw=1'
# for testing on VM
set sata_args='SataPortMap=24 DiskIdxMap=1000'# 將兩項加在這後面(10,00都爲16進制)
......
3. 信息中心顯示的處理器的型號
裝好DSM系統以後,信息中心顯示的是白羣暉機器的處理器信息,比如DS3617系統就顯示的是Xeon D處理器的信息,很明顯是直接寫死的.
- 下載ch_cpuinfo_en.tar在電腦上,[這裏下載]
- 通過FileStation將下載好的文件上傳到DSM上
- 用Putty或者其他SSH工具連接上DSM
- 在SSH工具中操作
# 切換到root賬戶;
sudo -i
# 打開ch_cpuinfo.tar文件所在目錄;
cd /volume1/tmp
# 解壓ch_cpuinfo.tar文件;
tar xvf ch_cpuinfo.tar
# 運行ch_cpuinfo文件;
./ch_cpuinfo
# 運行後,按“1”選擇“First Run”,再按“y”鍵;
# 關閉SSH工具,重新登陸後信息中心顯示J1900信息;
休眠
1. 打開休眠調試日誌
這個選項藏得比較深,在左上角菜單→技術支持中心→左邊技術支持服務→啓動系統休眠調試模式
2. 等待觸發休眠問題
保持 NAS 空閒到設定的時間即可.記得把 NAS 的網頁和各種客戶端都關掉,不然接下來的日誌可能會很長沒法分析.我自己是在睡覺之前打開日誌,起來分析.睡覺的時候除了 NAS 和路由器就沒有其他設備開機了,日誌很準確.
3. 分析日誌
會產生兩份日誌,分別是 /var/log/hibernation.log 和 /var/log/hibernationFull.log. 後者是原始數據,前者是去除了一些無價值“連鎖性”操作的精簡版,但它有的時候會精簡過頭,所以我這裏以後者爲例來分析.
首先,將髒塊寫入磁盤的日誌手動排除掉.通常內核不會自發進行大量的磁盤操作,大多數 write block 是用戶態 dirty block 導致的結果,因此可以把包含 WRITE block 和 sync 的行刪除,節省大量的版面.
其次,將非硬盤的寫入排除掉.將包含 on tmpfs 或 on proc 的行刪除即可,剩下的非硬盤文件系統肉眼忽略.
剩下的條目可以進入分析了.比如我這裏在午睡時每段記錄都差不多是這個樣子:
***********Clear*********
[140146.388709] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140146.388721] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140146.388723] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140151.820668] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140151.820682] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140151.820684] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140152.332689] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140152.332696] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140152.332698] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140153.783855] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140153.783870] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140153.783872] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140170.602870] synologrotated(4963): dirtied inode 28083 (.SYNOSYSDB-wal) on md0
[140170.602888] synologrotated(4963): dirtied inode 29789 (.SYNOSYSDB-shm) on md0
[140170.603221] synologrotated(4963): dirtied inode 21538 (.SYNOCONNDB-wal) on md0
[140170.603235] synologrotated(4963): dirtied inode 22044 (.SYNOCONNDB-shm) on md0
[140173.443684] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140173.443696] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140173.443698] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140173.955999] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140173.956006] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140173.956009] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140272.465248] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140272.465265] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140272.465267] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140278.386378] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140278.386390] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140278.386393] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140278.898561] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140278.898569] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140278.898571] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140631.564198] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140631.564209] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140631.564211] btsync(15253): dirtied inode 11404 (sync.log) on md2
[140637.298101] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140637.298113] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140637.298115] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[140637.811061] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140637.811068] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[140637.811071] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141346.340822] btsync(15253): dirtied inode 11404 (sync.log) on md2
[141346.340833] btsync(15253): dirtied inode 11404 (sync.log) on md2
[141346.340836] btsync(15253): dirtied inode 11404 (sync.log) on md2
[141351.508216] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141351.508226] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141351.508228] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141352.021228] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141352.021235] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141352.021238] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141352.494749] btsync(15253): dirtied inode 11404 (sync.log) on md2
[141352.494758] btsync(15253): dirtied inode 11404 (sync.log) on md2
[141352.494760] btsync(15253): dirtied inode 11404 (sync.log) on md2
[141371.039633] synologrotated(4963): dirtied inode 28083 (.SYNOSYSDB-wal) on md0
[141371.039654] synologrotated(4963): dirtied inode 29789 (.SYNOSYSDB-shm) on md0
[141371.039992] synologrotated(4963): dirtied inode 21538 (.SYNOCONNDB-wal) on md0
[141371.040007] synologrotated(4963): dirtied inode 22044 (.SYNOCONNDB-shm) on md0
[141377.244527] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141377.244539] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141377.244541] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141377.757046] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141377.757054] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141377.757056] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141535.911703] dhclient(16778): dirtied inode 19635 (sh) on md0
[141535.911717] dhclient(16778): dirtied inode 19626 (bash) on md0
[141535.911909] dhclient-script(16778): dirtied inode 14958 (libncursesw.so.5) on md0
[141535.911917] dhclient-script(16778): dirtied inode 13705 (libncursesw.so.5.9) on md0
[141535.914460] awk(16782): dirtied inode 13819 (libm.so.6) on md0
[141535.914470] awk(16782): dirtied inode 11177 (libm-2.20-2014.11.so) on md0
[141542.431766] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141542.431778] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141542.431781] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[141542.944314] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141542.944322] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[141542.944324] syno_hibernatio(25655): dirtied inode 5348 (hibernation.log) on md0
[142073.169495] btsync(15253): dirtied inode 11404 (sync.log) on md2
[142073.169512] btsync(15253): dirtied inode 11404 (sync.log) on md2
[142073.169515] btsync(15253): dirtied inode 11404 (sync.log) on md2
[142078.947137] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[142078.947150] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
[142078.947152] syno_hibernatio(25655): dirtied inode 5885 (hibernationFull.log) on md0
uptime : [142078.753468]
======Idle 536 seconds======
Sat Oct 27 14:34:19 CST 2018
進程不多,逐個判斷:
btsync:BTSync 套件,sync.log 顧名思義好了.這樣看來,它頻繁寫日誌是一個很明顯的阻礙休眠的原因.我反正只是裝着,沒配置它,可以把它刪掉.
syno_hibernatio:ps | grep 看一下發現全稱是 syno_hibernation_debug,加之操作的文件名,確定是記錄休眠日誌的工具自身,以後關了就沒了
synologrotated:應該是記錄系統日誌的工具,如果正經休眠了應該就不會有日誌了,這也是個被動來源
dhclient 和 dhclient-script:DHCP 客戶端常規操作,阻擋不了
那麼這一輪下來只能得出需要停止 BTSync 的結論.先這麼做了再說.休眠日誌可以不急着關掉.
再放一天試試.查看系統日誌:
從日誌來看,上面的操作是有效的,硬盤終於能進入休眠了,出現了很多“Internal disks woke up from hibernation”.但是這每半小時一條,相當於休眠沒幾秒又被喚醒了.
於是繼續分析休眠日誌:
***********Clear*********
[236666.547745] syslog-ng(4331): dirtied inode 18 (scemd.log) on md0
[236687.650564] syslog-ng(13085): dirtied inode 18 (scemd.log) on md0
[236687.650585] syslog-ng(13085): dirtied inode 18 (scemd.log) on md0
[236687.650592] syslog-ng(13085): dirtied inode 18 (scemd.log) on md0
[236687.658884] syslog-ng(5016): dirtied inode 28581 (.SYNOSYSDB-shm) on md0
[236687.658893] syslog-ng(5016): dirtied inode 28581 (.SYNOSYSDB-shm) on md0
[236687.658946] syslog-ng(5016): dirtied inode 24584 (.SYNOSYSDB-wal) on md0
[236687.658952] syslog-ng(5016): dirtied inode 24584 (.SYNOSYSDB-wal) on md0
[236687.658954] syslog-ng(5016): dirtied inode 24584 (.SYNOSYSDB-wal) on md0
[236687.664164] logrotate(13090): dirtied inode 41594 (synolog) on md0
[236687.666146] logrotate(13090): dirtied inode 6900 (logrotate.status) on md0
[236687.671082] logrotate(13090): dirtied inode 7905 (logrotate.status.tmp) on md0
[236689.662143] synologaccd(4840): dirtied inode 22952 (.SYNOACCOUNTDB) on md0
[236689.662355] synologaccd(4840): dirtied inode 6900 (.SYNOACCOUNTDB-wal) on md0
[236689.662383] synologaccd(4840): dirtied inode 21526 (.SYNOACCOUNTDB-shm) on md0
[236689.763593] synologaccd(4840): dirtied inode 22952 (.SYNOACCOUNTDB) on md0
[236689.763629] synologaccd(4840): dirtied inode 22952 (.SYNOACCOUNTDB) on md0
[236691.547334] synologrotated(5000): dirtied inode 28581 (.SYNOSYSDB-shm) on md0
[236691.547681] synologrotated(5000): dirtied inode 23485 (.SYNOCONNDB-wal) on md0
[236691.547695] synologrotated(5000): dirtied inode 24677 (.SYNOCONNDB-shm) on md0
[238511.431135] syslog-ng(4331): dirtied inode 18 (scemd.log) on md0
uptime : [238516.475108]
======Idle 1807 seconds======
Wed Oct 24 03:52:06 CST 2018
#####################################################
Only idle 44 seconds, pass
Wed Oct 24 03:52:51 CST 2018
#####################################################
***********Clear*********
[238522.209123] synologrotated(5000): dirtied inode 24584 (.SYNOSYSDB-wal) on md0
[238522.209173] synologrotated(5000): dirtied inode 28581 (.SYNOSYSDB-shm) on md0
[238522.210082] synologrotated(5000): dirtied inode 23485 (.SYNOCONNDB-wal) on md0
[238522.210122] synologrotated(5000): dirtied inode 24677 (.SYNOCONNDB-shm) on md0
[238522.224252] logrotate(19321): dirtied inode 41594 (synolog) on md0
[238522.229880] logrotate(19321): dirtied inode 7905 (logrotate.status) on md0
[238522.244528] logrotate(19321): dirtied inode 6900 (logrotate.status.tmp) on md0
[238531.967854] syslog-ng(19324): dirtied inode 18 (scemd.log) on md0
[238531.967874] syslog-ng(19324): dirtied inode 18 (scemd.log) on md0
[238531.967882] syslog-ng(19324): dirtied inode 18 (scemd.log) on md0
[238531.990488] logrotate(19329): dirtied inode 6900 (logrotate.status.tmp) on md0
[238533.979174] synologaccd(4840): dirtied inode 22952 (.SYNOACCOUNTDB) on md0
[238533.979348] synologaccd(4840): dirtied inode 7905 (.SYNOACCOUNTDB-wal) on md0
[238533.979378] synologaccd(4840): dirtied inode 21526 (.SYNOACCOUNTDB-shm) on md0
[238534.076345] synologaccd(4840): dirtied inode 22952 (.SYNOACCOUNTDB) on md0
[238534.076385] synologaccd(4840): dirtied inode 22952 (.SYNOACCOUNTDB) on md0
[240368.320927] syslog-ng(4331): dirtied inode 18 (scemd.log) on md0
uptime : [240374.147000]
======Idle 1811 seconds======
Wed Oct 24 04:23:02 CST 2018
synocrond:聽起來像是任務計劃程序,裏面有個 DSM 自動更新檢查,觸發頻率不高,應該不太影響
builtin-synodat:不知道是什麼
logrotate:大概也是個日誌程序
synologaccd:繼續是日誌程序
syslog-ng:我也不知道爲什麼羣暉有那麼多日誌管理程序
單次日誌看不出來什麼,但是連着好幾塊都符合剛一休眠就被喚醒(空閒時間是設定的 30 分鐘加十幾秒),且最後一條都是對 (/var/log/)scemd.log 的寫入。這就有點意思了,打開看看裏面是什麼:
2018-10-24T07:00:13+08:00 Hamster-DS scemd: led/led_brightness.c:244 Fail to read /usr/sbin/i2cget
2018-10-24T07:00:13+08:00 Hamster-DS scemd: led.c:35 SYNOGetLedBrightness fail()
2018-10-24T07:00:34+08:00 Hamster-DS scemd: event_disk_hibernation_handler.c:42 The internal disks wake up, hibernate from [Oct 24 07:00:11]
2018-10-24T07:31:09+08:00 Hamster-DS scemd: led/led_brightness.c:244 Fail to read /usr/sbin/i2cget
2018-10-24T07:31:09+08:00 Hamster-DS scemd: led.c:35 SYNOGetLedBrightness fail()
2018-10-24T07:31:30+08:00 Hamster-DS scemd: event_disk_hibernation_handler.c:42 The internal disks wake up, hibernate from [Oct 24 07:31:07]
2018-10-24T08:01:53+08:00 Hamster-DS scemd: led/led_brightness.c:244 Fail to read /usr/sbin/i2cget
2018-10-24T08:01:53+08:00 Hamster-DS scemd: led.c:35 SYNOGetLedBrightness fail()
2018-10-24T08:02:14+08:00 Hamster-DS scemd: event_disk_hibernation_handler.c:42 The internal disks wake up, hibernate from [Oct 24 08:01:53]
2018-10-24T08:32:37+08:00 Hamster-DS scemd: led/led_brightness.c:244 Fail to read /usr/sbin/i2cget
2018-10-24T08:32:37+08:00 Hamster-DS scemd: led.c:35 SYNOGetLedBrightness fail()
2018-10-24T08:32:59+08:00 Hamster-DS scemd: event_disk_hibernation_handler.c:42 The internal disks wake up, hibernate from [Oct 24 08:32:37]
清晰地表明瞭這就是休眠後立即喚醒的原因:由於黑羣沒有 I2C 設備,於是 DSM 在休眠後嘗試更改 LED 亮度(或者顏色、閃爍規律?)時讀取 i2c 設備節點就會出錯,scemd 把這條錯誤信息記到自己的日誌裏,觸發了硬盤寫入,硬盤就在休眠十幾秒後被喚醒了.
4. 修復
根本上修復的話,得硬件上 I2C 適配器,甚至還能順便給黑羣加上白羣的那麼多燈.但這是不現實的,那麼我們就只能採取主流方法:解決提出問題的日誌.預想方案是把這個日誌文件指向內存,讓 scemd 往內存裏寫,就不會喚醒硬盤了.
找到文件:
vim /etc.defaults/syslog-ng/patterndb.d/scemd.conf
修改
destination d_scemd { file("/var/log/scemd.log"); };
爲
destination d_scemd { file("/tmp/scemd.log"); };
重啓系統即可完美休眠.