Home >Computer Tutorials >Computer Knowledge >USB hard disk detection code

USB hard disk detection code

WBOY
WBOYforward
2024-02-11 17:10:08593browse

php editor Yuzai brings you a practical U disk hard drive detection code. This code can help users quickly detect the status and available space of U disks and hard disks, allowing users to easily understand the status of storage devices. The code is concise and efficient, and easy to use. No complicated configuration and installation are required. You only need to copy the code to your own project to use it. Both developers and ordinary users can easily manage their own storage devices through this code and improve the efficiency of work and life.

The previous article introduced the method of using diskgenius to clone the hard disk. Under the premise that the hard disk is in MBR format, we can choose to copy all sectors or clone the file system structure as it is. Today we will use the file-by-file copy method to test whether the system can be booted correctly after the cloning is completed.

First of all, let’s introduce the current situation of computer hard drives.

USB hard disk detection code

Hard drive usage

Currently there are two hard drives, one is a 120G solid-state drive, which is used as the main boot disk and has the WIN10 operating system installed. The other is a 160G mechanical hard drive as a secondary drive. Our goal is to clone the system in the 120G solid state drive to a 160G mechanical hard drive.

Due to the cloning of the system disk, it is not suitable for operation in a running WIN10 system. Because the running system will have some files open, the system files may be incomplete during cloning, resulting in boot failure.

USB hard disk detection code

Set the USB boot in bios

We use the USB boot disk with PE to boot the system. First, set the U disk as the first boot disk in the motherboard's BIOS. Since different motherboards may have different setting methods, you can find the setting method for the specific motherboard by yourself.

USB hard disk detection code

Open disktenius and select hard disk clone

After entering the PE system, select diskgenius disk wizard.

Select the Tools menu and clone the hard drive.

First select a 120G solid-state drive as the source disk, and then select a 160G hard disk as the target disk.

USB hard disk detection code

Select clone by file copy method

After confirmation, there are three cloning methods to choose from. Copy all sectors and copy the file system structure as it is. We have tested it and it can start normally without any problems. Today I will test the third one, copy by file (which can eliminate fragmentation).

After completing the selection, press Start. Due to the large amount of data, it may take a long time.

After the cloning is completed, unplug the USB flash drive and solid-state drive, and only use the 160G mechanical hard drive to boot.

USB hard disk detection code

Error code 0xc000000e

It was found that the win10 system failed to boot, showing that the required device is not connected or cannot be accessed, prompting error code 0xc000000e.

USB hard disk detection code

File winload.exe error

The following prompts to press F8 to specify startup settings. After pressing F8, it says that the application or operating system cannot be loaded because the required files are missing or contain errors. File: \windows\system\windload.exe

Hard disk cloning, using the file-by-file copy method, did not boot the win10 system correctly. Because the system could not find the boot device, the system file winload was damaged or inaccessible. The reason is that the drive is not configured correctly.

Here are the repair methods.

USB hard disk detection code

Enter cmd in pe to enter the command mode

Use the USB disk to boot into the PE system, select Start, Run, enter CMD to enter the command mode. Enter the following command.

USB hard disk detection code

Repair the default boot device

c:

cd c:\windows\system32

bcdedit /set {default} osdevice boot

bcdedit /set {default} device boot

bcdedit /set {default} detecthal 1

exit

The above statement, first enter the C drive, Enter the system32 folder of the system, set the default boot device, and then exit the command mode.

Exit PE and reboot the system with a 160G hard drive. Win10 enters normally.

USB hard disk detection code

Commands to repair boot devices.

The above is the detailed content of USB hard disk detection code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:pc-daily.com. If there is any infringement, please contact admin@php.cn delete