<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.completenoobs.com/noobs/index.php?action=history&amp;feed=atom&amp;title=FreeBSD_13.2_OpenZFS</id>
	<title>FreeBSD 13.2 OpenZFS - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.completenoobs.com/noobs/index.php?action=history&amp;feed=atom&amp;title=FreeBSD_13.2_OpenZFS"/>
	<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=FreeBSD_13.2_OpenZFS&amp;action=history"/>
	<updated>2026-05-01T03:24:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=FreeBSD_13.2_OpenZFS&amp;diff=399&amp;oldid=prev</id>
		<title>AwesomO: Created page with &quot;==Safely Creating a ZFS Dataset in an Existing Directory==  Assuming you have a username &#039;&#039;&#039;foo&#039;&#039;&#039; on your FreeBSD system, and your home directory is located at &#039;&#039;&#039;/usr/home/foo&#039;&#039;&#039;. Your ZFS pool, visible by running zfs list, is &#039;&#039;&#039;nuc/usr/home&#039;&#039;&#039;. Let&#039;s create a dataset named &#039;&#039;&#039;backup&#039;&#039;&#039; inside &#039;&#039;&#039;/usr/home/foo&#039;&#039;&#039; without overwriting any data.  :*    Identify the pool you want to create the dataset in. You can list your existing ZFS pools by running:  &lt;code&gt;zfs list&lt;/c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=FreeBSD_13.2_OpenZFS&amp;diff=399&amp;oldid=prev"/>
		<updated>2023-05-05T14:53:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Safely Creating a ZFS Dataset in an Existing Directory==  Assuming you have a username &amp;#039;&amp;#039;&amp;#039;foo&amp;#039;&amp;#039;&amp;#039; on your FreeBSD system, and your home directory is located at &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039;. Your ZFS pool, visible by running zfs list, is &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039;. Let&amp;#039;s create a dataset named &amp;#039;&amp;#039;&amp;#039;backup&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; without overwriting any data.  :*    Identify the pool you want to create the dataset in. You can list your existing ZFS pools by running:  &amp;lt;code&amp;gt;zfs list&amp;lt;/c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Safely Creating a ZFS Dataset in an Existing Directory==&lt;br /&gt;
&lt;br /&gt;
Assuming you have a username &amp;#039;&amp;#039;&amp;#039;foo&amp;#039;&amp;#039;&amp;#039; on your FreeBSD system, and your home directory is located at &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039;. Your ZFS pool, visible by running zfs list, is &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039;. Let&amp;#039;s create a dataset named &amp;#039;&amp;#039;&amp;#039;backup&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; without overwriting any data.&lt;br /&gt;
&lt;br /&gt;
:*    Identify the pool you want to create the dataset in. You can list your existing ZFS pools by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Before creating the dataset, ensure that the target directory for the new dataset does not exist. In this case, &amp;#039;&amp;#039;&amp;#039;/usr/home/foo/backup&amp;#039;&amp;#039;&amp;#039; should not exist yet.&lt;br /&gt;
&lt;br /&gt;
:*    Create the dataset in the desired ZFS pool. Replace nuc (which is the pool name) with the name of the ZFS pool you want to create the dataset in, and backup with the name you want to give the dataset:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs create nuc/usr/home/foo_backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Set the mountpoint for the dataset to the desired directory. Replace /usr/home/foo/backup with the path to the directory you want to use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs set mountpoint=/usr/home/foo/backup nuc/usr/home/foo_backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Verify that the dataset is mounted at the correct location by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see your dataset in the list with the correct mountpoint.&lt;br /&gt;
&lt;br /&gt;
Now you have successfully created a ZFS dataset without wiping out an existing directory. The dataset is mounted at the specified directory, and you can use it as you normally would.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
How to do it the &amp;#039;&amp;#039;&amp;#039;Wrong Way&amp;#039;&amp;#039;&amp;#039; and how to &amp;#039;&amp;#039;&amp;#039;Recover&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Doing it the Wrong way is not fun.... not fun at all&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assuming you have a username foo on your FreeBSD system, and your home directory is located at &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039;. Your ZFS pool, visible by running zfs list, is &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039;. Now let&amp;#039;s assume you mistakenly try to create a dataset named backup inside &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; without properly setting the mountpoint.&lt;br /&gt;
&lt;br /&gt;
:*    Create the dataset in the desired ZFS pool. Replace &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; (which is the pool name) with the name of the ZFS pool you want to create the dataset in, and backup with the name you want to give the dataset:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs create nuc/usr/home/foo/backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case, ZFS creates a dataset named backup inside the &amp;#039;&amp;#039;&amp;#039;nuc/usr/home/foo&amp;#039;&amp;#039;&amp;#039; dataset. By doing this, the existing &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; directory will be replaced by the newly created &amp;#039;&amp;#039;&amp;#039;nuc/usr/home/foo/backup&amp;#039;&amp;#039;&amp;#039; dataset, causing the original contents of &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; to be hidden.&lt;br /&gt;
&lt;br /&gt;
Please note that the contents of &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; are not technically wiped out, but they become inaccessible because the new dataset is now mounted on top of the &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; directory. The original files still exist on the disk, but they are hidden by the new mountpoint.&lt;br /&gt;
&lt;br /&gt;
To recover from this situation, you would need to unmount the newly created dataset, move its contents to another location (if needed), and then remove the dataset:&lt;br /&gt;
&lt;br /&gt;
:*    Unmount the new dataset:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs unmount nuc/usr/home/foo/backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    If you added any content to the new dataset, move it to another location:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mv /usr/home/foo/backup/* /temporary/location/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Remove the new dataset:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs destroy nuc/usr/home/foo/backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After these steps, the original contents of &amp;#039;&amp;#039;&amp;#039;/usr/home/foo&amp;#039;&amp;#039;&amp;#039; should become accessible again.&lt;br /&gt;
&lt;br /&gt;
To avoid such situations, always set the mountpoint for the new dataset explicitly, as shown in &amp;#039;&amp;#039;&amp;#039;Safely Creating a ZFS Dataset in an Existing Directory&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating a snapshot and rolling back==&lt;br /&gt;
&lt;br /&gt;
===Single DataSet===&lt;br /&gt;
&lt;br /&gt;
Creating a snapshot and rolling back to a previous snapshot are useful features of ZFS for data protection and recovery. Here&amp;#039;s how to make a full snapshot and rollback/restore if something goes wrong:&lt;br /&gt;
&lt;br /&gt;
==== Create a snapshot====&lt;br /&gt;
&lt;br /&gt;
To create a snapshot, you need to specify the dataset or ZFS pool you want to snapshot and give the snapshot a name. Use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs snapshot pool_name/dataset_name@snapshot_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;#039;&amp;#039;&amp;#039;pool_name&amp;#039;&amp;#039;&amp;#039; with the name of your ZFS pool, &amp;#039;&amp;#039;&amp;#039;dataset_name&amp;#039;&amp;#039;&amp;#039; with the name of the dataset you want to snapshot, and &amp;#039;&amp;#039;&amp;#039;snapshot_name&amp;#039;&amp;#039;&amp;#039; with a descriptive name for the snapshot.&lt;br /&gt;
&lt;br /&gt;
For example, if you have a dataset named &amp;#039;&amp;#039;&amp;#039;nuc/usr/home/foo_backup&amp;#039;&amp;#039;&amp;#039;, you can create a snapshot called &amp;#039;&amp;#039;&amp;#039;before_changes&amp;#039;&amp;#039;&amp;#039; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs snapshot nuc/usr/home/foo_backup@before_changes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    List snapshots:&lt;br /&gt;
&lt;br /&gt;
To verify that the snapshot was created successfully, use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -t snapshot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will show you all the snapshots available on your system.&lt;br /&gt;
&lt;br /&gt;
====Rollback/restore a snapshot====&lt;br /&gt;
&lt;br /&gt;
* View snapshot:&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -t snapshot &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If something goes wrong and you need to restore your dataset to a previous state, you can rollback to the snapshot you created earlier. Use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs rollback pool_name/dataset_name@snapshot_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;#039;&amp;#039;&amp;#039;pool_name&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;dataset_name&amp;#039;&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;&amp;#039;snapshot_name&amp;#039;&amp;#039;&amp;#039; with the appropriate values for your snapshot.&lt;br /&gt;
&lt;br /&gt;
For example, to rollback to the &amp;#039;&amp;#039;&amp;#039;before_changes&amp;#039;&amp;#039;&amp;#039; snapshot of the &amp;#039;&amp;#039;&amp;#039;nuc/usr/home/foo_backup&amp;#039;&amp;#039;&amp;#039; dataset, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs rollback nuc/usr/home/foo_backup@before_changes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that rolling back to a snapshot will destroy any changes made to the dataset after the snapshot was taken. Make sure you have backups of any important data before performing a rollback.&lt;br /&gt;
&lt;br /&gt;
That&amp;#039;s it! Now you know how to create a snapshot, list snapshots, and rollback to a previous snapshot in case something goes wrong. These features are part of what makes ZFS a powerful and flexible filesystem.&lt;br /&gt;
&lt;br /&gt;
===Recursively Create a Snapshot and Rollback===&lt;br /&gt;
&lt;br /&gt;
In this example, we will create a snapshot of the nuc/usr/home dataset and all its child datasets, and then roll back to this snapshot.&lt;br /&gt;
&lt;br /&gt;
====Recursively Create a Snapshot====&lt;br /&gt;
&lt;br /&gt;
:    Create a recursive snapshot of the &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039; dataset. Replace &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039; with the name of your dataset, and &amp;#039;&amp;#039;&amp;#039;recursive_snapshot&amp;#039;&amp;#039;&amp;#039; with a descriptive name for the snapshot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs snapshot -r nuc/usr/home@recursive_snapshot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;-r&amp;#039;&amp;#039;&amp;#039; flag tells ZFS to create snapshots for all child datasets of &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
:*    Verify that the snapshots have been created successfully for the dataset and its child datasets:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -t snapshot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the &amp;#039;&amp;#039;&amp;#039;recursive_snapshot&amp;#039;&amp;#039;&amp;#039; snapshot for the &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039; dataset and all its child datasets in the list.&lt;br /&gt;
&lt;br /&gt;
====Rollback to the Recursive Snapshot====&lt;br /&gt;
&lt;br /&gt;
Before rolling back, be aware that any changes made to the datasets after the snapshot was taken will be lost. Make sure you have backups of any important data before performing a rollback.&lt;br /&gt;
&lt;br /&gt;
:*    Roll back to the &amp;#039;&amp;#039;&amp;#039;recursive_snapshot&amp;#039;&amp;#039;&amp;#039; for the &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039; dataset and all its child datasets:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo zfs rollback -r nuc/usr/home@recursive_snapshot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will roll back the &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039; dataset and all its child datasets to the state they were in when the &amp;#039;&amp;#039;&amp;#039;recursive_snapshot&amp;#039;&amp;#039;&amp;#039; snapshot was taken.&lt;br /&gt;
&lt;br /&gt;
:*    Verify that the datasets have been rolled back to the snapshot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -t snapshot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the &amp;#039;&amp;#039;&amp;#039;recursive_snapshot&amp;#039;&amp;#039;&amp;#039; snapshot for the &amp;#039;&amp;#039;&amp;#039;nuc/usr/home&amp;#039;&amp;#039;&amp;#039; dataset and all its child datasets in the list, indicating that the rollback was successful.&lt;br /&gt;
&lt;br /&gt;
Now you know how to create a recursive snapshot of a specific dataset, and roll back to that snapshot if necessary. Remember that rolling back to a snapshot will destroy any changes made to the datasets after the snapshot was taken, so always have backups of important data before performing a rollback.&lt;br /&gt;
&lt;br /&gt;
===Kind Of Full Recursive Backup and Restore===&lt;br /&gt;
&lt;br /&gt;
====Backup - Snapshot====&lt;br /&gt;
you can create snapshots for all datasets in your ZFS pool using a single command. In this case, the pool name is &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039;. You can use the &amp;#039;&amp;#039;&amp;#039;zfs list&amp;#039;&amp;#039;&amp;#039; command to get a list of all datasets in your pool and then create a snapshot for each of them using a loop. Here&amp;#039;s a step-by-step guide:&lt;br /&gt;
&lt;br /&gt;
===== List all datasets in your ZFS pool=====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -o name -r nuc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command lists the names of all datasets in the &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; pool, including child datasets.&lt;br /&gt;
&lt;br /&gt;
=====Create a snapshot for each dataset in the pool=====&lt;br /&gt;
* If using &amp;#039;&amp;#039;&amp;#039;sh&amp;#039;&amp;#039;&amp;#039; shell&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -o name -r nuc | while read dataset; do sudo zfs snapshot &amp;quot;${dataset}@beforechange&amp;quot;; done&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If using &amp;#039;&amp;#039;&amp;#039;csh&amp;#039;&amp;#039;&amp;#039; shell &lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -o name -r nuc | awk &amp;#039;{ system(&amp;quot;sudo zfs snapshot &amp;quot;$1&amp;quot;@beforechange&amp;quot;) }&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using &amp;#039;&amp;#039;&amp;#039;csh&amp;#039;&amp;#039;&amp;#039; shell : If logged in as root and sudo not yet installed use:&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -o name -r nuc | awk &amp;#039;{ system(&amp;quot;zfs snapshot &amp;quot;$1&amp;quot;@beforechange&amp;quot;) }&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command uses a loop to create a snapshot named &amp;#039;&amp;#039;&amp;#039;beforechange&amp;#039;&amp;#039;&amp;#039; for each dataset in the &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; pool.&lt;br /&gt;
&lt;br /&gt;
=====Verify that the snapshots have been created successfully=====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -t snapshot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the &amp;#039;&amp;#039;&amp;#039;beforechange&amp;#039;&amp;#039;&amp;#039; snapshot for each dataset in the &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; pool in the list.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this process will create snapshots for all datasets in the nuc pool. When rolling back, you will need to roll back each dataset individually.&lt;br /&gt;
&lt;br /&gt;
====Restore -Rollback====&lt;br /&gt;
You can roll back all the datasets to their respective snapshots in one line using a loop, similar to the snapshot creation process. Here&amp;#039;s how to roll back all datasets in the &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; pool to the &amp;#039;&amp;#039;&amp;#039;beforechange&amp;#039;&amp;#039;&amp;#039; snapshots:&lt;br /&gt;
&lt;br /&gt;
=====Roll back all datasets to the &amp;#039;&amp;#039;&amp;#039;beforechange&amp;#039;&amp;#039;&amp;#039; snapshots=====&lt;br /&gt;
&lt;br /&gt;
* If using &amp;#039;&amp;#039;&amp;#039;sh&amp;#039;&amp;#039;&amp;#039; shell&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -H -o name -t snapshot -r nuc | grep &amp;#039;@beforechange$&amp;#039; | while read snapshot; do sudo zfs rollback &amp;quot;$snapshot&amp;quot;; done&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If using &amp;#039;&amp;#039;&amp;#039;csh&amp;#039;&amp;#039;&amp;#039; shell&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -H -o name -t snapshot -r nuc | grep &amp;#039;@beforechange$&amp;#039; | awk &amp;#039;{ system(&amp;quot;sudo zfs rollback &amp;quot;$1) }&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using &amp;#039;&amp;#039;&amp;#039;csh&amp;#039;&amp;#039;&amp;#039; shell and logged in as root with sudo not installed - remove sudo from command:&lt;br /&gt;
&amp;lt;code&amp;gt;zfs list -H -o name -t snapshot -r nuc | grep &amp;#039;@beforechange$&amp;#039; | awk &amp;#039;{ system(&amp;quot;zfs rollback &amp;quot;$1) }&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This command lists all the &amp;#039;&amp;#039;&amp;#039;beforechange&amp;#039;&amp;#039;&amp;#039; snapshots in the &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; pool, and then uses a loop to roll back each dataset to its &amp;#039;&amp;#039;&amp;#039;beforechange&amp;#039;&amp;#039;&amp;#039; snapshot.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that rolling back to a snapshot will destroy any changes made to the datasets after the snapshot was taken. Make sure you have backups of any important data before performing a rollback.&lt;br /&gt;
&lt;br /&gt;
==Full system snapshot and rollback==&lt;br /&gt;
First, make sure your entire system is on ZFS, including the root filesystem.&lt;br /&gt;
&lt;br /&gt;
:* You are going to need to have a Live FreeBSD CD/DVD/USB or another bootable medium that has ZFS support. you can boot up.&lt;br /&gt;
:** This is necessary because you can&amp;#039;t rollback the root filesystem while it&amp;#039;s in use.&lt;br /&gt;
&lt;br /&gt;
===Backup - Snapshot full system===&lt;br /&gt;
==== Step 1====&lt;br /&gt;
:* Shutdown the computer and boot of the live FreeBSD USB&lt;br /&gt;
&lt;br /&gt;
====Step 2====&lt;br /&gt;
:* Once in Shell Import/Mount the Root Pool with:&lt;br /&gt;
&amp;lt;code&amp;gt;zpool import -R /mnt pool_name&amp;lt;/code&amp;gt;&lt;br /&gt;
:* Replace &amp;#039;&amp;#039;&amp;#039;pool_name&amp;#039;&amp;#039;&amp;#039; with the name of your pool&lt;br /&gt;
:** In my case the &amp;#039;&amp;#039;&amp;#039;pool_name&amp;#039;&amp;#039;&amp;#039; is called &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
====Step 3====&lt;br /&gt;
:* Take a snapshot of all the datasets in your ZFS pool. For example, if your ZFS pool is called &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039;, you can create a snapshot called &amp;#039;&amp;#039;&amp;#039;full_system_backup&amp;#039;&amp;#039;&amp;#039; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zfs snapshot -r nuc@full_system_backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;-r&amp;#039;&amp;#039;&amp;#039; flag creates snapshots recursively for all child datasets.&lt;br /&gt;
&lt;br /&gt;
====Step 4====&lt;br /&gt;
: After taking the snapshot, export the ZFS pool:&lt;br /&gt;
&amp;lt;code&amp;gt;zpool export pool_name&amp;lt;/code&amp;gt;&lt;br /&gt;
:* Replace &amp;#039;&amp;#039;&amp;#039;pool_name&amp;#039;&amp;#039;&amp;#039; with the name of your ZFS pool&lt;br /&gt;
&lt;br /&gt;
====Step 5====&lt;br /&gt;
: Reboot back into your system:&lt;br /&gt;
&amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And thats your &amp;#039;&amp;#039;&amp;#039;snapshot&amp;#039;&amp;#039;&amp;#039; done, you can now reboot and go back to work, knowing you have a backup to roll back to.&lt;br /&gt;
&lt;br /&gt;
===Restore - Rollback full system===&lt;br /&gt;
====Step 1====&lt;br /&gt;
:* Shutdown the computer and boot of the live FreeBSD USB&lt;br /&gt;
&lt;br /&gt;
====Step 2====&lt;br /&gt;
:* Once in Shell Import/Mount the Root Pool with:&lt;br /&gt;
&amp;lt;code&amp;gt;zpool import -R /mnt pool_name&amp;lt;/code&amp;gt;&lt;br /&gt;
:* Replace &amp;#039;&amp;#039;&amp;#039;pool_name&amp;#039;&amp;#039;&amp;#039; with the name of your pool&lt;br /&gt;
:** In my case the &amp;#039;&amp;#039;&amp;#039;pool_name&amp;#039;&amp;#039;&amp;#039; is called &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
====Step 3====&lt;br /&gt;
:* Rollback all the datasets in your ZFS pool to the snapshot&lt;br /&gt;
&amp;lt;code&amp;gt;zfs rollback -r nuc@full_system_backup&amp;lt;/code&amp;gt;&lt;br /&gt;
:* This command will rollback all datasets in the &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; pool to the &amp;#039;&amp;#039;&amp;#039;full_system_backup&amp;#039;&amp;#039;&amp;#039; snapshot.&lt;br /&gt;
&lt;br /&gt;
====Step 4====&lt;br /&gt;
:* After the rollback is complete, &amp;#039;&amp;#039;&amp;#039;export&amp;#039;&amp;#039;&amp;#039; the ZFS pool&lt;br /&gt;
&amp;lt;code&amp;gt;zpool export nuc&amp;lt;/code&amp;gt;&lt;br /&gt;
:* Replace &amp;#039;&amp;#039;&amp;#039;nuc&amp;#039;&amp;#039;&amp;#039; with the name of your ZFS pool&lt;br /&gt;
&lt;br /&gt;
====Step 5====&lt;br /&gt;
:* Rebbot back into your system&lt;br /&gt;
&amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your system should now be restored to the state it was in when you took the &amp;#039;&amp;#039;&amp;#039;full_system_backup&amp;#039;&amp;#039;&amp;#039; snapshot.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this process assumes your entire system, including the root filesystem, is on ZFS. If only specific parts of your system are on ZFS, you&amp;#039;ll need to adjust the process accordingly.&lt;br /&gt;
&lt;br /&gt;
Also, note that rolling back to a snapshot will destroy any changes made to the datasets after the snapshot was taken. Make sure you have backups of any important data before performing a rollback.&lt;/div&gt;</summary>
		<author><name>AwesomO</name></author>
	</entry>
</feed>