ZFS: Instant "online" Backups

No Comments

We had several web sites hosted by lighttpd on a single server. We wanted to make on-line backups of them, something we've procrastinated a long time! Once you see how simple it is to make online backups of your data with our OpenSolaris VPS ZFS file system, we hope you won't follow the same path as us and spend some minor time now to save some trouble later.

We wanted to make backup of all the data in /var/lighttpd, where all of our actual web site data lives. Here's what we did.

root@mask:/# zfs create zones/mask/ROOT/lighttpd
root@mask:/# zfs get mountpoint zones/mask/ROOT/lighttpd
NAME                      PROPERTY    VALUE       SOURCE
zones/mask/ROOT/lighttpd  mountpoint  legacy      inherited from zones/mask/ROOT
root@mask:/# 

Now disable lighttpd, move the data, and create new ZFS snapshot.

root@mask:/# svcadm disable lighttpd14
root@mask:/# mv /var/lighttpd /var/lighttpd.old
root@mask:/# zfs set mountpoint=/var/lighttpd zones/mask/ROOT/lighttpd
root@mask:/# cd /var
root@mask:/var# mv lighttpd.old/* lighttpd
root@mask:/var# zfs snapshot zones/mask/ROOT/lighttpd@backup
root@mask:/var# zfs list -t snapshot
NAME                              USED  AVAIL  REFER  MOUNTPOINT
zones/mask/ROOT/lighttpd@backup      0      -   411M  -
zones/mask/ROOT/zbe@backup        143M      -  1.12G  -
root@mask:/var#

That's it! What just happened?

We took a snapshot of the full file system as it was when we ran that zfs snapshot command. This is a real file system backup, which can be used to restore to if there is ever a need.

Of course, this is just the beginning. You can destroy snapshots and use these snapshots to make offline backups. More on these topics later, or better yet, give them a shot yourself. There are lots of resources on Google.

Want to learn more? Why not purchase our OpenSolaris VPS servers from Entic.net, powered by ZFS? We're sure you'll love it. It'll simplify your life, and you might even like it more than Linux!

Be the first to write a comment!