3

I try to migrate my ext4 root to zfs root. The system is VirtualBox VM three hd,1st hd contain ubuntu TLS 16.04 with 3 partitions (boot,swap,root) second and third hd's are for zfs. So

sda1 boot
sda2 ext4 /
sda3 swap
sdb1 zfs
sdc1 zfs

I make those steps

step1 OK

sudo echo "deb http://us.archive.ubuntu.com/ubuntu xenial universe" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install zfsutils-linux zfs-initramfs
sudo modprobe zfs

step2 OK

mklabel gpt Y \
mkpart zfs zfs 0% -512MB \
mkpart efi fat32 -512MB 100% \
set 2 boot on

sudo zpool create -o ashift=12 \
-o autoexpand=on \
-O compression=lz4 \
rpool \
raidz /dev/sdb1 /dev/sdc1

Step3 OK

sudo zpool export rpool     
sudo zpool import -d /dev/disk/by-id rpool
sudo zpool status -v rpool

Step4 OK

sudo mkdir /tmp/oldroot
sudo mount --bind / /tmp/oldroot
sudo rsync -avPX /tmp/oldroot/ /rpool/ROOT/ubuntu

Then i reboot(otherwise the next step give error) and i did step5

for d in proc sys dev; do sudo mount -v --bind /$d /rpool/ROOT/ubuntu/$d; done
sudo chroot /rpool/ROOT/ubuntu
grub-install /dev/sdb1
update-grub

I disconnect sda,and.. won't boot,not in dos mode(bios) not in efi. I miss something? I have follow this guide

elbarna
  • 224
  • 5
  • 13
  • Not answering to the question but I'm puzzled by the guide creating a raidz2 with two disks (which means there is no data, only two parity disks??). With only two disks, the obvious choice would be a mirror, not a raidz. – jlliagre Apr 22 '16 at 23:59
  • Very strange guide,you're right raidz is the zfs raid5 "special" and need 3 disk not 2 – elbarna Apr 23 '16 at 16:31

1 Answers1

1

I followed this guide and it worked for me in a KVM with 3 disks in a raidz1 configuration:

https://github.com/zfsonlinux/zfs/wiki/Ubuntu-16.04-Root-on-ZFS

There were two caveats:

  1. I had to use non-virtio disks, or else grub (yes, grub), at boot time, would see only one disk instead of 3. Since I was using raidz1, that was not enough to boot.

  2. The other one is that if using disk/by-id devices, you may have to export this variable for grub until bug #1527727 is fixed: export ZPOOL_VDEV_NAME_PATH=YES

Andreas Hasenack
  • 3,065
  • 1
  • 17
  • 17