2016年2月14日 星期日

grub tips

grub install for specific drive without BIOS drive name mapping grub --device-map=/dev/null
grub> device (hd0) /dev/sda

2016年2月4日 星期四

CentOS/RHEL rootfs on tmpfs

1: remember to disable selinux first
2: update mount process in /usr/share/dracut/modules.d/95rootfs-block/mount-root.sh

            mkdir /mytmpfs
            mount -t "$rootfs" -o "$rflags","$rootopts" \
                "${root#block:}" "/mytmpfs" 2>&1 | vinfo
            mount -t tmpfs -o size=100% none "$NEWROOT"
            cp -rfa /mytmpfs/* "$NEWROOT"
            sed -i '/\/boot\ /d' "$NEWROOT/etc/fstab"
            sed -i '/\/boot\t/d' "$NEWROOT/etc/fstab"
            sed -i '/\/ /d' "$NEWROOT/etc/fstab"
            sed -i '/\/\t/d' "$NEWROOT/etc/fstab"
            cat /dev/null > "$NEWROOT/root/.bash_history"
            umount /mytmpfs

3: create new initrd
4: update grub boot menu
5: boot parameter parsing
imgfile=$(getarg imgfile=)
[ -f "$imgfile" ] && tar zxvf $imgfile -C $NEWROOT

http://linux.die.net/man/1/bash
Conditional Expressions boot process stage https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html#stages