Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows Server

แก้ไขปัญหา System Clock ผิดหลัง Reboot (Server/Client)

บทความนี้อธิบายว่าทำไม System Clock แสดงเวลา/วันที่ผิดหลัง Shutdown, Restart หรือ Resume จาก Hibernation ต้องตั้งเวลาใหม่ทุกครั้ง ครอบคลุมกรณีทั่วไป: แบตเตอรี่ BIOS หมด, Dual Boot Windows/Linux, และ Firmware Bug บน HPE ProLiant G9/G8 ที่รัน Windows Server

แบตเตอรี่ BIOS/CMOS อ่อนแอ

สาเหตุทั่วไป: แบตเตอรี่ BIOS (CMOS) หมดอายุ ทำหน้าที่เก็บตั้งค่า BIOS/UEFI และ Hardware Clock เมื่อไฟถูกตัด หากแบตเตอรี่หมด BIOS ไม่เก็บตั้งค่าได้ รวมถึง Date/Time แนะนำเปลี่ยนแบตเตอรี่ (มักใช้ CR2032 3V) หากเปลี่ยนแล้วไม่หาย ตรวจ Jumper Reset BIOS (ใกล้ที่ใส่แบตเตอรี่ Marked CMOS/CLEAR/RESET) ให้อยู่ตำแหน่งปกติ อัปเดต BIOS Firmware ล่าสุดจาก Vendor

Windows: ตั้งค่า Sync กับ time.windows.com

ตรวจ Time Zone และ Internet Time Sync ใน Control Panel → Clock and Region → Date and Time → แท็บ Internet Time ตรวจสอบ Sync กับ time.windows.com อัตโนมัติ

Troubleshoot Time Sync สำหรับ Domain-Joined Computers

ใน AD Domain ใช้ Hierarchy Sync:

  • Root DC (PDC Emulator FSMO) = Time Source สำหรับ DCs อื่น
  • DCs อื่น Sync กับ PDC
  • Member Servers/Workstations Sync กับ DC ใกล้ที่สุดตาม Topology

หา PDC: netdom /query fsmo

ตั้งค่า External NTP บน PDC:

w32tm /config /manualpeerlist:"0.nl.pool.ntp.org,0x1 1.nl.pool.ntp.org,0x1 2.nl.pool.ntp.org,0x1 3.nl.pool.ntp.org,0x1"
w32tm /config /reliable:yes
net stop w32time && net start w32time
w32tm /query /peers (ดู Source/Status)
w32tm /resync /rediscover (Sync Manual)

Windows & Linux แสดงเวลาต่างกันใน Dual Boot

Windows และ Linux จัดการ BIOS Time ต่างกัน: Linux ใช้ UTC, Windows ใช้ localtime

Linux (Ubuntu) คิดว่า BIOS Time เป็น UTC → Convert ด้วย Time Zone Offset (เช่น UTC+2 เพิ่ม 2 ชม.) Windows คิดว่า BIOS Time เป็น Local Time → เปลี่ยน BIOS Time ตรงๆ ตอน Sync ทำให้เวลาผิดเมื่อสลับ OS

แก้ไข: ทำให้ Windows ใช้ UTC

สร้าง Registry RealTimeIsUniversal = 1 ใน HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

reg add "HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /t REG_DWORD /d 1 /f

Tip Windows 64-bit ใช้ QWORD: reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1

ปิด Internet Time Sync ใน Windows (แต่ละครั้ง Sync จะ Reset UTC กลับ Local): sc config w32time start= disabled → Restart

หรือ ทำให้ Linux ใช้ Local Time: Ubuntu 15.04+ timedatectl set-local-rtc 1

HPE Servers: Offset เวลาหลัง Restart

ปัญหาบน HPE DL/ML Gen9 (และ DL580 Gen8) รัน Windows Server 2008 R2/2012 R2 หลังเปลี่ยน Time Zone เวลาไม่บันทึก Reset กลับหลัง Reboot เกิดบน Server ที่ Boot แบบ Legacy Mode (UEFI Native ไม่มีปัญหา)

Event Log: The system time has changed to ... from ... Change Reason: System time synchronized with the hardware clock.

แก้ไข: อัปเดต ROM Version อย่างน้อย 1.5 (RBSU Version ที่แก้ Bug นี้) หรือ Workaround: ตั้งค่า Registry RealTimeIsUniversal = 1 เหมือนข้างต้น (บังคับ BIOS ให้ UTC แทน Local Time)