ZFS snapshots (Overview)

A snapshot is a read-only copy of a file system or volume. Snapshots can be created almost instantly, and they initially consume no additional disk space within the pool. It’s important for the Oracle DBA in Montreal to have a list of these commands.

How can I create a new ZFS snapshot?

$sudo zfs snapshot rpool/DBORA/u01@u01snapshop

How can I list all ZFS files system and snapshots (in Bold)?

$ zfs list -r -t all

Or

$ zfs list -o space -r rpool

How can I know the creation date of the ZFS snapshots?

$ zfs list -r -t snapshot -o name,creation

How can I delete a ZFS snapshop?

$ sudo zfs destroy rpool/DBORA/u01@now

How can I use my ZFS snapshop to restore a single file?

I want to restore the file /u01/test.sh

$cd /u01
$cd .zfs/snapshot/u01snapshop/
$cp test.sh /u01/

or to restore a copie without replace current one :

$cp test.sh /u01/test2.sh

You can use a snapshot like any other (read-only) FS to move files or folder to another place.

How can I use my ZFS snapshop to restore a File system?

This command will discard all changes made to the file system since the snapshot was created:

$sudo zfs rollback rpool/DBORA/u01@u01snapshop
cannot rollback to ‘rpool/DBORA/u01@u01snapshop’: more recent snapshots exist
use ‘-r’ to force deletion of the following snapshots:
rpool/DBORA/u01@u01snapshop2
rpool/DBORA/u01@u01snapshop3

$sudo zfs rollback -r rpool/DBORA/u01@u01snapshop


More informations in the Oracle documentation.


Vincent Fenoll DBA Oracle Montreal

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.