Homepage
iYoRoy DN42 Network
About
Friends
Language
简体中文
English
Search
1
Docker下中心化部署EasyTier
1,704 Views
2
Adding KernelSU Support to Android 4.9 Kernel
1,090 Views
3
Enabling EROFS Support for an Android ROM with Kernel 4.9
308 Views
4
在TrueNAS上使用Docker安装1Panel
299 Views
5
2025 Yangcheng Cup Preliminary WriteUp
294 Views
Android
Maintenance
NAS
Develop
Network
Projects
DN42
One Man ISP
CTF
Login
Search
Search Tags
Network Technology
BGP
Linux
BIRD
DN42
C&C++
Android
OSPF
MSVC
AOSP
Windows
Docker
caf/clo
TrueNAS
Interior Gateway Protocol
Services
iBGP
Clearnet
DNS
STL
Kagura iYoRoy
A total of
23
articles have been written.
A total of
11
comments have been received.
Index
Column
Android
Maintenance
NAS
Develop
Network
Projects
DN42
One Man ISP
CTF
Pages
iYoRoy DN42 Network
About
Friends
Language
简体中文
English
3
articles related to
were found.
通过Alist使TrueNAS同步到OneDrive
背景 手上有个E5订阅,本来用的方案是Docker运行driveone/onedrive:edge的方式来实现同步,但是这个方案一个是这种方式没有GUI/WebUI,一个是每次同步的时候都会占用掉CPU 25%-50%的性能。考虑到TrueNAS自带的同步方案可以向WebDAV同步,因此想到能用Alist来挂载OneDrive并转换成WebDAV供TrueNAS挂载。 折腾过程 安装Alist 为Alist创建持久化存储文件夹,并根据Alist官方文档编写Docker Compose: services: alist: environment: - PUID=3000 - PGID=950 - UMASK=022 image: xhofe/alist:latest ports: - '8088:5244' restart: always volumes: - /mnt/systemdata/DockerData/alist/etc:/opt/alist/data - /mnt/data/Storage:/mnt/data 此处我将Alist端口开放在8088,其中映射/mnt/data/Storage是为了让Alist可以管理本地的存储;映射/mnt/systemdata/DockerData/alist/etc作为存储Alist数据的文件夹。 关于如何配置Alist上的OneDrive本文不做讨论,请查询Alist官方文档。此处我将我的OneDrive挂载在/OneDrive。 完成后进入Alist后台-用户,编辑你的用户或者创建一个新用户,勾选Webdav 读取、Webdav 管理以使得该用户可以使用WebDAV。 配置TrueNAS同步 进入TrueNAS后台-Credentials-Backup Credentials,添加一个Cloud Credential,参数如下: Provider: WebDAV Name: 自定义 URL: Alist地址+/dav,例如我这里填写http://127.0.0.1:8088/dav WebDAV Service: OTHER Username和Password: Alist账号密码 Verify Credential确认没问题之后保存。 接着进入TrueNAS后台-Data Protection,添加一个Cloud Sync Task,Provider下的Credentials选择刚刚创建的Alist的WebDAV,点击下一步。此处的参数有很多种,详解如下: Direction: 分为PULL和PUSH,分别对应云端同步到本地和本地同步到云端 Transfer Mode: COPY: 复制文件,若源文件夹中先前有的文件后来删除了云端的不会被删除 MOVE: Copy后删除源文件夹相关文件 SYNC: 保持源文件夹和目标文件夹同步,源文件夹删除的文件也会在目标里删除 Directory/Files: 即本地需要同步的文件或文件夹 Folder: 即云端需要同步的文件夹 Description: 注释 Schedule: Cron定时,可以使用他预设的时段或者自己编写 比如我这里选择的是PUSH,SYNC,从/mnt/data/Storage同步到/OneDrive/TrueNAS,每天0:00执行。 编辑完成后保存,即可在你设置的时段自动将本地文件上传到OneDrive。 旧方案的项目地址: https://github.com/abraunegg/onedrive 参考文章: https://alist.nn.ci/zh/guide/install/docker.html https://alist.nn.ci/zh/guide/drivers/onedrive.html
13/03/2025
171 Views
0 Comments
0 Stars
在TrueNAS上使用Docker安装1Panel
背景 家里TrueNAS性能剩余,想着部署个web服务。想要装个面板减少点工作量,又考虑到虚拟机性能折损和zfs cache对内存的要求比较大以及NAS本身性能也不好,便打算使用docker部署。再加上1Panel本身也是以docker为介质,二者共同控制TrueNAS宿主机的docker daemon,约等于直接将网站部署到TrueNAS本地并且也便于管理。 分析 {alert type="warning"} 本文默认TrueNAS可以访问dockerhub并且已经配置好了docker daemon {/alert} 环境信息 Storage Pool 存在两个存储池: /mnt/data: 1 x MIRROR | 2 wide | 2.73 TiB | HDD /mnt/systemdata: 1 x DISK | 1 wide | 223.57 GiB | SSD 其中docker数据存储在2号存储池中。 Datasets 存在三个数据集: Storage: 位于data存储池,存放冷数据 DockerData: 位于systemdata存储池,存放容器的持久化存储文件 KaguraiYoRoy: 位于systemdata,用户home文件夹 安装1Panel 使用了moelin/1panel:latest镜像部署,此步骤很多部分都可以参考镜像作者写的README。项目地址: {cloud title="okxlin/docker-1panel" type="github" url="https://github.com/okxlin/docker-1panel" password=""/} 在DockerData数据集创建了一个文件夹专门用于存储1panel数据,即用作容器内/opt/1panel,位于/mnt/systemdata/DockerData/1panel。 持久卷 因为要允许1Panel管理宿主机docker,因此需要映射/var/run/docker.sock和宿主的docker文件夹 映射上文为其创建的数据文件夹 TrueNAS的docker文件夹和一般的Linux位置不一样,一般的Linux位于/var/lib/docker而TrueNAS的位于/mnt/.ix-apps/docker。 环境变量和端口映射 环境变量和镜像作者的设置相同,传入TZ=Asia/Shanghai;端口映射根据需要自行设置即可,容器内端口为10086。 Docker Compose 有了上述信息,编写docker compose就容易许多了。 完整Docker Compose文件如下: services: 1panel: dns: - 223.5.5.5 environment: - TZ=Asia/Shanghai image: moelin/1panel:latest labels: createdBy: Apps ports: - '8085:10086' restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock - /mnt/.ix-apps/docker:/var/lib/docker - /mnt/systemdata/DockerData/1panel/opt:/opt/1panel - /mnt/systemdata/DockerData/1panel/root:/root - /etc/docker:/etc/docker 这里映射/root是因为我需要在容器内运行Git,而Git config存储在/root下; 设置dns是因为1Panel制作环境镜像的时候需要连网下载数据,不指定dns会报错。 安装完成后访问你设置的端口即可。 1Panel基础信息: 默认账户:1panel 默认密码:1panel_password 默认入口:entrance 故障处理 Docker镜像源 实际测试的时候发现如果不设置镜像源,即使配置了Proxy,在安装PHP环境的时候也会报错~~,并且配置了镜像源同时配置了Proxy也会安装失败,不清楚为什么~~ 打开TrueNAS的/etc/docker/daemon.json并添加registry-mirrors: { "data-root": "/mnt/.ix-apps/docker", "default-address-pools": [ { "base": "172.17.0.0/12", "size": 24 } ], "exec-opts": [ "native.cgroupdriver=cgroupfs" ], "iptables": true, "registry-mirrors": [ "https://docker.1panel.live" ], "storage-driver": "overlay2" } 保存,重启主机docker,再去1Panel里安装环境。 {alert type="warning"} 这一步的配置重启后会丢失,尽量一次性安装好环境和需要的app {/alert} 1Panel创建的容器无法启动 这个是因为在1Panel中,默认存储数据的文件夹是我们所映射出来的/opt/1panel,但是实际上创建的容器运行在TrueNAS里,访问的是TrueNAS里不存在的/opt/1panel,并且其/opt默认是只读的,因此在启动容器的时候会报错Read-only filesystem。 我自己的解决方案也很简单粗暴,在TrueNAS主机中先挂载/opt为可读写,再创建一个软链接指向1Panel的数据文件夹。 cd /opt mount -o remount,rw /opt ln -s /mnt/systemdata/DockerData/1panel/opt 1panel 然后就可以正常使用啦 有一个需要注意的点,在1Panel中安装OpenResty时记得避开使用80和443端口,这俩是TrueNAS的webui默认端口
07/03/2025
299 Views
0 Comments
0 Stars
Migrating RR Loader for Synology DSM
I wrote this article because the original disk was a 16GB USB drive, and the target disk is a 16GB Optane. Although both are 16GB, the original one is slightly larger (I don't know why either orz). Directly using dd won't work since the source disk is larger than the target, so I'm documenting the process here. {alert type="warning"} Data is priceless, tinkering requires caution. {/alert} Analysis The RR boot disk has three partitions: FAT32,50.00MB Ext2,50.00MB Ext4,occupying the remaining space The first partition is the boot partition and is bootable (marked with an asterisk under "Boot" in fdisk -l). The second partition's purpose is unclear, but it's likely for GRUB. The third partition holds Synology's kernel and RR Loader configuration files. Approach Since the first two partitions are small, we can use dd to copy them entirely to the target disk. For the third partition, we'll manually create and format it, then synchronize the UUID and Label. {alert type="warning"} This process uses Linux operations. {/alert} Let's Start Connect both disks to the system: source disk as /dev/sda, target disk as /dev/sdb. Check the source disk information: sudo fdisk -l /dev/sda Output: Disk /dev/sda: 14.55 GiB, 15627976704 bytes, 30523392 sectors Disk model: Storage Media Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x66d0fe82 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 104447 102400 50M 83 Linux /dev/sda2 104448 206847 102400 50M 83 Linux /dev/sda3 206848 30523391 30316544 14.5G 83 Linux Copy the First Two Partitions and Disk Partition Table to the Target Disk sudo dd if=/dev/sda of=dev/sdb count=206848 # Note: The count value here is the start of the third partition above. Adjust according to your disk. Output: 206848+0 records in 206848+0 records out 105906176 bytes (106 MB, 101 MiB) copied, 11.3812 s, 9.3 MB/s Create the Third Partition Open the disk with fdisk: sudo fdisk /dev/sdb First, wipe the existing third partition data: Type d, and when prompted with Partition number (1-3, default 3):, enter 3 or just press Enter. After seeing Partition 3 has been deleted., type n to create a new partition. Select primary partition by typing p, and accept the default options for the rest by pressing Enter. Once done, type w to save and exit. If you're unfamiliar with fdisk, search for tutorials online. Format the Newly Created Partition and Write UUID and Label sudo mkfs.ext4 /dev/sdb3 Check the details of the source disk's third partition using the file command: sudo file -s /dev/sda3 Output: /dev/sda3: Linux rev 1.0 ext4 filesystem data, UUID=617a3aca-4b56-42d7-8558-54411b344a7d, volume name "RR3" (extents) (64bit) (large files) (huge files) Note down the UUID and volume name (i.e., "RR3"), and use the following commands to write them to the new disk: sudo tune2fs /dev/sdb3 -U df39b1f3-b846-49dc-a317-ce329ec87ca2 # Write UUID sudo tune2fs /dev/sdb3 -L RR3 # Write volume name Copy data Mount the third partitions of both disks. Assume the source is mounted at ~/a and the target at ~/b. Then, copy all data from a to b (this step is straightforward with cp, so no detailed explanation needed). Finally, unmount all mount points, disconnect the disks, and connect them to your NAS. The migration should be successful.
30/01/2025
277 Views
0 Comments
4 Stars