Kernel
Traitements sur initrd
On peut maintenant faire en sorte, en une seule opération, de décompresser l’initrd du répertoire /boot, dans le répertoire de travail précédemment préparé tout en développant l’archive cpio :
gunzip –c /boot/initrds-$(uname –r).img | cpio –i
ATTENTION : par contre, si l’on manipule un fichier initramfs : ce qui est généralement le cas pour les distributions CentOS et RedHat en version supérieure à 6, il faut utiliser la commande ci-dessous pour décompresser l’archive initramfs :
/usr/lib/dracut/skipcpio /boot/initramfs-$(uname –r).img|gunzip –c|cpio –i –d
À ce stade, dans le sous-répertoire /work/initrd, on peut alors découvrir l’intégralité du contenu du fichier initrd (ou initramfs) développé : On peut alors modifier ce que l’on souhaite, avant de reconstituer l’archive compressée du fichier initrd.
find * | cpio –o –H newc | gzip -9 –c > /boot/initrd-$(uname –r)-new.img
De même que pour la décompression, la reconstitution de l’archive d’un fichier initramfs passe par les commandes suivantes :
# cd /work/initrd # find . | cpio --create --format=’newc’ > /tmp/initramfs-new # cd /tmp # gzip initramfs-new # mv initramfs-new.gz /boot/initramfs-new.img
Disable USB
On servers disabling USB can be disabled by adding a boot parameter, in BIOS, or through modprobe. For grub add nousb parameter to /boot/grub/grub.cfg:
linux /vmlinuz-<kernel> root=/dev/mapper/<name> ro nousb
For modprobe entery append the following to /etc/modprobe.conf:
install usb-storage
BIOS is done on an individual basis and you should read the manual to see if it is possible.