Wednesday, March 31, 2021

time clock is always wrong in the dual system windows and macOS ?



Many Mac+Windows dual system users may be very distressed: What should I do if the time of Windows and Mac are inconsistent?

We must first be clear that the default way Windows and Mac treat system hardware time is different: Windows treats system hardware time as local time, that is, the time displayed in the operating system is the same as that displayed in BIOS/EFI The time is the same.

Mac regards the hardware time as UTC, and the time displayed in the operating system is converted from the hardware time. For example, if Beijing time is GMT+8, the time displayed in the system is hardware time +8.

Let me explain the proper nouns of UTC and GMT:

UTC: Universal Time Coordinated, coordinated universal time

GMT: Greenwich Mean Time, Greenwich Mean Time

If you set the time zone in both Mac and Windows to Beijing time, and you change the current system time to 10:00AM on the Mac, the actual UTC time stored in the hardware at this time is 2:00AM. At this time, after you restart and enter Windows, you will find that the time displayed in the windows system is 2:00AM, which is eight hours slower than the Mac.

In the same way, after you change the system time in Windows or use the network to synchronize the system time, and then check it in the Mac, the system will be almost 8 hours faster.

The kid's solution is:

We let Windows treat the hardware time as UTC (that is, modify it under Windows)

In Start-Run-CMD (Win7 needs to be run as an administrator), enter the following command (copy it):

Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1





After restarting and entering Mac or Windows, the time difference of 8 hours will no longer occur. Is it very convenient?

Monday, March 29, 2021

How to retrieve disk space consumption in Windows virtual machine

If your virtual machine is running windows, and disk type is "Thin Provision", this type of vm disk only take up the disk space which it is actually using.

But after long time, the space consumption is growing bigger and bigger. It can be much bigger than it actually suing in the system.

The reason causing this problem is because the "Thin Provision" can only grow and never shrink in NTFS file system, the space can't be reuse even the file been deleted after using.

So, this is the soluation about how to retrieve the disk space consumption and help you save the space,  only for the windows vm which is NTFS file system.

1, download the tool from official vmware site which is called SDelete.exe.

2, run it in cmd of your windows vm with the parameter "-z" (need very long time if the disk space is big)

Eg: sdelete.exe -z c:

3, ssh to your esxi and go to vmdk folder which you want to modify.

4, Run "vmkfstools -K VirtualMachine.vmdk", after a while is done.

 

Below is the result of my vCenter Server.vmdk file which is 96GB at the begging, after the procedure it become to 38GB, and it is the same size in the windows vm.

 



This is only for windows vm which is NTFS file system. Not for linux and mac.

Friday, March 26, 2021

Backup vm from esxi using voftool

  1. Install fusion on Mac or Vmware on Windows or OVFTool.
  2. Windows:

ovftool vi://root:@192.168.198.10/win10 C:\Users\daivd\Desktop\ova\win10.ova

MacOS:

ovftool vi://root:@{ip address of esxi}/{name of vm}/{save folder}/{filename.ova}

  1. after input username and password, the ova file will be saved.

How to FORCE passthrough the internal USB controller in the mother board

  • Enable ssh on esxi.
  • From terminal of your computer, ssh to esxi:

[root@homecenter:/etc/vmware] lspci -v
0000:00:00.0 Bridge Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers
Class 0600: 8086:591f
0000:00:01.0 Bridge PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) [PCIe RP[0000:00:01.0]]
Class 0604: 8086:1901
0000:00:02.0 Display controller Display controller: Intel Corporation HD Graphics 630
Class 0380: 8086:5912
0000:00:14.0 Serial bus controller USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller
Class 0c03: 8086:a12f

0000:00:14.2 Signal processing controller Signal processing controller: Intel Corporation 100 Series/C230 Series Chipset Family Thermal Subsystem
Class 1180: 8086:a131
0000:00:16.0 Communication controller Communication controller: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1
Class 0780: 8086:a13a
0000:00:16.3 Communication controller Serial controller: Intel Corporation 100 Series/C230 Series Chipset Family KT Redirection
Class 0700: 8086:a13d

  • You will find the useful info:

