The name node stores the HDFS file system information in a file named "fsimage".
Updates like add/remove blocks are not updated in the fsimage file, but are logged into a file. When restarting, the name node reads the fsimage file and then applies all the changes from the log file to bring the file system state up to date in the memory. This process takes time.
The secondary name node periodically reads the file system, changes log and updates it to the fsimage file. This allows the name node to start up faster next time.