Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
huataihuang committed Oct 3, 2024
1 parent 7411c2c commit d616bfe
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions source/raspberry_pi/hardware/pi_5_pcie_3_m.2_ssd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
使用存储
===========

接下来是软件配置如何使用这个存储发挥其性能:

- :ref:`pi_5_nvme_boot`
- :ref:`boot_on_zfs_for_raspberry_pi`

Expand Down
3 changes: 2 additions & 1 deletion source/raspberry_pi/hardware/pi_5_pcie_m.2_ssd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
软件配置
===========

:ref:`pi_5_pcie_3_m.2_ssd`
- 首先配置激活 ``PCIe gen3支持`` :ref:`pi_5_pcie_3_m.2_ssd`
- 然后配置 :ref:`pi_5_nvme_boot`
39 changes: 39 additions & 0 deletions source/raspberry_pi/storage/pi_5_nvme_boot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,45 @@
树莓派5使用nvme存储启动
========================

在完成 :ref:`pi_5_pcie_m.2_ssd` 存储组装,并完成 :ref:`pi_5_pcie_3_m.2_ssd` 激活 ``PCIe gen3`` 支持之后,就可以配置 :ref:`pi_5` 从NVMe启动,这样所有数据存储在NVMe存储上,可以大大加速孙处性能。

配置NVMe启动
==============

``raspi-config`` 提供了菜单方式配置存储启动顺序: ``Advanced Options > Boot Order > NVMe /USB Boot``

.. figure:: ../../_static/raspberry_pi/storage/raspi-config_boot_order.png

默认启动顺序: ``SD => NVMe => USB`` ,该默认顺序基本满足要求

默认启动顺序其实也包含了NVMe启动,只不过NVMe启动顺序比SD卡低一级

clone树莓派SD卡
=================

- 直接通过以下命令将树莓派SD卡内容完整复制到NVMe中,这样NVMe存储就完全替代了原先的SD卡:

.. literalinclude:: pi_5_nvme_boot/clone_pi
:caption: 通过 ``dd`` 命令复制树莓派系统

复制前磁盘分区如下:

.. literalinclude:: pi_5_nvme_boot/clone_pi_before
:caption: 通过 ``dd`` 命令复制树莓派系统前状态
:emphasize-lines: 16,17

复制以后磁盘分区如下:

.. literalinclude:: pi_5_nvme_boot/clone_pi_before
:caption: 复制系统前只有 ``mmcblk0`` 设备有2个分区
:emphasize-lines: 16,17

复制以后通过 ``lsblk`` 可以看到:

.. literalinclude:: pi_5_nvme_boot/lsblk
:caption: ``lsblk`` 可以看到NVMe存储现在和SD卡存储分区(内容)完全一致
:emphasize-lines: 6,7

参考
========

Expand Down
1 change: 1 addition & 0 deletions source/raspberry_pi/storage/pi_5_nvme_boot/clone_pi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dd if=/dev/mmcblk0 of=/dev/nvme0n1 bs=4MB status=progress
17 changes: 17 additions & 0 deletions source/raspberry_pi/storage/pi_5_nvme_boot/clone_pi_before
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Disk /dev/nvme0n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: KIOXIA-EXCERIA G2 SSD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
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: 0x57a11afa

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 1056767 1048576 512M c W95 FAT32 (LBA)
/dev/mmcblk0p2 1056768 124735487 123678720 59G 83 Linux
7 changes: 7 additions & 0 deletions source/raspberry_pi/storage/pi_5_nvme_boot/lsblk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk0 179:0 0 59.5G 0 disk
├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware
└─mmcblk0p2 179:2 0 59G 0 part /
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 512M 0 part
└─nvme0n1p2 259:2 0 59G 0 part

0 comments on commit d616bfe

Please sign in to comment.