2014年4月19日 星期六

Linux System fast clone

RHEL 6.5 EFI fs structure
/dev/sdx1 vfat --> t(6)   /boot/efi (10MB should be okay)
/dev/sdx2 ext4 --> t(83)  /boot (50MB should be okay)
/dev/sdx3 ext4 --> t(83)  /

boot menu for EFI boot option
efibootmgr -c -d /dev/sda -p 1 -w -L "Redhat Enterprise Linux 6.5" -l '\EFI\redhat\grub.efi'


RHEL 6.5 legacy fs structure
/dev/sdx1 ext4 --> t(83)  /boot
/dev/sdx2 ext4 --> t(83)  /
grub need to be installed

fstab/grub.conf need to be updated according to the UUID of target disk

kernel option of current boot can be found at /proc/cmdline

2014年4月10日 星期四

option rom dump from Linux

http://www.coreboot.org/VGA_support

cat /proc/iomem |head -n 3|tail -n 1|(read m; m=${m/ :*}; s=${m/-*}; e=${m/*-}; dd if=/dev/mem of=vgabios.bin bs=1c skip=$[0x$s] count=$[$[0x$e]-$[0x$s]+1])

will dump the 3rd option rom.

2013年12月30日 星期一

sample pac file

function FindProxyForURL(url, host) {

if (isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
   isInNet(dnsResolve(host), "172.0.0.0", "255.0.0.0"))
   return "DIRECT";

if ( shExpMatch(host, "*.facebook.com") )
    return "SOCKS 127.0.0.1:9000";

if ( shExpMatch(host, "*.pchome.com.tw") )
    return "SOCKS 127.0.0.1:9000";

if ( shExpMatch(host, "*.ruten.com.tw") )
    return "SOCKS 127.0.0.1:9000";

if ( shExpMatch(host, "tw.*.yahoo.com") )
    return "SOCKS 127.0.0.1:9000";

if ( shExpMatch(host, "*.blogspot.*") )
    return "SOCKS 127.0.0.1:9000";

return "DIRECT";
}

2013年12月22日 星期日

hdd image for PXE boot

dd if=/dev/zero of=kido bs=512 count=20160 --> S63*H16*C20

fdisk -u -C20 -H16 -S63 kido
  c--> DOS Compatibility flag is set
  n --> p --> 1
  t --> b
  a --> 1

ms-sys -9 -f kido
losetup -o32256 /dev/loop0 kido
mkfs.msdos -F 16 -n "KIDO" /dev/loop0
ms-sys -f -6 /dev/loop0
hexedit /dev/loop0
  15h-F8
  18h-3F (S63)
  1Ah-10 (H16)
  1Ch-1Dh (3f 00)
  24h-80

cp command.com  drvspace.bin  io.sys  msdos.sys to image
losetup -d /dev/loop0

mount -o loop,offset=32256 kido hdd --> 32256 = 63*512

shrink down image size by gzip
  gzip kido
  mv kido kido.img

PXE config
  label dos
    kernel /tool/memdisk
    append initrd=/tool/kido.img harddisk c=20 h=16 s=63

mbr --> master boot record (at offset 0)
boot program (at offset 32256)

ms-sys --> http://ms-sys.sourceforge.net/

f2 to save
f10 to exit

2013年12月17日 星期二

webatm plugin issue

By disabling ActiveX filtering to enable webatm activeX runs properly.



2013年11月28日 星期四

yum repository setup for yum

After invoking system-config-kickstart, system will try to pull available package information from repository.
If your machine does not have internet capability, it will hang all the time.
Simply create a local repository to /etc/yum.yum.repos.d/folder for system-config-kickstart to build package list.
Please note, repository id must be named as [base] and all system default repository config file need to be moved out of /etc/yum.repo.d to speed up package load process.
[base]
name=CentOS 5.8 x86_64
baseurl=file:///nfs/centos-5.10-x86_64
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

copy repodata from cdrom to local drive
#cp -dpR /mnt/cdrom/repodata /nfs/centos-5.10-x86_64/

use following command to clear cache data
#yum clean all 

use following command to read package information from repository
#yum repolist

Please note, repodata folder need to placed underneath baseurl folder. 
And then you are good to go with system-config-kickstart.

2013年11月24日 星期日

non-interactive fdisk

#!/bin/sh
hdd="/dev/hda /dev/hdb /dev/hdc"
for i in $hdd;do
echo "n
p
1


w
"|fdisk $i;mkfs.ext3 $i;done 
http://xmodulo.com/2012/11/how-to-run-fdisk-in-non-interactive-batch-mode.html