ZFS Backup from zfs snapshot after system catastrophe

I dont know what happen, if it was evil spirits or sun rays but I shuted down my computer yesterday as always and went to sleep. After trying to turn it up today, the MEMOK red light was on and nothing booted up.
Then I just got a old motherboard that I kept just in case and switched to it with the same ram, and the pc started to boot (I guess maybe my DIMM slots dieded).

The problem is:
Once FreeBSD booted, after geli password insertion, it wont really boot and sends the messages:
freebsd failed to load kernel
'kernel'zfs i/o error - all block copies unavailable

I tried some links in this same forum and it was without sucess, I just cant boot my system.
Then I flashed a live cd, and I could mount other encrypted HD that I just use to keep snapshots.

I want to restore my last snapshot as a full system but I dont know exacty what do, and I am scared of formating the current SSD's and loosing things, so I decided to ask.

1. After unlocking the geli of the backup hd, and doing zpool import backup on live cd it spawns:
cannot mount '/backup': failed to create mountpoint: Read-only file system

Q: I must make the live cd writable to mount my backup partition?

2. Like in this thread: https://forums.freebsd.org/threads/reinstalling-restoring-freebsd-from-a-zfs-snapshot.67103/
should I format my current ssdś with the same zpool name and then zfs send/receive after fresh install?

3. Like in https://forums.freebsd.org/threads/restoring-server-from-zfs-snapshot.64204/

zfs send -R zroot@-2018-01-18 | mbuffer -q -v 0 -s 128k -m 1G | ssh root@91.203.xx.xxx "mbuffer -s 128k -m 1G | zfs receive -Feuv zroot"

I dont quite get the right command since i have a zroot@YYYY-MM-DD on /backup and I want to send it to /zroot it would be something like:

zfs send -R /backup/zrootYYYY-MM-DD | zfs receove -Feuv /zroot

?

4, What are the risks, there is maybe other alternatives that experienced people could tell me?

Thanks for the reading and for helping if possible!
 
Perhaps zpool import -R /tmp/zfs backup on the live cd?
Thats works. zpool import -R /tmp backup will create the backup dir on /tmp and the snapshots seems to be there.

Now, I just need to know if I must do a fresh install and receive the snapshots to be able to reuse my system

In truth, Eric, yourself had posted in one thread that I myself had quoted in first post:

  1. Boot off of the live CD; get networking up and running.
  2. Follow the gpool commands here https://lists.freebsd.org/pipermail/freebsd-fs/2015-November/022276.html modified for your device name (instead of the globs at the end) and particular (swap size) use case. BE SURE TO USE a larger boot code partition; 128k or so to be safe. (64k is too small now.)
  3. Create the new zpool. Using the same name as before is convenient but typically not required, unless you have bootfs set in /boot/loader.conf (which isn’t needed on the latest versions)
  4. Use gptzfsboot(8) to install bootcode: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 <your_device>
  5. zfs receive the backed-up pool
  6. Use zpool(1) to set the bootfs property appropriately. On newer installs, this is zroot/ROOT/default or similar.
  7. Reboot and enjoy.

zfs send -R /tmp/backup/zrootYYYY-MM-DD | zfs receive -Feuv /zroot

I am just unsure about the syntax that I should do in step 5.
 
I managed to receive my backup, but it seens it was not a total backup and only some folders was backuped.

At least the jail where I stored my git server was recovered so it will not be a big loss.

But why when I do a zfs send -R zroot@DD-MM-YYYY it dosent send everything?

What I did wrong?

on the handbook:

Create a second snapshot called replica2. This second snapshot contains changes made to the file system between now and the previous snapshot, replica1. Using zfs send -i and indicating the pair of snapshots generates an incremental replica stream containing the changed data. This succeeds if the initial snapshot already exists on the receiving side.

<span> zfs send -v -i mypool@replica1 mypool@replica2 | zfs receive /backup/mypool</span>


this means if I allways want to have a total backup i must send like this?
 
Back
Top