# Upgreade major version with full backup and restore?



## blind0ne (Oct 5, 2021)

Hello, I'm currently using freeBSD 12.2 or something like that. There are few services running on. The question is such - how can I backup the whole system and upgrade it to 13.x latest releese and how to rollback to stable state in the case if I'll face failure. The only Idea that I have on my mind is to make the image of my hard drive from another machine and than to start upgrading,but I belive that there is more efficient way to do such backups/rollbacks on the fly without physica linteraction with my hdd. I've done some kind of such things on Google cloud platform, there I can do hot image of my current running system, and backup from this one. How can I achive something like that on my vare metal machine running freebsd.


----------



## zirias@ (Oct 5, 2021)

If you installed on ZFS, you have a much better mechanism (with full rollback) already builtin: boot environments.


----------



## blind0ne (Oct 5, 2021)

Zirias said:


> If you installed on ZFS, you have a much better mechanism (with full rollback) already builtin: boot environments.


Unfortunately I've installed ufs...)


----------



## zirias@ (Oct 5, 2021)

There was some work done to provide boot environments with UFS, too, and I think it works, although it's less efficient than with ZFS. BUT it needs a specific partitioning scheme, so it would only be an option for you if you have unpartitioned space left. Short of that, I don't see much other possibilities than a full image/backup, but maybe somebody else would have an idea.


----------



## mer (Oct 5, 2021)

I agree with everyone that "if ZFS...", but without knowing your current hardware setup, it's hard to give good specific advice.
But:
If a desktop and empty drive slots and the means to do so, I would pick up a new drive and install on that.  
I've done that a few times and it works pretty well.  
Install new drive (time to upgrade to an SSD), unplug existing boot drive, install to new drive using ZFS, do enough config to get up and running and verify it's all working, make sure you reboot off the new install a couple times, then power down, plug in old drive, boot off new drive, temp mount old drive and selectively pull off what you need.
It's a bit more work, but you wind up with a clean system, gives you the chance to clean up a bit.


----------



## blind0ne (Oct 5, 2021)

mer said:


> I agree with everyone that "if ZFS...", but without knowing your current hardware setup, it's hard to give good specific advice.
> But:
> If a desktop and empty drive slots and the means to do so, I would pick up a new drive and install on that.
> I've done that a few times and it works pretty well.
> ...


Is there are some scripts to change from UFS to ZFS? I don't have any other drives except my destop pc drive with backup data on it


----------



## SirDice (Oct 5, 2021)

blind0ne said:


> Is there are some scripts to change from UFS to ZFS?


It's not possible to "convert" from UFS to ZFS.

In any case, backup your data not the OS or the software you installed. Those are all easily installed again (you do want to backup some of their configuration files), it's your data that's important and that cannot be reinstalled.


----------



## blind0ne (Oct 8, 2021)

So what is the way to backup running system and make snapshot from it if I'm using UFS? Isit possible?


----------



## Argentum (Oct 8, 2021)

blind0ne said:


> So what is the way to backup running system and make snapshot from it if I'm using UFS? Isit possible?


Did I understand correctly that this is your desktop system with just one drive? If so, I recommend to find one more drive and back up the whole thing. Then make a fresh install (on ZFS) and import your data from backup.
To back up the drive, one option is to boot from USB stick and copy the whole drive with `dd`. (dd(1))


----------

