Difference between revisions of "APITestPage"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
Line 1: Line 1:
[[Getting Started with OpenMediaVault|English]]
+
[[Getting Started with OpenMediaVault/zh|查看中文]]
==OpenMediaVault版本信息==
+
==OpenMediaVault version==
 
* OS: Debian 12<br />
 
* OS: Debian 12<br />
 
* OpenMediaVault: 7.0.5-1 (Sandworm)<br />
 
* OpenMediaVault: 7.0.5-1 (Sandworm)<br />
 
* Docker: 26.0.1<br />
 
* Docker: 26.0.1<br />
* Others: 已安装OMV-Extras软件包<br />
+
* Others: built-in OMV-Extras<br />
==旧版本的OpenMediaVault文档==
+
==Earlier version OpenMediaVault==
Link to → [[Getting Started with OpenMediaVault6/zh|Getting Started with OpenMediaVault6]]
+
Link to → [[Getting Started with OpenMediaVault6|Getting Started with OpenMediaVault6]]
==OpenMediaVault运行界面==
+
==First Look==
[[File:Openmediavault7-zh.png|600px]]
+
[[File:Openmediavault7.png|600px]]
==支持的平台==
+
==Supported platforms==
 
* RK3328<br />
 
* RK3328<br />
 
* RK3399<br />
 
* RK3399<br />
 
* RK3568<br />
 
* RK3568<br />
 
* RK3588<br />
 
* RK3588<br />
==查看IP地址==
+
==Find IP Address==
由于主机名默认为开发板的型号, 所以可以使用ping命令来获得IP地址,例如CM3588,可以用命令:
+
Since the hostname is set by default to the model of the development board, you can use the "ping" command to obtain the IP address. For example, for CM3588, you can use the following command:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
ping CM3588
 
ping CM3588
 
</syntaxhighlight>
 
</syntaxhighlight>
==登录OpenMediaVault网页后台==
+
==Access the OpenMediaVault web page==
在网页浏览器输入开发板的IP地址, 网页登录帐号默认为:
+
Enter the IP address of the development board in your web browser; the default login account for the web interface is:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
用户名: admin
+
Username: admin
密码: openmediavault
+
Password: openmediavault
 
</syntaxhighlight>
 
</syntaxhighlight>
==设置网页登录密码==
+
==Change admin password==
网页上点击右上角的头像,选择 “更改密码”
+
Click on the profile icon in the upper-right corner of the web page, then select '''"Change Password"'''.
==设置网页超时时间==
+
==Configure the web page timeout duration==
进入 '''系统 -> 工作台''',设置"自动登出"时间。
+
Go to '''System -> Workbench''' and adjust the '''"Auto Logout"''' time setting.
==通过ssh登录==
+
==Root Login via SSH==
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
ssh pi@YourIPAddress
 
ssh pi@YourIPAddress
 
</syntaxhighlight>
 
</syntaxhighlight>
pi用户的初始密码为 pi
+
The default password is '''"pi"'''.
==创建root用户==
+
==Create the root user==
创建root用户并加入root和ssh组:
+
Create the root user and add user to the root and ssh groups:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo passwd root
 
sudo passwd root
Line 41: Line 41:
 
sudo gpasswd -a root _ssh
 
sudo gpasswd -a root _ssh
 
</syntaxhighlight>
 
</syntaxhighlight>
以后就可以用root用户登录ssh:
+
You can now use the root user to log in via SSH:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
ssh root@IPAddress
 
ssh root@IPAddress
 
</syntaxhighlight>
 
</syntaxhighlight>
==终端配置界面==
+
==First Aid Setup==
用root用户登录ssh:
+
Login to your OMV via SSH as root user:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
ssh root@IPAddress
 
ssh root@IPAddress
 
</syntaxhighlight>
 
</syntaxhighlight>
执行如下命令:
+
Excute the following command:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
omv-firstaid
 
omv-firstaid
 
</syntaxhighlight>
 
</syntaxhighlight>
界面如下:<br />
+
Something like this should appear:<br />
 
[[File:Omv-firstaid.png|400px]]
 
