February 2012

Linux RHEL – Change hostname

3 step for change hostname to RHEL Linux:

1. edit: /etc/hosts
127.0.0.1 srv03.mil1.wide-net.org localhost.localdomain localhost

2. edit: /etc/sysconfig/network
HOSTNAME=srv03.mil11.wide-net.org

3. past into kernel new hostname
echo "srv03.mil1.wide-net.org" > /proc/sys/kernel/hostname

Or

sysctl kernel.hostname=srv03.mil1.wide-net.org

Consider a restart net services /etc/init.d/network restart but is not strictly required.

Linux RHEL – Change hostname Read More »

Stupid Ubuntu – Grub recovery on RAID

I definitely hate Ubuntu, is not linux.

root@ubuntu:~# cd /mnt
root@ubuntu:/mnt# mkdir md1
root@ubuntu:/mnt# mount /dev/md1 /mnt/md1/
root@ubuntu:~# mount -o bind /sys /mnt/md1/sys
root@ubuntu:~# mount -o bind /dev /mnt/md1/dev
root@ubuntu:~# mount -o bind /proc /mnt/md1/proc
root@ubuntu:~# chroot /mnt/md1 /bin/bash

root@ubuntu:~# ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 9 2012-02-05 11:00 455c4bdc-37d5-46ef-bb8b-d5b50c9e4e9a -> ../../md1

root@ubuntu:/# vim /boot/grub/grub.cfg

root@ubuntu:/# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-33-generic-pae
Found initrd image: /boot/initrd.img-2.6.32-33-generic-pae
Found linux image: /boot/vmlinuz-2.6.32-28-generic-pae
Found initrd image: /boot/initrd.img-2.6.32-28-generic-pae
Found memtest86+ image: /boot/memtest86+.bin
done
root@ubuntu:/# grub-install /dev/sda
Installation finished. No error reported.
root@ubuntu:/# grub-install --recheck /dev/sda
Installation finished. No error reported.

root@ubuntu:/# cfdisk /dev/sda

Stupid Ubuntu – Grub recovery on RAID Read More »