I'd like to be able to recover from a scenario where / filesystem is corrupted. Like if I inadvertently delete some or all configuration files in /etc or the procedures in /boot for instance and may not be able to boot anymore.
What I've done so far in a VM to learn how to do that kind of recovery using ZFS and the snapshot feature
1. make a snapshot of
2. send the snapshot and the associated dataset to another pool
In a live environment, where
3. import
4. import
5. send back the snapshot and the associated dataset from
6. rename dataset coming from
6.a rename original dataset to whatever name in order to delete it later.
6.b remove mountpoint from original dataset
6.c set mountpoint to / to the new
After that, I rebooted the system but I'mt only able to boot in single-user mode. In multi-user mode, I get a message telling it can't start
And then I'm left in a state where I got a solid cursor but can't do anything.
In single user mode however, I'm able to boot, to login and to make change to
What am I missing?
What I've done so far in a VM to learn how to do that kind of recovery using ZFS and the snapshot feature
1. make a snapshot of
zroot/ROOT/default
which is mounted on /
Code:
zfs snapshot zroot/ROOT/default@snapshot1
backup
located on another drive's partition setup with ZFS.
Code:
zfs send zroot/ROOT/default@snapshot1 | zfs receive backup/zroot-default
In a live environment, where
zroot
would not be mounted on /
3. import
zroot
and mount it on /mnt
Code:
zpool import -R /mnt zroot
backup
Code:
zpool import backup
backup
to zroot
Code:
zfs send backup/zroot-default@snapshot1 | zfs receive zroot/backuped-zroot
backup
to zroot/ROOT/default
to become the official one6.a rename original dataset to whatever name in order to delete it later.
6.b remove mountpoint from original dataset
6.c set mountpoint to / to the new
zroot/ROOT/default
dataset
Code:
zfs rename zroot/ROOT/default zroot/old-default
zfs rename zroot/backuped-zroot zroot/ROOT/default
zfs set -u mountpoint=none zroot/old-default
zfs set -u mountpoint=/ zroot/ROOT/default #which was to none
After that, I rebooted the system but I'mt only able to boot in single-user mode. In multi-user mode, I get a message telling it can't start
devd
or find the swap (I think).
Code:
devd: Can't open devctl device /dev/devctl: No such file or directory
/etc/rc: WARNING: failed to start devd
Waiting 30s for the default route....
[...]
Updating /var/run/os-release done.
[...]
dmounting late filestystems:.
swapon: /dev/gpt/swapfs: No such file or directy
....
Wed Jan 8 ...
And then I'm left in a state where I got a solid cursor but can't do anything.
In single user mode however, I'm able to boot, to login and to make change to
zroot
What am I missing?