RROrg-rr/guide.md
2024-02-01 00:28:14 +08:00

203 lines
9.6 KiB
Markdown

# ENV:
* ### 常用工具:
* telnet 工具 putty (下载: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)
* ssh 工具 FinalShell (下载: https://www.hostbuf.com/t/988.html)
* sftp 工具 WinSCP (下载: https://winscp.net/eng/index.php)
* 文本编辑工具 Notepad3 (下载: https://github.com/rizonesoft/Notepad3/releases)
* 镜像写盘工具 Rufus (下载: https://rufus.ie/zh/)
* 镜像转换工具 StarWind V2V Image Converter (下载: https://www.starwindsoftware.com/starwind-v2v-converter)
* 磁盘管理工具 Diskgenius (下载: https://www.diskgenius.com/)
# LINK:
* 查找:
* http://find.synology.cn/
* http://find.synology.com/
* 下载:
* https://archive.synology.cn/download/Os/DSM
* https://archive.synology.com/download/Os/DSM
* 介绍:
* https://www.synology.cn/zh-cn/products#specs
* https://www.synology.com/en-us/products#specs
* 型号列表:
* https://kb.synology.cn/zh-cn/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have
* https://kb.synology.com/en-us/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have
* RAID计算:
* https://www.synology.cn/zh-cn/support/RAID_calculator
* https://www.synology.com/en-us/support/RAID_calculator
# 安装条件
1. 引导盘:当前支持 SATA/SCSI/NVME/MMC/IDE or USB 设备, 且要大于 2GB. (SCSI比较复杂,并不是全部可用)
2. 安装盘: 至少需要1个SATA接口硬盘 或者 1个 MMC 作为存储设备. 且要大于 32GB 才可创建存储池.
3. 内存: 需要大于 4GB.
4. DT的型号目前不支持HBA扩展卡(较新版本的RR引导 SA6400 支持).
5. NVME的PCIPATH有两种格式, 单层路径的兼容 DT 的型号, 多层路径的兼容 DS918+ 等型号.
# GPU
* vGPU: https://blog.kkk.rs/
* iGPU: https://jim.plus/
* iGPU: https://github.com/MoetaYuko/intel-gpu-i915-backports
# RR:
* RR 各版本间切换(手动方式, 全量):
```shell
# 在 shell 中下载需要的版本或者手动上传到 ~/ 下
# Download the required version in the shell or manually upload it to ~/
curl -kL -o ~/rr.zip https://github.com/wjz304/rr/releases/download/23.4.5/rr-23.11.1.img.zip
# 卸载挂载的引导盘
# Uninstalling the mounted boot disk
umount /mnt/p1 /mnt/p2 /mnt/p3
# 解压 并写入到引导盘
# Decompress and write to the boot disk
# 获取当前的引导盘
LOADER_DISK="$(blkid | grep 'LABEL="RR3"' | cut -d3 -f1)"
unzip -p rr.zip | dd of=${LOADER_DISK} bs=1M conv=fsync
# 重启 reboot
reboot
```
* RR 备份 (Any version):
```shell
# 备份为 disk.img.gz, 自行导出.
dd if=`blkid | grep 'LABEL="RR3"' | cut -d3 -f1` | gzip > disk.img.gz
# 结合 transfer.sh 直接导出链接
curl -skL --insecure -w '\n' --upload-file disk.img.gz https://transfer.sh
```
* RR 开机强行进入到 RR shell:
```shell
# 在 wait IP 的时候, 快速的连上, 杀死 boot.sh 进程.
kill `ps | grep -v grep | grep boot.sh | awk '{print $1}'`
```
# SYNO:
* ssh 开启 root 权限:
```shell
sudo -i
sed -i 's/^.*PermitRootLogin.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
synouser --setpw root xxxxxx # xxxxxx 为你要设置的密码
systemctl restart sshd
```
* dsm下挂载引导盘:
```shell
sudo -i
echo 1 > /proc/sys/kernel/syno_install_flag
ls /dev/synoboot* # 正常会有 /dev/synoboot /dev/synoboot1 /dev/synoboot2 /dev/synoboot3
# 挂载第1个分区
mkdir -p /tmp/synoboot1
mount /dev/synoboot1 /tmp/synoboot1
ls /tmp/synoboot1/
# 挂载第2个分区
mkdir -p /tmp/synoboot2
mount /dev/synoboot2 /tmp/synoboot2
ls /tmp/synoboot2/
```
* dsm下重启到RR(免键盘) (Any version):
```shell
sudo -i # 输入密码
/usr/bin/rr-reboot.sh "config"
```
* dsm下修改sn (Any version):
```shell
sudo -i # 输入密码
SN=xxxxxxxxxx # 输入你要设置的SN
echo 1 > /proc/sys/kernel/syno_install_flag
[ -b "/dev/synoboot1" ] && (mkdir -p /tmp/synoboot1; mount /dev/synoboot1 /tmp/synoboot1)
[ -f "/tmp/synoboot1/user-config.yml" ] && OLD_SN=`grep '^sn:' /tmp/synoboot1/user-config.yml | sed -r 's/sn:(.*)/\1/; s/[\" ]//g'`
[ -n "${OLD_SN}" ] && sed -i "s/${OLD_SN}/${SN}/g" /tmp/synoboot1/user-config.yml
reboot
```
* 群晖 opkg 包管理:
```shell
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
/opt/bin/opkg update
/opt/bin/opkg install rename
```
## DEBUG
* log:
```
# 内核相关
sysctl -n kernel.syno_serial # 查看当前鉴权的 SN
cat /proc/sys/kernel/syno_serial # 查看当前鉴权的 SN
sysctl -n kernel.syno_mac_address1 # 查看当前鉴权的 mac1 (kernel.syno_mac_addresses)
cat /proc/sys/kernel/syno_mac_address1 # 查看当前鉴权的 mac1 (/proc/sys/kernel/syno_mac_addresses)
sysctl -n kernel.syno_internal_netif_num # 查看当前鉴权的网卡数量
cat /proc/sys/kernel/syno_internal_netif_num # 查看当前鉴权的网卡数量
nproc # 查看当前线程数
# 设备相关
lsmod # 查看已加载驱动
lsusb # 查看 USB 设备
lsblk # 查看磁盘设备
lspci -Qnn # 查看 PCI 设备
# 驱动相关
ls -ld /sys/class/net/*/device/driver # 查看已加载网卡和对应驱动
cat /sys/class/net/*/address # 查看已加载网卡的 MAC 地址
# 磁盘相关
fdisk -l # 查看硬盘信息
lspci -d ::100 # 查看 SCSI 存储控制器 https://admin.pci-ids.ucw.cz/read/PD/
lspci -d ::101 # 查看 IDE 接口
lspci -d ::102 # 查看 软盘 磁盘控制器
lspci -d ::103 # 查看 IPI 总线控制器
lspci -d ::104 # 查看 RAID 总线控制器
lspci -d ::105 # 查看 ATA 总线控制器
lspci -d ::106 # 查看 SATA 总线控制器
lspci -d ::107 # 查看 串行 Attached SCSI
lspci -d ::108 # 查看 NVM 控制器
ls -l /sys/class/scsi_host # 查看 ATA 硬盘 host 信息
ls -l /sys/class/mmc_host # 查看 MMC 硬盘 host 信息
ls -l /sys/class/nvme # 查看 NVME 硬盘 host 信息
ls /sys/block/ # 查看块设备
ls /sys/block/sd* # 查看识别的 sata 硬盘 (非设备树(dtb)的型号)
ls /sys/block/sata* # 查看识别的 sata 硬盘 (设备树(dtb)的型号)
ls /sys/block/nvme* # 查看识别的 nvme 硬盘
ls /sys/block/mmc* # 查看识别的 mmc 硬盘
ls /sys/block/usb* # 查看识别的 usb 硬盘
cat /sys/block/sd*/device/syno_block_info # 查看识别的 sata 硬盘挂载点 (非设备树(dtb)的型号)
cat /sys/block/sata*/device/syno_block_info # 查看识别的 sata 硬盘挂载点 (设备树(dtb)的型号)
cat /sys/block/nvme*/device/syno_block_info # 查看识别的 nvme 硬盘挂载点
# 服务相关
journalctl -xe # 查看服务日志
systemctl # 查看服务
systemctl | grep failed # 查看失败的服务
systemctl list-unit-files # 查看服务配置文件
systemctl list-units # 查看服务状态
systemctl status cpufreq.service # 查看 CPU 频率调节器状态
systemctl start cpufreq.service # 启动 CPU 频率调节器
systemctl stop cpufreq.service # 停止 CPU 频率调节器
systemctl enable cpufreq.service # 开机启动 CPU 频率调节器
systemctl disable cpufreq.service # 永久停止 CPU 频率调节器
netstat -tunlp # 查看端口
lsof -i :7681 # 查看 7681 端口占用情况
# 日志相关
dmesg # 内核日志
cat /proc/cmdline # 内核启动参数
cat /var/log/messages # 系统消息日志
cat /var/log/linuxrc.syno.log # 系统 linuxrc 日志 (junior mode)
cat /tmp/installer_sh.log # 系统安装日志 (junior mode)
# 显卡相关
lspci -d ::300 # 查看 VGA 兼容控制器
lspci -d ::301 # 查看 XGA 控制器
lspci -d ::302 # 查看 3D 控制器(不是 VGA 兼容)
# Intel GPU
lspci -nd ::300 | cut -d " " -f 3 # PIDVID
ls /dev/dri # 查看显卡设备
cat /sys/kernel/debug/dri/0/i915_frequency_info # 显卡驱动详细信息
# Nvidia GPU
ls /dev/nvid* # 查看显卡设备
nvidia-smi # 显卡驱动详细信息
# Get MD5
certutil -hashfile xxx.pat MD5 # windows
md5sum xxx.pat # linux/mac
```