fssnap of / (root) fails under Solaris

Using fssnap we can quickly take a temporary image (snapshot) of any UFS file system and then use this snapshot for backup operations.

fssnap creates a temporary image of a file system by creating a virtual device and a backing store file. The virtual device acts like a real device and can be backed up, whilst the backing store contains copies of the pre-snapshot data that has changed since the creation of the snapshot.

For example:

# fssnap -o bs=/share/snapshots /

however this will fail if you do not disable ntp while taking a snapshot of /. The following error is shown:

fssnap: ioctl: error 22: Invalid argument

from the error messages albeit ambigious, this is generated as xntpd is active, when I shut down xntpd, I can fssnap just fine.

fssnap_ufs says:
The file system is used as backing store by an application that uses mlock(3C) to lock its pages. Typically, these are real time applications, such as xntpd(1M).

  1. xntpd locks all its process memomry, including possible future mappings which might come from /lib/libc.so.1, etcxntpd puts itself in the realtime scheduling class.
  2. NOTE: only snapshots of / are affect, any other filesystems will be successful whilst xntpd is running


Therefore, the best practice would be as follows:

  • Place NTP into maintenance*
    # svcadm mark -t maintenance ntp
  • Generate snapshot
    # fssnap -o bs=/share/snapshots /
  • Clear the NTP maintenance flag
    # svcadm clear ntp
  • You'll need to decide where to back it up to, for example:
    # ufsdump 0uf /share/backups/root.ufsdump /dev/fssnap/0
  • Finally, delete the snapshot
    # fssnap -d /dev/fssnap/0