-# List the filesystems to replicate
-# The parent filesystems MUST be listed ahead
-# of the children filesystems.
-# Pool root filesystems must end with a slash.
-$replicate tank/ $destpool
-$replicate tank/var $destpool
-$replicate tank/usr $destpool
-$replicate tank/usr/home $destpool
-$replicate tank/usr/videos $destpool
-$replicate tank/usr/local $destpool
-$replicate tank/usr/local/etc $destpool
-$replicate tank/usr/local/var $destpool
-$replicate tank/backup $destpool
+# Sort the filesystems to replicate by the oldest backup first
+tmpfile=`tempfile`
+for filesystem in $filesystems_to_replicate; do
+ age=`snapshot_age $filesystem`
+ echo $filesystem $age >> $tmpfile
+done
+sorted_filesystems=`cat $tmpfile | sort -n -k 2 | awk '{ print $1 }'`
+rm -f $tmpfile