Initramfs changes the order of disk power-on before scanning the disk

Source: Internet
Author: User

Background:

The hard drive requires 12 V 5 V power supply. Previously designed, the hardware circuit is valid for 5 V by default, and the 12 V power is invalid. Then, the system drives 12 V power, which is equivalent to 5 V first and 12 V later for the disk, this method is applicable to most disks, but for Hitachi hgst disks, cold start (or reboot after 12 V is not enabled, so that reboot after 12 V is enabled will be enabled due to 12 V and 5 V, after the disk is restarted (hot boot), the system will correctly probe the disk). When scanning the disk (executing the 'udevadm settle 'in the init script in initramfs), the system will detect the disk, but because the 12 V is not mounted, therefore, the probe disk fails. Because the driver cyclically runs the probe disk four times (considering that the disk may not be ready, multiple attempts are made), the system starts slowly, this indicates that this type of disk requires 12 V first and then 5 V or power-on at the same time.

 

Solution:

Because the scan disk is carried out in initramfs, You need to disable 5 V before scanning, enable 12 V, enable 5 V, and then scan.

The initramfs file is a gzip compressed file packaged by cpio. First modify the suffix and decompress it:

# Mv initramfs-2.6.32-431.20.3.el6.x86_64.img initramfs-2.6.32-431.20.3.el6.x86_64.gz

# Gunzip initramfs-2.6.32-431.20.3.el6.x86_64.gz

# Cpio-ID initramfs-2.6.32-431.20.3.el6.x86_64

First turn off the 5 V and open 12 V Drive tca6416-nosh-low.ko, slotpower. ko and its dependent I2C controller driver i2c-i801.ko into the decompressed generated lib/modules/2.6.32-431.20.3.el6.x86 _ 64 any directory, and then run 'depmod-B. '(scan the current lib/modules/'uname-R' Directory, which is not a system directory; then generate all driver Dependencies under this directory and save modules under this directory. in files such as dep), and then add the following before the while loop of the init file and the udevsettle statement:

Sysfs_gpio = "/sys/class/gpio"
While:; do
Echo "before modprobe"
Modprobe i2c_i801
Modprobe tca6416_nosh_low
Modprobe slotpower

[-D $ sysfs_gpio] & &{\
For gpio in 'LS-d $ {sysfs_gpio}/gpio [0-9] *'
Do
Echo 1> $ {gpio}/value
Done
}

Note:Modprobe is implemented through modules. the DEP file is used to obtain the location where the driver is loaded. You can only write the driver name with modprobe. ko suffix. Otherwise, the system will prompt that the driver cannot be found. In addition, modprobe does not distinguish between "-" and "_" in the driver file name.As shown above.

Save the init file, compress the current directory, generate the initramfs file, replace the corresponding initramfs file in the system/boot directory, and restart:

# Find. | cpio-Co | gzip-C> ../initramfs.cpio.gz

# Mv ../initramfs.cpio.gz/boot/initramfs-2.6.32-431.20.3.el6.x86_64.img

# Reboot

Initramfs changes the order of disk power-on before scanning the disk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.