meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:fs:zfs:move_to_zfs [2021/02/14 13:29] – niziak | linux:fs:zfs:move_to_zfs [2021/05/14 16:06] (current) – niziak | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| Based on [[https:// | Based on [[https:// | ||
| + | |||
| + | Additional references: | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| ===== Prepare system ===== | ===== Prepare system ===== | ||
| <code bash> | <code bash> | ||
| Line 22: | Line 28: | ||
| <code bash> | <code bash> | ||
| zpool create \ | zpool create \ | ||
| - | -o ashift=12 -d \ | + | -o ashift=13 -d \ |
| -o feature@async_destroy=enabled \ | -o feature@async_destroy=enabled \ | ||
| -o feature@bookmarks=enabled \ | -o feature@bookmarks=enabled \ | ||
| -o feature@embedded_data=enabled \ | -o feature@embedded_data=enabled \ | ||
| - | -o feature@empty_bpobj=enabled \ | + | -o feature@empty_bpobj=enabled \rapidly and thoroughly than you'd think. |
| -o feature@enabled_txg=enabled \ | -o feature@enabled_txg=enabled \ | ||
| -o feature@extensible_dataset=enabled \ | -o feature@extensible_dataset=enabled \ | ||
| Line 41: | Line 47: | ||
| </ | </ | ||
| - | ==== create | + | ==== Create |
| <code bash> | <code bash> | ||
| zpool create \ | zpool create \ | ||
| - | -o ashift=12 \ | + | -o ashift=13 \ |
| -O acltype=posixacl -O canmount=off -O compression=lz4 \ | -O acltype=posixacl -O canmount=off -O compression=lz4 \ | ||
| -O dnodesize=auto -O normalization=formD -O relatime=on \ | -O dnodesize=auto -O normalization=formD -O relatime=on \ | ||
| Line 52: | Line 58: | ||
| </ | </ | ||
| - | === prepare filesystem === | + | ===== prepare filesystem |
| <code bash> | <code bash> | ||
| Line 97: | Line 103: | ||
| </ | </ | ||
| - | === Move filesystem === | + | ==== Move filesystem |
| <code bash> | <code bash> | ||
| Line 109: | Line 115: | ||
| </ | </ | ||
| - | === update filesystem === | + | ==== update filesystem |
| <code bash> | <code bash> | ||
| Line 133: | Line 139: | ||
| </ | </ | ||
| - | === Enable importing bpool === | + | ==== Enable importing bpool ==== |
| <file / | <file / | ||
| Line 156: | Line 162: | ||
| systemctl enable zfs-import-bpool.service | systemctl enable zfs-import-bpool.service | ||
| </ | </ | ||
| + | |||
| + | ==== fstab ==== | ||
| + | |||
| + | Remove all old fstab entries related to prebvious setup! | ||
| + | |||
| + | ==== Workaround GRUB’s missing zpool-features support ==== | ||
| + | |||
| + | <file / | ||
| + | GRUB_CMDLINE_LINUX=" | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | ==== Update GRUB ==== | ||
| === EFI boot === | === EFI boot === | ||
| Line 176: | Line 196: | ||
| # should return zfs | # should return zfs | ||
| - | update-initramfs -c -k all | ||
| update-grub | update-grub | ||
| Line 192: | Line 211: | ||
| zed -F & | zed -F & | ||
| </ | </ | ||
| + | |||
| + | Verify that zed updated the cache by making sure these are not empty: | ||
| <code bash> | <code bash> | ||
| - | zfs set canmount=on | + | cat /etc/zfs/zfs-list.cache/bpool |
| - | zfs set canmount=noauto rpool/ROOT/debian | + | cat /etc/zfs/zfs-list.cache/ |
| + | </code> | ||
| + | Fix the paths to eliminate mount prefix /rpool: | ||
| + | <code bash> | ||
| + | sed -Ei " | ||
| </ | </ | ||
| + | Exit chroot: < | ||
| + | |||
| + | Unmount zfs | ||
| + | < | ||
| + | mount | grep -v zfs | tac | awk '/ | ||
| + | xargs -i{} umount -lf {} | ||
| + | </ | ||
| + | |||
| + | **DON' | ||
| + | |||
| + | < | ||
| + | zpool export -a | ||
| + | |||
| + | reboot | ||
| + | </ | ||
| + | |||
| + | Reboot. Choose recovery boot to verify. | ||
| + | |||
| + | ===== Add 2nd disk for mirror ===== | ||
| + | |||
| + | <code bash> | ||
| + | DISK=/ | ||
| + | sgdisk --zap-all $DISK | ||
| + | sgdisk -a8 -n1: | ||
| + | sgdisk | ||
| + | sgdisk | ||
| + | sgdisk | ||
| + | </ | ||
| + | |||
| + | Attach boot partitiona to '' | ||
| + | <code bash> | ||
| + | zpool list -v | ||
| + | zpool attach bpool ata-WDC_WD1003FZEX-00MK2A0_WD-WCC3F5HSP1N1-part3 $DISK-part3 | ||
| + | zpool list -v | ||
| + | </ | ||
| + | |||
| + | Attach pool partition to '' | ||
| + | <code bash> | ||
| + | zpool list -v | ||
| + | zpool attach rpool ata-WDC_WD1003FZEX-00MK2A0_WD-WCC3F5HSP1N1-part4 $DISK-part4 | ||
| + | zpool list -v | ||
| + | </ | ||
| + | |||
| + | Check mirror build progresS: | ||
| + | < | ||
| + | zpool status | ||
| + | |||
| + | pool: bpool | ||
| + | | ||
| + | scan: resilvered 263M in 0 days 00:00:06 with 0 errors on Sun Feb 14 18:26:12 2021 | ||
| + | |||
| + | pool: rpool | ||
| + | | ||
| + | status: One or more devices is currently being resilvered. | ||
| + | continue to function, possibly in a degraded state. | ||
| + | action: Wait for the resilver to complete. | ||
| + | scan: resilver in progress since Sun Feb 14 18:27:09 2021 | ||
| + | 68,9G scanned at 860M/s, 504K issued at 6,15K/s, 326G total | ||
| + | 0B resilvered, 0,00% done, no estimated completion time | ||
| + | </ | ||
| + | |||
| + | ==== Install grub on 2nd disk ==== | ||
| + | |||
| + | |||
| + | === legacy | ||
| + | |||
| + | <code bash> | ||
| + | Hit enter until you get to the device selection screen. Select (using the space bar) all of the disks (not partitions) in your pool. | ||
| + | |||
| + | or | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | === For UEFI booting === | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | <code bash> | ||
| + | dd if=/ | ||
| + | | ||
| + | |||
| + | efibootmgr -c -g -d / | ||
| + | -p 2 -L " | ||
| + | |||
| + | mount /boot/efi | ||
| + | </ | ||
| + | |||
| + | ==== add ZIL and L2ARC ==== | ||
| + | |||
| + | <code bash> | ||
| + | zpool add rpool log c2980761-ed99-4af3-8519-f03ed43fbefe | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | zpool add rpool cache 3b42df2e-2923-464c-92d6-8d629252727d | ||
| + | </ | ||
| + | |||
| + | ===== issue: No pool imported ===== | ||
| + | |||
| + | < | ||
| + | No pool imported. Manually import the root pool | ||
| + | at the command prompt and then exit. | ||
| + | Hint: Try: zpool import -R /root -N | ||
| + | </ | ||
| + | |||
| + | |||
| + | Initramfs stuck because no /root found: | ||
| + | <code bash> | ||
| + | zpool import -R /root -N rpool | ||
| + | zfs mount rpool/ | ||
| + | exit | ||
| + | </ | ||
| + | |||
| + | Solution: | ||
| + | |||
| + | <file / | ||
| + | GRUB_CMDLINE_LINUX=" | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | update-initramfs -c -k all | ||
| + | </ | ||
| + | |||
| + | ===== issue ? ===== | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Now in recovery mode fix ''/ | ||
| + | |||
| + | <code bash> | ||
| + | update-initramfs -c -k all | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== TEMP ===== | ||
| DONT FORGET TO ADD NEXT MIRROR DEVICE DRIVE TO ZFS POOLS: | DONT FORGET TO ADD NEXT MIRROR DEVICE DRIVE TO ZFS POOLS: | ||