[[File:Omv-firstaid.png|400px]]
==硬盘挂载==
+
==Set up your drives==
(注:如果硬盘之前已经初始化,无需重新擦除,RAID可以得到保留,直接挂载即可)<br />
+
Note: If the hard drive has already been initialized and RAID has been preserved, you should be able to mount it directly.<br /><br />
本章节所介绍的两种Raid配置的区别:
+
The difference between the following two Raid Profiles:
* MD RAID:性能更好,因为它在并行写入和读取分块方面做得更好。
+
* MD RAID: has better performance, because it does a better job of parallelizing writes and striping reads.<br />
* Btrfs RAID:数据安全性更好,因为校验和使其能够确定块的哪个副本出错,当只有一个副本出错时,并且它能够判断两个副本是否都有问题。
+
* Btrfs RAID: has better data safety, because the checksumming lets it ID which copy of a block is wrong when only one is wrong, and means it can tell if both copies are bad.<br />
更多内容请参考:[https://docs.openmediavault.org/en/latest/administration/storage/raid.html|RAID]
+
More content please refre: [https://docs.openmediavault.org/en/latest/administration/storage/raid.html|RAID]
===第一步:清除磁盘===
+
===Step 1: Wipe drives===
进入 '''存储器 -> 磁盘''',选中你的存储器,点击'''“擦除"'''图标进行擦除 (注意备份你的数据),一般选'''“快速”'''即可。<br />
+
Go to '''Storage -> Disks''', choose your storage device, and click the "Wipe" icon to initiate disk erasure (please ensure your data is backed up). Typically, you can opt for a "Quick" erase option.<br />
如果磁盘无法擦除,你需要先移除此磁盘上的共享文件夹并取消挂载。
+
If wiping isn't effective, you should first remove the shared folder and unmount it.
===第二步:配置软RAID===
+
===Step 2: Configure Software RAID===
(注: 不支持USB 接口的硬盘,OpenMediaVault创建RAID的页面上不会列出USB接口的存储设备)
+
(Note: OMV does not support RAID for USB-connected devices)
====方案1: MD RAID====
+
====Optional 1: MD RAID====
* 进入 '''存储器 -> 多重装置''',点击'''“+”'''图标,选择RAID级别,应用即可。<br />
+
* Go to '''Storage -> Multiple Device''', click the '''"+"''' icon, select the desired RAID level, and apply the settings.
* 进入 '''存储器 -> 文件系统''',点击'''“+”''',类型建议选择'''"BTRFS"''',选择'''"Single"'''并钩选你的存储设备,如果在上一步中创建了RAID,就选择设备名为 /dev/md 开头的设备。<br />
+
* 格式化完成后,OpenMediaVault 将提示您选择要挂载的文件系统。
+
====方案2:Btrfs RAID====
+
* 进入 '''存储 -> 文件系统''',点击 '''"+"''' 图标,选择 '''"BTRFS"''',选择 RAID 级别,选择您的磁盘,然后保存设置。<br />
+
* 格式化完成后,OpenMediaVault 将让您选择要挂载的文件系统,它不会列出所有磁盘,因此您应选择以 /dev/nvme 开头的驱动器。
+
==创建共享文件夹==
+
进入'''存储器 -> 共享文件夹''',添加'''"+"'''图标创建2个文件夹,名称分别为'''nfs'''和'''samba''',我们接下来将用这些文件夹来测试nfs和samba共享。<br />
+
(注:如果硬盘中存在同名的共享文件夹,重新创建同名的文件夹,数据会得到保留)
+
==创建NAS用户==
+
Debian系统的用户或通过命令行创建的Linux会缺少诸如samba之类服务的访问权限,因此这里推荐使用OpenMediaVault界面创建一个用户用于访问samba和nfs共享,这里我会创建一个名为'''nasuser'''的用户和组:<br />
+
 
<br />
 
<br />
* 点击'''用户 -> 用户组''',点击 '''"+"''' 图标创建一个名为 '''nasuser''' 的用户组。
+
* Go to '''Storage" -> "File Systems''', click on the '''"+"''' icon, and for the type, it's recommended to choose "BTRFS", Select "Single" and devices. <br />
* 点击'''用户 -> 用户''',点击 '''"+"''' 图标后创建一个名为 '''nasuser''',Shell选择/usr/sbin/nologin, 用户组钩选'''nasuser''''''users'''的用户。
+
* If you created a RAID in the previous step, select a device starting with "/dev/md". If it's a USB hard drive, choose "/dev/sda".<br />
==创建Samba共享==
+
After formatting is complete, OpenMediaVault will prompt you to select the file system to mount.
* 点击'''服务 -> SMB/CIFS -> 设置''', 钩选最上面的 "已启动", 最低协议版本选择 '''"SMB1"''',然后点 "保存"
+
====Optional 2: Btrfs RAID====
* 点击'''服务 -> SMB/CIFS -> 共享''', 点击 '''"+"''' ,在 '''"Shared folder"''' 处选择要共享的文件夹,这里我选择samba文件夹。
+
* Go to '''Storage -> File Systems''' click the '''"+"''' icon, choose the '''"BTRFS"''', choose the RAID level, select your disks, and then save the settings.<br />
测试访问: <br />
+
* After formatting is complete, openmediavault will let you choose which file system to mount, it doesn't list all the disks, so you should choose a drive that starts with /dev/nvme.
在Mac系统下右击Finder,选择连接服务器后输入 smb://YourIPAddress(换成真实IP),会弹出验证对话框,输入用户名nasuser以及密码即可以访问。
+
===Step 3: Create shared folders===
==创建NFS共享==
+
Go to '''Storage -> Shared Folders''', click the '''"+"''' icon to create two folders named "nfs" and "samba." We will use these folders for testing NFS and Samba sharing in the following steps.<br />
* 点击"服务" -> "NFS" -> "设置", 钩选最上面的 "已启动", "版本"一栏中,钩选所有版本包括'''“NFSv2”''',然后点 "保存"并应用设置;
+
(Note: If there were previously created shared folders on the drive, you can recreate them with the same names, and the data will be preserved.)
* 点击"服务" -> "NFS" -> "共享", 点击 '''"+"''' ,在 '''"Shared folder"''' 处选择要共享的文件夹,这里我选择 nfs 文件夹。在客户端一栏中输入 192.168.1.0/24 (换成真实网段,或指定仅允许访问的IP),权限处选择 "/",在扩展选项中输入:  
+
==Create NAS users==
 +
Debian system users or Linux users created via the command line may lack certain permissions required for services like Samba and NFS. Therefore, it is recommended to use the OpenMediaVault interface to create a user specifically for accessing Samba and NFS shares. Here, I will create a user and group named "nasuser":<br />
 +
<br />
 +
Go to '''Users -> Groups''' and then click the '''"+"''' icon to create a user group named "nasuser".<br />
 +
Go to '''Users -> "Users''' then click the '''"+"''' icon to create a user named "nasuser", change user's shell to "/usr/sbin/nologin", and select the "nasuser" and "users" groups.
 +
==Create a Samba share==
 +
Go to '''Services -> SMB/CIFS -> Settings''', check the box at the top for "Enabled," select "SMB1" as the minimum protocol version, and then click "Save"<br />
 +
<br />
 +
Go to '''Services -> SMB/CIFS -> Shares''', click the '''"+"''' button, and in the "Shared folder" field, select the folder you want to share. as an example, here i select the "samba" folder<br />
 +
<br />
 +
Testing: <br />
 +
On a Mac system, right-click Finder, select '''"Connect to Server"''', and enter "smb://YourIPAddress" (replace with the actual IP address). An authentication dialog will appear; enter the username "nasuser" and the password to access the share.
 +
==Create an NFS share==
 +
Go to '''Services -> NFS -> Settings''', check the box at the top for "Enabled", and in the "Versions" section, select all versions, including "NFSv2", then click "Save" and apply the settings.<br />
 +
<br />
 +
Go to '''Services -> NFS -> Shares''', click the '''"+"''' button, and in the "Shared folder" field, select the folder you want to share. here i select the "nfs" folder. In the "Client" section, enter the IP range or specific IPs that are allowed to access the share (e.g., 192.168.1.0/24). Set the permissions to "Read/Write", in the "Extra Options" field, Input:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
rw,async,insecure,no_subtree_check,all_squash,anonuid=0,anongid=0
 
rw,async,insecure,no_subtree_check,all_squash,anonuid=0,anongid=0
 
</syntaxhighlight>
 
</syntaxhighlight>
然后点 "保存"并应用设置;
+
Then click "Save" and apply the settings.
===Mac下测试挂载NFS===
+
===Testing NFS mounting on a Mac===
命令行查看OpenMediaVault的NFS共享信息
+
Viewing OpenMediaVault's NFS Share Information via Command Line:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
# showmount -e YourIPAddress
 
# showmount -e YourIPAddress
Line 102: Line 107:
 
/export/nfs                         192.168.1.0/24
 
/export/nfs                         192.168.1.0/24
 
</syntaxhighlight>
 
</syntaxhighlight>
在Mac上右击Finder,选择连接服务器,在地址栏输入
+
Right-click Finder on your Mac, select "Connect to Server," and input the following in the address bar:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
nfs://YourIPAddress/export/nfs
 
nfs://YourIPAddress/export/nfs
 
</syntaxhighlight>
 
</syntaxhighlight>
===Linux下测试挂载NFS===
+
===Testing NFS mounting on Linux===
安装软件包
+
Installing the NFS client
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo apt install nfs-common
 
sudo apt install nfs-common
 
</syntaxhighlight>
 
</syntaxhighlight>
挂载
+
Start to mount:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo mount -t nfs YourIPAddress:/export/nfs /mnt/nfs
 
sudo mount -t nfs YourIPAddress:/export/nfs /mnt/nfs
 
</syntaxhighlight>
 
</syntaxhighlight>
查看状态
+
Checking the Status
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
# df -h | grep nfs
 
# df -h | grep nfs
 
YourIPAddress:/export/nfs  7.3G  3.5M  6.8G    1% /mnt/nfs
 
YourIPAddress:/export/nfs  7.3G  3.5M  6.8G    1% /mnt/nfs
 
</syntaxhighlight>
 
</syntaxhighlight>
设置开机自动挂载,添加如下内容到 /etc/fstab
+
To configure automatic mounting at boot time, append the following line to the /etc/fstab file:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
YourIPAddress:/export/nfs /mnt/nfs nfs defaults 0 0
 
YourIPAddress:/export/nfs /mnt/nfs nfs defaults 0 0
 
</syntaxhighlight>
 
</syntaxhighlight>
==Docker的使用==
+
==Docker in OMV==
===将Docker数据移动至硬盘===
+
===Moving docker storage===
进入'''存储器 -> 共享文件夹''',添加 '''"+"''' 图标创建3个文件夹,分别为
+
Go to '''Storage -> Shared Folders''', and click the '''"+"''' icon to create three folders, namely:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
docker            -> Docker数据目录,在/etc/docker/daemon.json中定义
+
docker            -> The Docker data directory, defined in /etc/docker/daemon.json
 
docker-compose    -> Location of compose files
 
docker-compose    -> Location of compose files
 
docker-data      -> Location of persistent container data
 
docker-data      -> Location of persistent container data
docker-app        -> 自用,存放Dockerfile和数据
+
docker-app        -> For personal use, storing Dockerfiles and data
 
</syntaxhighlight>
 
</syntaxhighlight>
进入'''服务 -> Compose''',进入设置界面,设置"Compose 文件"的Shared folder为docker-compose, 设置"Data“的Shared folder为docker-data,<br />
+
Go to '''Services -> Compose''' enter the '''"Settings"''' interface, and configure the "Shared folder" for "Compose Files" and "Data":<br />
<br />
+
Access the SSH terminal and execute the following command to move Docker data to the shared folder, where "/srv/dev-disk-by-uuid-XXYYZZ/docker" represents the absolute path of the shared folder, which can be obtained from the "Storage" -> "Shared Folders" list on the web interface:
进入ssh终端,输入以下命令,将docker数据移动到共享文件夹, 其中,'''/srv/dev-disk-by-uuid-XXYYZZ/docker''' 是共享文件夹的绝对路径,可以在网页 '''存储器 -> 共享文件夹''' 列表中得到:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
su root
 
su root
Line 141: Line 145:
 
mv /var/lib/docker/* /srv/dev-disk-by-uuid-XXYYZZ/docker/
 
mv /var/lib/docker/* /srv/dev-disk-by-uuid-XXYYZZ/docker/
 
</syntaxhighlight>
 
</syntaxhighlight>
在页面上设置 '''Docker存储''' 为该docker共享文件夹的绝对路径,保存并应用后, 重启开发板。
+
On the web interface, set the '''"Docker storage"''' to the absolute path of the "docker" shared folder. save the settings and apply, and then reboot the system.<br />
<br />GUI 上填写的最终数值:<br />
+
<br />The final value filled on the Gui:<br />
 
<syntaxhighlight lang="text">
 
<syntaxhighlight lang="text">
 
Compose Files's Shared folder  -> on /dev/md0, docker-compose
 
Compose Files's Shared folder  -> on /dev/md0, docker-compose
Line 148: Line 152:
 
Docker's Docker storage        -> on /srv/dev-disk-by-uuid-XXYYZZ/docker/
 
Docker's Docker storage        -> on /srv/dev-disk-by-uuid-XXYYZZ/docker/
 
</syntaxhighlight>
 
</syntaxhighlight>
===Docker安装nextcloud网盘===
+
===Install Nextcloud with Docker===
命令行界面输入以下命令即可:
+
Run the following command in the terminal:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
su root
 
su root
Line 161: Line 165:
 
     --privileged=true  arm64v8/nextcloud
 
     --privileged=true  arm64v8/nextcloud
 
</syntaxhighlight>
 
</syntaxhighlight>
完成后在网页浏览器访问http://YourIPAddress:8888/即可看到nextcloud网盘的页面,如果无法访问,建议重启一下设备。
+
you can access the Nextcloud web interface by opening a web browser and navigating to http://YourIPAddress:8888/ (replace YourIPAddress with the actual IP address of your device).
===Docker安装Filebrowser===
+
===Install Filebrowser with Docker===
命令行界面输入以下命令即可:
+
Run the following command in the terminal:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
su root
 
su root
Line 176: Line 180:
 
     filebrowser/filebrowser
 
     filebrowser/filebrowser
 
</syntaxhighlight>
 
</syntaxhighlight>
完成后在网页浏览器访问http://YourIPAddress:8080/即可看到Filebrowser的页面,默认管理员的帐号与密码都是admin。
+
 
===Docker安装Jellyfin影音服务器===
+
After completing the setup, you can access the Filebrowser web interface by opening a web browser and navigating to http://YourIPAddress:8080/ (replace YourIPAddress with the actual IP address of your device). The default username and password for Filebrowser are both "admin".
进入 '''存储器 -> 共享文件夹''',添加 '''"+"''' 图标创建media文件夹用于存放影音资源,然后在命令行终端输入以下命令安装Jellyfin:
+
===Install Jellyfin with Docker===
 +
Go to '''Storage -> Shared Folders''',  click the '''"+"''' icon to create a "media" folder for storing multimedia resources. Then, in the command-line terminal, you can run the following command to install Jellyfin:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
su root
 
su root
Line 194: Line 199:
 
jellyfin/jellyfin
 
jellyfin/jellyfin
 
</syntaxhighlight>
 
</syntaxhighlight>
完成后在网页浏览器访问http://YourIPAddress:8096/即可看到Jellyfin的页面。
+
After completing the setup, you can access the Jellyfin web interface by opening a web browser and navigating to http://YourIPAddress:8096/ (replace YourIPAddress with the actual IP address of your device). This will allow you to access and manage your media content using Jellyfin.
===安装Docker可视化容器管理工具Portainer===
+
===Install Portainer with Docker===
命令行界面输入以下命令即可:
+
Run the following command in the terminal:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
su root
 
su root
Line 214: Line 219:
 
   portainer/portainer-ce:latest
 
   portainer/portainer-ce:latest
 
</syntaxhighlight>
 
</syntaxhighlight>
完成后在网页浏览器访问http://YourIPAddress:9000/即可看到Portainer的页面,默认管理员的帐号与密码都是admin。
+
After completing the setup, you can access the Portainer web interface by opening a web browser and navigating to http://YourIPAddress:9000/ (replace YourIPAddress with the actual IP address of your device). The default administrator account username and password are both "admin".
==系统的备还与还原==
+
==System Backup and Restore==
===备份eMMC中的系统===
+
===Backing up the System in eMMC===
使用tar命令备份文件系统的内容:
+
Use the tar command to back up the contents of the file system:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
su root
 
su root
Line 226: Line 231:
 
     --exclude=/usr/local/first_boot_flag --one-file-system /
 
     --exclude=/usr/local/first_boot_flag --one-file-system /
 
</syntaxhighlight>
 
</syntaxhighlight>
===还原系统到eMMC===
+
=== Restoring the System to eMMC ===
使用SD卡启动,启动Linux系统(例如Debian或Ubuntu均可),使用如下命令查询eMMC上的系统根分区:
+
Boot from the SD card, start the Linux system (such as Debian or Ubuntu), and use the following command to query the root partition of the system on eMMC:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
root@CM3588:~# sudo parted -s /dev/mmcblk2 unit MiB print | grep rootfs
 
root@CM3588:~# sudo parted -s /dev/mmcblk2 unit MiB print | grep rootfs
 
  8      140MiB  59000MiB  58860MiB  ext4        rootfs
 
  8      140MiB  59000MiB  58860MiB  ext4        rootfs
 
</syntaxhighlight>
 
</syntaxhighlight>
根据上面的序号8可以得知根分区的设备名为/dev/mmcblk2p8,下面对它重新格式化并挂载,然后解压rootfs.tar.gz到此处:
+
According to the mathematical index 8 mentioned above, the device name for the root partition is /dev/mmcblk2p8. Below, it will be reformatted, mounted, and then the rootfs.tar.gz will be decompressed here:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo mkfs.ext4 /dev/mmcblk2p8
 
sudo mkfs.ext4 /dev/mmcblk2p8
Line 240: Line 245:
 
sudo poweroff
 
sudo poweroff
 
</syntaxhighlight>
 
</syntaxhighlight>
关机后,拨出SD卡,重新上电从eMMC启动系统。
+
After shutting down, remove the SD card, and then power on again to boot the system from eMMC.
==系统重装后恢复硬盘数据==
+
==How to recover files after reinstalling OpenMediaVault==
* 进入 '''存储器 -> 文件系统''', 点击 '''►''' 图标,在 '''文件系统''' 一栏选择你的设备,点保存。
+
* Go to '''Storage -> File System''', click on the '''►''' icon, and select your device in the '''File System''' section, then click Save.
* 进入 '''存储器 -> 共享文件夹''', 创建同名共享文件名,例如本文示例中的nfs, samba, docker, docker-app, docker-compose和docker-data。
+
* Go to '''Storage -> Shared Folders''', create shared folders with the same names, such as nfs, samba, docker, docker-app, docker-compose, and docker-data, as shown in this document.

Revision as of 05:50, 19 April 2024

查看中文

1 OpenMediaVault version

  • OS: Debian 12
  • OpenMediaVault: 7.0.5-1 (Sandworm)
  • Docker: 26.0.1
  • Others: built-in OMV-Extras

2 Earlier version OpenMediaVault

Link to → Getting Started with OpenMediaVault6

3 First Look

Openmediavault7.png

4 Supported platforms

  • RK3328
  • RK3399
  • RK3568
  • RK3588

5 Find IP Address

Since the hostname is set by default to the model of the development board, you can use the "ping" command to obtain the IP address. For example, for CM3588, you can use the following command:

ping CM3588

6 Access the OpenMediaVault web page

Enter the IP address of the development board in your web browser; the default login account for the web interface is:

Username: admin
Password: openmediavault

7 Change admin password

Click on the profile icon in the upper-right corner of the web page, then select "Change Password".

8 Configure the web page timeout duration

Go to System -> Workbench and adjust the "Auto Logout" time setting.

9 Root Login via SSH

ssh pi@YourIPAddress

The default password is "pi".

10 Create the root user

Create the root user and add user to the root and ssh groups:

sudo passwd root
sudo gpasswd -a root root
sudo gpasswd -a root _ssh

You can now use the root user to log in via SSH:

ssh root@IPAddress

11 First Aid Setup

Login to your OMV via SSH as root user:

ssh root@IPAddress

Excute the following command:

omv-firstaid

Something like this should appear:
Omv-firstaid.png

12 Set up your drives

Note: If the hard drive has already been initialized and RAID has been preserved, you should be able to mount it directly.

The difference between the following two Raid Profiles:

  • MD RAID: has better performance, because it does a better job of parallelizing writes and striping reads.
  • Btrfs RAID: has better data safety, because the checksumming lets it ID which copy of a block is wrong when only one is wrong, and means it can tell if both copies are bad.

More content please refre: [1]

12.1 Step 1: Wipe drives

Go to Storage -> Disks, choose your storage device, and click the "Wipe" icon to initiate disk erasure (please ensure your data is backed up). Typically, you can opt for a "Quick" erase option.
If wiping isn't effective, you should first remove the shared folder and unmount it.

12.2 Step 2: Configure Software RAID

(Note: OMV does not support RAID for USB-connected devices)

12.2.1 Optional 1: MD RAID

  • Go to Storage -> Multiple Device, click the "+" icon, select the desired RAID level, and apply the settings.


  • Go to Storage" -> "File Systems, click on the "+" icon, and for the type, it's recommended to choose "BTRFS", Select "Single" and devices.
  • If you created a RAID in the previous step, select a device starting with "/dev/md". If it's a USB hard drive, choose "/dev/sda".

After formatting is complete, OpenMediaVault will prompt you to select the file system to mount.

12.2.2 Optional 2: Btrfs RAID

  • Go to Storage -> File Systems click the "+" icon, choose the "BTRFS", choose the RAID level, select your disks, and then save the settings.
  • After formatting is complete, openmediavault will let you choose which file system to mount, it doesn't list all the disks, so you should choose a drive that starts with /dev/nvme.

12.3 Step 3: Create shared folders

Go to Storage -> Shared Folders, click the "+" icon to create two folders named "nfs" and "samba." We will use these folders for testing NFS and Samba sharing in the following steps.
(Note: If there were previously created shared folders on the drive, you can recreate them with the same names, and the data will be preserved.)

13 Create NAS users

Debian system users or Linux users created via the command line may lack certain permissions required for services like Samba and NFS. Therefore, it is recommended to use the OpenMediaVault interface to create a user specifically for accessing Samba and NFS shares. Here, I will create a user and group named "nasuser":

Go to Users -> Groups and then click the "+" icon to create a user group named "nasuser".
Go to Users -> "Users then click the "+" icon to create a user named "nasuser", change user's shell to "/usr/sbin/nologin", and select the "nasuser" and "users" groups.

14 Create a Samba share

Go to Services -> SMB/CIFS -> Settings, check the box at the top for "Enabled," select "SMB1" as the minimum protocol version, and then click "Save"

Go to Services -> SMB/CIFS -> Shares, click the "+" button, and in the "Shared folder" field, select the folder you want to share. as an example, here i select the "samba" folder

Testing:
On a Mac system, right-click Finder, select "Connect to Server", and enter "smb://YourIPAddress" (replace with the actual IP address). An authentication dialog will appear; enter the username "nasuser" and the password to access the share.

15 Create an NFS share

Go to Services -> NFS -> Settings, check the box at the top for "Enabled", and in the "Versions" section, select all versions, including "NFSv2", then click "Save" and apply the settings.

Go to Services -> NFS -> Shares, click the "+" button, and in the "Shared folder" field, select the folder you want to share. here i select the "nfs" folder. In the "Client" section, enter the IP range or specific IPs that are allowed to access the share (e.g., 192.168.1.0/24). Set the permissions to "Read/Write", in the "Extra Options" field, Input:

rw,async,insecure,no_subtree_check,all_squash,anonuid=0,anongid=0

Then click "Save" and apply the settings.

15.1 Testing NFS mounting on a Mac

Viewing OpenMediaVault's NFS Share Information via Command Line:

# showmount -e YourIPAddress
Exports list on YourIPAddress:
/export                             192.168.1.0/24
/export/nfs                         192.168.1.0/24

Right-click Finder on your Mac, select "Connect to Server," and input the following in the address bar:

nfs://YourIPAddress/export/nfs

15.2 Testing NFS mounting on Linux

Installing the NFS client

sudo apt install nfs-common

Start to mount:

sudo mount -t nfs YourIPAddress:/export/nfs /mnt/nfs

Checking the Status

# df -h | grep nfs
YourIPAddress:/export/nfs  7.3G  3.5M  6.8G    1% /mnt/nfs

To configure automatic mounting at boot time, append the following line to the /etc/fstab file:

YourIPAddress:/export/nfs /mnt/nfs nfs defaults 0 0

16 Docker in OMV

16.1 Moving docker storage

Go to Storage -> Shared Folders, and click the "+" icon to create three folders, namely:

docker            -> The Docker data directory, defined in /etc/docker/daemon.json
docker-compose    -> Location of compose files
docker-data       -> Location of persistent container data
docker-app        -> For personal use, storing Dockerfiles and data

Go to Services -> Compose enter the "Settings" interface, and configure the "Shared folder" for "Compose Files" and "Data":
Access the SSH terminal and execute the following command to move Docker data to the shared folder, where "/srv/dev-disk-by-uuid-XXYYZZ/docker" represents the absolute path of the shared folder, which can be obtained from the "Storage" -> "Shared Folders" list on the web interface:

su root
systemctl stop docker.socket docker.service
mv /var/lib/docker/* /srv/dev-disk-by-uuid-XXYYZZ/docker/

On the web interface, set the "Docker storage" to the absolute path of the "docker" shared folder. save the settings and apply, and then reboot the system.

The final value filled on the Gui:

Compose Files's Shared folder  -> on /dev/md0, docker-compose
Data's Shared folder           -> on /dev/md0, docker-data
Docker's Docker storage        -> on /srv/dev-disk-by-uuid-XXYYZZ/docker/

16.2 Install Nextcloud with Docker

Run the following command in the terminal:

su root
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
mkdir nextcloud
cd nextcloud
mkdir data
 
docker run -d -p 8888:80  --name nextcloud \
    -v $PWD/data:/var/www/html --restart=always \
    --privileged=true  arm64v8/nextcloud

you can access the Nextcloud web interface by opening a web browser and navigating to http://YourIPAddress:8888/ (replace YourIPAddress with the actual IP address of your device).

16.3 Install Filebrowser with Docker

Run the following command in the terminal:

su root
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
mkdir filebrowser
cd filebrowser
 
docker run -d -v $(readlink -f /srv/dev-disk-by-uuid-*):/srv \
    -v $PWD/filebrowserconfig.json:/etc/config.json \
    -v $PWD/database.db:/etc/database.db -p 8080:80 \
    --restart=always --name filebrowser \
    filebrowser/filebrowser

After completing the setup, you can access the Filebrowser web interface by opening a web browser and navigating to http://YourIPAddress:8080/ (replace YourIPAddress with the actual IP address of your device). The default username and password for Filebrowser are both "admin".

16.4 Install Jellyfin with Docker

Go to Storage -> Shared Folders, click the "+" icon to create a "media" folder for storing multimedia resources. Then, in the command-line terminal, you can run the following command to install Jellyfin:

su root
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
mkdir jellyfin
cd jellyfin
mkdir config cache
 
docker run -d --name jellyfin \
-v $PWD/config:/config \
-v $PWD/cache:/cache \
-v $(readlink -f /srv/dev-disk-by-uuid-*/media):/media \
-p 8096:8096 \
--restart=always \
jellyfin/jellyfin

After completing the setup, you can access the Jellyfin web interface by opening a web browser and navigating to http://YourIPAddress:8096/ (replace YourIPAddress with the actual IP address of your device). This will allow you to access and manage your media content using Jellyfin.

16.5 Install Portainer with Docker

Run the following command in the terminal:

su root
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
mkdir portainer
cd portainer
mkdir data
 
docker run -d \
  --name portainer \
  --restart=always \
  -e TZ=Asia/Shanghai \
  -p 8000:8000 \
  -p 9000:9000 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v $PWD/data:/data \
  portainer/portainer-ce:latest

After completing the setup, you can access the Portainer web interface by opening a web browser and navigating to http://YourIPAddress:9000/ (replace YourIPAddress with the actual IP address of your device). The default administrator account username and password are both "admin".

17 System Backup and Restore

17.1 Backing up the System in eMMC

Use the tar command to back up the contents of the file system:

su root
cd /
tar --warning=no-file-changed -cvpzf /rootfs.tar.gz \
    --exclude=/rootfs.tar.gz --exclude=/var/lib/docker/runtimes \
    --exclude=/etc/firstuser --exclude=/etc/friendlyelec-release \
    --exclude=/usr/local/first_boot_flag --one-file-system /

17.2 Restoring the System to eMMC

Boot from the SD card, start the Linux system (such as Debian or Ubuntu), and use the following command to query the root partition of the system on eMMC:

root@CM3588:~# sudo parted -s /dev/mmcblk2 unit MiB print | grep rootfs
 8      140MiB   59000MiB  58860MiB  ext4         rootfs

According to the mathematical index 8 mentioned above, the device name for the root partition is /dev/mmcblk2p8. Below, it will be reformatted, mounted, and then the rootfs.tar.gz will be decompressed here:

sudo mkfs.ext4 /dev/mmcblk2p8
sudo mkdir /mnt/rootfs
sudo mount /dev/mmcblk2p8 /mnt/rootfs
sudo tar xvzfp /path/to/rootfs.tar.gz -C /mnt/rootfs --numeric-owner --same-owner
sudo poweroff

After shutting down, remove the SD card, and then power on again to boot the system from eMMC.

18 How to recover files after reinstalling OpenMediaVault

  • Go to Storage -> File System, click on the icon, and select your device in the File System section, then click Save.
  • Go to Storage -> Shared Folders, create shared folders with the same names, such as nfs, samba, docker, docker-app, docker-compose, and docker-data, as shown in this document.