Cloning ZFS root
Jump to navigation
Jump to search
- List partitions
parted unit s p
- Clone start of disk
dd if=/dev/sdb bs=512 of=80gb.img count=22527 conv=nocreat,notrunc
- Create loop device for partitions
kpartx -a 80gb.img
- Create new pool
zpool create apool /dev/mapper/loop0p2
- Create snapshot on source pool
zfs snapshot -r rpool@cptovm
- Send to new pool
zfs send -R rpool@cptovm | pv | zfs receive -Fd apool
- Export new pool
zpool export apool
- Convert to VMWare image
qemu-img convert -O vmdk ~/VirtualBox\ VMs/zolnascp/80gb.img 80gb.vmdk
- Replace new image in .vmx
- Use Debian ZFS LiveCD in VM to boot from image
- Import apool as rpool
zpool import apool rpool -R /mnt
- mount grub partition
mount /dev/sda1 /mnt/boot/grub
- chroot /mnt
- replace /etc/zfs/zpool.cache
zpool set cachefile=/et/zfs/zpool.cache rpool
- set bootfs
zpool set bootfs=rpool/ROOT/ubuntu-1 rpool
- Update initramfs (should use new cache file) [1]
update-initramfs -c -k all update-grub grub-install /dev/sda
That's it...