Skip to content

HOWTO: FreeBSD ZFS Snapshot saved to a file for backup/archive

October 8, 2013

Assuming already have it all. Zfs on root too.

1. Create the snapshot of the full pool ( my pool is called zroot ):

# zfs snapshot -r zroot@zroot_freshinstall

1.1 Check snapshots list

# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
zroot@zroot_freshinstall 0 – 413M –
zroot/swap@zroot_freshinstall 0 – 21.3K –
zroot/tmp@zroot_freshinstall 0 – 14.3G –
zroot/usr@zroot_freshinstall 0 – 612M –
zroot/usr/home@zroot_freshinstall 0 – 40.0K –
zroot/usr/ports@zroot_freshinstall 0 – 399M –
zroot/usr/src@zroot_freshinstall 0 – 388M –
zroot/var@zroot_freshinstall 0 – 310K –
zroot/var/crash@zroot_freshinstall 0 – 40.6K –
zroot/var/db@zroot_freshinstall 0 – 98.8M –
zroot/var/db/pkg@zroot_freshinstall 0 – 1.19M –
zroot/var/empty@zroot_freshinstall 0 – 40.0K –
zroot/var/log@zroot_freshinstall 0 – 113K –
zroot/var/mail@zroot_freshinstall 0 – 40.0K –
zroot/var/run@zroot_freshinstall 0 – 81.3K –
zroot/var/tmp@zroot_freshinstall 0 – 41.3K –

Looks good.

2. Remove unneeded swap volume from the snapshot before sending it to a file, but keeping all other ‘unneed paths’

 # zfs destroy zroot/swap@zroot_freshinstall

3. Send snapshot to e file ( for backup , archive or whatever I like ) . I use pigz for threaded gziping, so please first install pigz and stop waiting for compression :))

# cd /usr/ports/archivers/pigz && make install

# zfs send zroot@zroot_freshinstall | pigz -p 8 -9 > zroot_freshinstall.snapshot.gz

Now you can move and save your gziped snapshot.

That’s all

Recovering from archived as file snapshot will be in one of the next posts.

Please take more time for this and read other articles like:

http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch06.html

and

http://docs.oracle.com/cd/E19253-01/819-5461/gbcya/index.html

and

http://docs.oracle.com/cd/E23824_01/html/821-1448/recover-3.html

Thanks 🙂

Advertisements

From → FreeBSD, ZFS

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: