initramfs

最後更新: 2017-06-12

 

目錄

  • Centos 4 rebuild initrd
  • Centos4.5 在 Exsi
  • 查看 initrd.img-* 有什麼 Driver

 


設定檔

 

  • /etc/initramfs-tools/initramfs.conf
  • /etc/mkinitramfs/conf.d

Modules

# most - Add most filesystem and all harddrive drivers.
#
# dep - Try and guess which modules to load.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# list - Only include modules from the 'additional modules' list

# 在以下兩個目錄的 Modules 一定會 load 入 initramfs image

  • /etc/initramfs-tools/modules
  • /usr/share/initramfs-tools/modules.d/*

Default:

MODULES=most
BUSYBOX=y
COMPCACHE_SIZE=""
COMPRESS=gzip
# local | nfs
BOOT=local

 


kdump 內的 bug

 

原因 /etc/grub.d/10_linux 內有句

if [ -x "/usr/bin/makedumpfile" ] && [ -x "/sbin/kexec" ]; then
    GRUB_CMDLINE_EXTRA="$GRUB_CMDLINE_EXTRA crashkernel=384M-2G:64M,2G-:128M"
fi

uname -a

Linux ubuntu 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux

zcat /boot/initrd.img-$(uname -r) | wc -c

33097216

# 當 most 時有成 31 MB 大 !!

# MODULES=most
MODULES=dep

zcat /boot/initrd.img-$(uname -r) | wc -c

5022208

# 5MB 左右 !!

 


Debian rebuild initrd (mkinitramfs)

 

update-initramfs -u           <-- mkinitramfs fontend

 


Centos 4 rebuild initrd

 

mkinitrd --with=sd_mod --with=libata  -v -f  /boot/initrd-`uname -r`.img `uname -r`

Centos4.5 在 Exsi

在 /etc/modprobe.conf 有以下設定

# Parallels emulates Buslogic SCSI adapter
alias scsi_hostadapter1 BusLogic   
alias scsi_hostadapter2 mptbase
alias scsi_hostadapter3 mptspi
alias scsi_hostadapter4 ata_piix
alias eth0 vmnics

 


CentOS 5

 

Error

mount could not find filesystem '/dev/root'

# boot 時不 load 沒用的 driver

echo "DMRAID=no" > /etc/sysconfig/mkinitrd/noraid

chmod 755 /etc/sysconfig/mkinitrd/noraid

# 在 /etc/modprobe.conf 內要有以下設定

alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptscsih
alias scsi_hostadapter2 mptfc
alias scsi_hostadapter3 mptspi
alias scsi_hostadapter4 mptsas

cp -p /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak

mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)

OR

mkinitrd -f -v /boot/initrd-2.6.18-371.el5.img 2.6.18-371.el5

 


CentOS 6

 

mount --bind /proc /mnt/sysimage/proc

mount --bind /dev /mnt/sysimage/dev

mount --bind /sys /mnt/sysimage/sys

chroot /mnt/sysimage

# Backup

cp -p /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

# Build

dracut -f /boot/initramfs-2.6.32-358.el6.x86_64.img 2.6.32-358.el6.x86_64

詳見

 


查看 initrd.img-* 有什麼 Driver

 

lsinitramfs /boot/initrd.img-3.2.0-29-generic

 

 


DOC:

  • man initramfs.conf

 

 

 

Creative Commons license icon Creative Commons license icon