Ambari Upgrade Guide
Also available as:

Finalize Upgrade

The upgrade is now fully functional but not yet finalized. Using the finalize command removes the previous version of the NameNode and DataNode storage directories. After the upgrade is finalized, the system cannot be rolled back. Perform thorough testing of the upgraded cluster before finalizing the upgrade. The upgrade must be finalized before another upgrade can be performed.

Directories used by Hadoop 1 services set in /etc/hadoop/conf/taskcontroller.cfg are not automatically deleted after upgrade. Administrators can choose to delete these directories after the upgrade.

To finalize the upgrade, execute the following command once, on the primary NameNode host in your HDP cluster:

sudo su -l <HDFS_USER> -c "hdfs dfsadmin -finalizeUpgrade"

where <HDFS_USER> is the HDFS service user. For example, hdfs.