Skip to content

Instantly share code, notes, and snippets.

@PleahMaCaka
Created August 31, 2024 16:12
Show Gist options
  • Save PleahMaCaka/d1729ed82f2beb732a309d6255469106 to your computer and use it in GitHub Desktop.
Save PleahMaCaka/d1729ed82f2beb732a309d6255469106 to your computer and use it in GitHub Desktop.

Revisions

  1. PleahMaCaka renamed this gist Aug 31, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. PleahMaCaka created this gist Aug 31, 2024.
    94 changes: 94 additions & 0 deletions 123
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,94 @@
    라즈베리파이 5에서 NVMe SSD를 ZFS로 초기화하고 라즈베리파이 OS를 설치한 후 부팅하는 방법을 단계별로 설명해 드리겠습니다.

    ## NVMe SSD 초기화 및 ZFS 설정

    1. 먼저 ZFS를 설치합니다:

    ```bash
    sudo apt update
    sudo apt install zfsutils-linux
    ```

    2. NVMe 드라이브를 초기화하고 ZFS 풀을 생성합니다:

    ```bash
    sudo zpool create rpool /dev/nvme0n1
    ```

    3. ZFS 데이터셋을 생성합니다:

    ```bash
    sudo zfs create rpool/root
    sudo zfs create rpool/root/boot
    ```

    ## 라즈베리파이 OS 설치

    1. 현재 SD 카드의 내용을 NVMe SSD로 복제합니다:

    ```bash
    sudo rsync -avx --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /rpool/root
    ```

    2. `/etc/fstab` 파일을 수정하여 새 루트 파일시스템을 반영합니다:

    ```bash
    sudo sed -i 's|/dev/mmcblk0p2|rpool/root|' /rpool/root/etc/fstab
    ```

    ## 부트로더 설정

    1. EEPROM 설정을 편집합니다:

    ```bash
    sudo rpi-eeprom-config --edit
    ```

    2. `BOOT_ORDER` 값을 다음과 같이 변경합니다:

    ```
    BOOT_ORDER=0xf416
    ```

    3. 변경사항을 저장하고 편집기를 종료합니다.

    ## ZFS 부트 설정

    1. ZFS 부트 스크립트를 initramfs에 추가합니다:

    ```bash
    echo 'zfs' | sudo tee -a /etc/initramfs-tools/modules
    sudo update-initramfs -u
    ```

    2. GRUB 설정을 업데이트합니다:

    ```bash
    sudo update-grub
    ```

    ## 재부팅 및 확인

    1. 시스템을 재부팅합니다:

    ```bash
    sudo reboot
    ```

    2. 재부팅 후 ZFS 풀이 정상적으로 마운트되었는지 확인합니다:

    ```bash
    zfs list
    df -h
    ```

    이 과정을 통해 라즈베리파이 5에서 NVMe SSD를 ZFS로 초기화하고 라즈베리파이 OS를 설치한 후 부팅할 수 있습니다. 주의할 점은 이 과정이 복잡하고 위험할 수 있으므로 중요한 데이터는 반드시 백업해두시기 바랍니다[5][6].

    Citations:
    [1] https://chochol.io/en/hardware/raspberry-pi-5-installation-and-configuration-of-nvme-drive/
    [2] https://docs.pineberrypi.com/tutorial-booting-from-nvme
    [3] https://wiki.geekworm.com/NVMe_SSD_boot_with_the_Raspberry_Pi_5
    [4] https://itsfoss.com/raspberry-pi-ssd-boot/
    [5] https://github.com/jrcichra/rpi-zfs-root
    [6] https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2020.04%20Root%20on%20ZFS%20for%20Raspberry%20Pi.html
    [7] https://www.jeffgeerling.com/blog/2023/nvme-ssd-boot-raspberry-pi-5