0000:00:14.0 Serial bus controller USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller
Class 0c03: 8086:a12f

  • Edit the file /etc/vmware/passthru.map

[root@homecenter:/etc/vmware] vi passthru.map
# passthrough attributes for devices
#
# file format: vendor-id device-id resetMethod fptShareable
# vendor/device id: xxxx (in hex) (ffff can be used for wildchar match)
# reset methods: flr, d3d0, link, bridge, default
# fptShareable: true/default, false
#
# Description:
#
# - fptShareable: when set to true means the PCI device can be shared.
# Sharing refers to using multiple functions of a multi‐function
# device in different contexts. That is, sharing between two
# virtual machines or between a virtual machine and VMkernel.
#
# - resetMethod: override for the type of reset to apply to a PCI device.
# Bus reset and link reset prevent functions in a multi-function
# device from being assigned to different virtual machines, or from
# being assigned between the VMkernel and virtual machines. In
# some devices it's possible to use PCI power management capability
# D3->D0 transitions to reset the device. In the absence of the
# override, the VMkernel decides the type of PCI reset to apply
# based on the device's capabilities. The VMkernel prioritizes
# function level reset (flr).
#
# Restrictions:
#
# - PCI SR-IOV physical and virtual functions (PFs/VFs) are not allowed
# in the list below. Those must support function-level-reset and
# must be shareable.
#
# Intel 82579LM Gig NIC can be reset with d3d0
8086 1502 d3d0 default
# Intel 82598 10Gig cards can be reset with d3d0
8086 10b6 d3d0 default
8086 10c6 d3d0 default
8086 10c7 d3d0 default
8086 10c8 d3d0 default
8086 10dd d3d0 default
# Broadcom 57710/57711/57712 10Gig cards are not shareable
14e4 164e default false
14e4 164f default false
14e4 1650 default false
14e4 1662 link false
# Qlogic 8Gb FC card can not be shared
1077 2532 default false
# LSILogic 1068 based SAS controllers
1000 0056 d3d0 default
1000 0058 d3d0 default
# NVIDIA
10de ffff bridge false

# below is by David
# usb internal
8086 a12f d3d0 default


  • Add the "8086 a12f" follow by the default volume" d3d0 default", then save and exit.
  • After reboot, you will find the internal USB controller can be passthrough now.




Monday, March 1, 2021

how to stop upgrade notification to Catalia or BigSur on Mojave

By replacing files of Mojave 10.14.6 (18G5033)



Replacing the SoftwareUpdate.framework file in "/ System / Library / PrivateFrameworks /" with that of 18G4032 corrects the appearance of the Catalina and  BigSur update notification.


How to do:


1), #Make a backup of SoftwareUpdate.framework existing in / System / Library / PrivateFrameworks /

sudo cp -R /System/Library/PrivateFrameworks/SoftwareUpdate.framework /System/Library/PrivateFrameworks/SoftwareUpdate.framework.backup


2), #Copy the file SoftwareUpdate.framework (uncompressed) in the folder / System / Library / PrivateFrameworks / (overwrite the existing one, DO NOT MERGE)



3), #then with terminal:

sudo chmod -R 755 /System/Library/PrivateFrameworks/SoftwareUpdate.framework;

sudo chown -R 0: 0 /System/Library/PrivateFrameworks/SoftwareUpdate.framework




##. How to disable SIP on MAC in command line:


From the Terminal, run the following commands:

sudo nvram "recovery-boot-mode=unused"

sudo reboot recovery

From the menu bar click Utilities > Terminal

Run csrutil disable from the terminal, followed by reboot

Once your VM has rebooted normally you can verify that SIP was disabled by opening a terminal and running csrutil status

after done, run: nvram -d recovery-boot-mode , back to the normal boot mode.