Thursday, 28 June 2012

Solaris - ZFS snapshots

We had a need to be able to have a recovery plan for some Solaris servers involved in a application upgrade.

Investigations led to the following which would cover us from the / (root) upwards, but not cover mountpoints.

# zfs list

NAME                     USED  AVAIL  REFER  MOUNTPOINT
rpool                   37.0G  30.0G    97K  /rpool
rpool/ROOT              22.8G  30.0G    21K  legacy
rpool/ROOT/root_ds      22.8G  30.0G  21.6G  /
rpool/ROOT/root_ds/var  1.29G  30.0G  1.29G  /var
rpool/dump              1.00G  30.0G  1.00G  -
rpool/export            11.0G  30.0G  4.53G  /export
rpool/export/home       6.52G  30.0G  6.52G  /export/home
rpool/swap              2.06G  32.0G  9.94M  -
snapshot the filesystem:

# zfs snapshot rpool/ROOT/root_ds@thursday

NAME                          USED  AVAIL  REFER  MOUNTPOINT
rpool                        37.0G  30.0G    97K  /rpool
rpool/ROOT                   22.8G  30.0G    21K  legacy
rpool/ROOT/root_ds           22.8G  30.0G  21.6G  /
rpool/ROOT/root_ds@thursday  3.40M      -  21.6G  -
rpool/ROOT/root_ds/var       1.29G  30.0G  1.29G  /var
rpool/dump                   1.00G  30.0G  1.00G  -
rpool/export                 11.0G  30.0G  4.53G  /export
rpool/export/home            6.52G  30.0G  6.52G  /export/home
rpool/swap                   2.06G  32.0G  9.94M  -
To check files in the snapshot you can go to /.zfs/snapshot/<snapshot name> (which is a hidden file)

To rollback:

# zfs rollback rpool/ROOT/root_ds@thursday

To delete the snapshot:

# zfs destroy rpool/ROOT/root_ds@thursday

No comments:

Post a Comment