Help Center> Server Migration Service> FAQs> Product Consultation> Why Does the Target Server Not Synchronize the Clocks on the Source Server?
Updated on 2023-11-29 GMT+08:00

Why Does the Target Server Not Synchronize the Clocks on the Source Server?

Symptom

After a Linux server was migrated, the system time and hardware time on the target server were different from that on the source server, as shown in Figure 1 and Figure 2.
Figure 1 Time on the source server
Figure 2 Time on the target server

Solution

To resolve this time synchronization problem, you can configure the Huawei Cloud image source and NTP server. This solution is applicable to CentOS 6, CentOS 7, CentOS 8, and Ubuntu.

  1. Start the target server.
  2. Log in to the target server as user root, go to the directory where SMS-Agent is installed, and run the following command:

    ./ntp_set.sh

    If the SMS-Agent is installed in the /tmp directory, the SMS-Agent directory will be deleted from the target server after the migration. You can download and install the SMS-Agent again on the target server.

  3. Determine whether to configure the Huawei Cloud image source (Yum repository for CentOS and APT repository for Ubuntu) and NTP server. y indicates yes, and n indicates no.

    • To configure the Huawei Cloud image source, enter y and perform the operations described in How Can I Use an Automated Tool to Configure a Huawei Cloud Image Source? The operations apply only to target servers in the following regions: CN North-Beijing1, CN North-Beijing4, CN East-Shanghai1, CN East-Shanghai2, CN South-Guangzhou, and CN-Hong Kong. For target servers running in other regions, configure the image source by referring to How Do I Configure the Yum Repository After the Migration?
      For CentOS, run the following command to check whether the image source address has been changed to that of the Huawei Cloud Yum repository.
      vim /etc/yum.repos.d/CentOS-Base.repo

      For Ubuntu, run the following command to check whether the image source address has been changed to that of the Huawei Cloud APT repository.
      vim /etc/apt/sources.list

    • To configure the Huawei Cloud NTP server, enter y, enter the domain name of the Huawei Cloud NTP server (ntp.myhuaweicloud.com), and press Enter. If the following information is displayed, the NTP server is configured successfully.

      Then check whether the IP address of the NTP server has been changed to that of the Huawei Cloud NTP server.
      ntpq -p

  4. Run the date and hwclock commands to check whether the system time and hardware time on the target server have been synchronized with the source server.

Product Consultation FAQs

more