擁抱自由,使用 linux !

在Linux底下真是太幸福了,有好多東西可以玩。想從windows解脫就是現在!

Aug-9-10

DRBL+iTALC 實做紀錄

posted by Thomas

上禮拜上課(DRBL基礎課程)有老師再問整合iTALC的問題,課程結束後馬上在老師面前實做了一下,不到10分鐘就完成了,所以基本上是沒有問題的。把大致的作法紀錄一下:

0. 環境,電腦教室電腦兩台串接,一台當DRBL Server(也當老師,無妨),另一台當學生。先裝好Linux Ubuntu 10.04,做好準備安裝DRBL,然後…

1. 安裝DRBL Server (廢話…)

2. drblsrv -i

3. apt-get install italc-master italc-client

4. addgroup italc

5. chgrp 某些檔案(如果需要的話,我忘記當時有沒有作 反正可以跑)

6. drblpush(如果先把key丟出去,有可能每個電腦都是老師?)

7. drbl-cp-host /tftpboot/nodes/Tercher_ip/etc/italc/keys/public/teacher/key /etc/italic/keys/public/teacher/

ps7 這是用drbl-cp-host 指令把單一檔案放到所有client的作法!(這樣確保client不是老師),我常是在client(學生機)啟動master會失敗!所以這樣可以保只有老師有權限控制螢幕了!

8. 確認client的使用階段有看到italc

9. 在老師電腦操作italc, 加入學生電腦等…

10. Enjoy DRBL+iTALC !!

以上,是三天前的記憶,有錯誤的可能!

Tags: ,
Mar-22-10

disable dhcp_client_id in gpxe

posted by Thomas

gpxe 預設會送出 client_id ,這個小小的動作與PXE不相容(因為大部份PXE都不會送出)。這樣的結果會造成DHCP Serevr 送不同的IP給同一台主機(再瑣MAC address以前),第一次gpxe要一個,之後應該是initram裏面又要一次,兩次不一樣,所以拿到不一樣的IP(大概是這樣啦),解決方式應該是要從 DHCP Server 下手,如果真的是同一台就嘗試給一個固定的 IP,另外,gpxe也不應該送dhcp_client_id。

小小 hack 一下,把 gpxe 預設送出 client_id 的動作,改由可以透過其他方式決定(#ifdef XXX),所以使用者只要連上config的網頁,從網頁的configuration,”Customize image configuration options”
接著Uncheck
SEND_DHCP_CLIENT_ID
Add DHCP client identifier. Required for Infiniband, and doesn’t hurt
other link layers.

產生出來的image預設就不會送出client_id

另外,gpxe 預設送出的 client_id 字串通常是
01(protocol):網路卡ID(xx:xx:xx:xx:xx:xx)

過程中學到一些經驗:
抓 dhcp client 封包
tcpdump -i eth1 -vvv -s 0 -n port 67 and port 68 (ref)

DHCP 行為 http://layer3.wordpress.com/2010/01/01/dhcppart1/

以及 程式設計師的堅持 http://etherboot.org/pipermail/gpxe/2010-March/000641.html

結果:http://lab.libthomas.org/gpxe-rom/

Tags: , , ,
Oct-20-09

Ubuntu AoE booting - not finish

posted by Thomas

1. 安裝Ubuntu //建議只用4G大小的硬碟,或是只切到4G以免耗費太多dump的時間
sda1 => /, sda5 => swap

2. apt-get install aoetools

3. modprobe aoe //測試看看aoe module,用 lsmod 檢查看看

4. whereis aoe-discovery //測試看看aoe-discovery 有沒有在/sbin/

5. wget http://www.libthomas.org/~thomas/wp/wp-content/uploads/2009/10/hooks-aoetools -O
/etc/initramfs-tools/hooks/aoetools

6. wget http://www.libthomas.org/~thomas/wp/wp-content/uploads/2009/10/scripts_local-top_aoetools -O /etc/initramfs-tools/scripts/local-top/aoetools

7. sudo find /etc/initramfs-tools -name aoetools -exec chmod u+x ‘{}’ \;

9. vi /etc/initramfs-tools/initramfs.conf //預設應該是這樣 BUSYBOX=y

10. update-initramfs -u -k all //會產生新的initrd在/boot

11. vi /etc/fstab
#把類似這樣的代號/dev/sda1 換成 AoE 的代號 /dev/etherd/e[x].[y]p[z] //[x].[y]
代表硬碟 [p]代表磁區
/dev/etherd/e0.0p1 表示第0.0硬碟的第一個partition
ex:
/dev/etherd/e0.0p1 / ext3 realtime,eooros=remount-r 0 1

原先的fstab

修改過後的fstab

12. vi /boot/grub/menu.lst
kernel ……root=/dev/ethered/e0.0p1

A. DRBL伺服器就緒後,在DRBL伺服器上執行”/opt/drbl/sbin/dcs”,選擇”remote-linux-txt”。然後將T機器當作DRBL的用戶端,把它經由PXE來開機進入DRBL的用戶端命令列。

13. 在Client機器登入成root (如果你的root沒有設定密碼的話,你無法登入該主機,可以先在DRBL伺服器上執行”/opt/drbl/sbin/drbl-client-root-passwd”來設定用戶端root的密碼後再來在Client機器登入。)

14. 執行”/etc/init.d/mkswapfile stop”來停止使用swap以免有任何分割區被掛載住。

15. 在Client機器上執行”/opt/drbl/sbin/drbl-aoe-img-dump -x”,然後選擇要複製到伺服器的硬碟,再來就是輸入印象檔名稱。這個命令會將T機器裏面的硬碟的第一個分割區以及MBR,分割區表等資訊在伺服器的 /home/sanboot-img/裡存成一個類似這樣的檔名”winaoe.aoe-0-0-for-00-50-56-02-01-09″(如果你輸入的印象檔名稱是winaoe)。此時會等待一段時間。完成後,建議把這個印象檔備份,這樣萬一不小心攪亂這個印象檔的時候,不用重新再安裝MS Windows以及再dump一次,可以直接把備份的檔案複製回來即可。註:這裡我們檔名的格式: [name].aoe-[shelf no]-[slot no]-for-[client MAC address]
# DRBL-Server 需要對應AoE代號
在 img-dump 之後,可以在 /home/sanboot-img/找到剛剛 dump 的資料
ex: Ubuntu.aoe-0.0-for-00-0c-29-f8-01-ac //格式 Name.aoe-x.y-for-$mac
注意這邊的 x,y 必須要與 fstab, menu.lst 中的硬碟代號一致!

B. 然後在DRBL伺服器上,登入成root,然後執行”/opt/drbl/sbin/drbl-aoe-serv start”。這樣所有的設定應該已經完成。
# 啟動 AoE Server /opt/drbl/sbin/drbl-aor-serv [start|restart|stop]

C. 確認
ps aux | grep vblade
grep aoe /tftpboot/nbi_img/pxelinux.cfg/$mac
xxxx: append aoe:e0.0

16. client 網路開機
預設應該是 Diskless client (AoE booting)
# 如果不要使用這個AoE服務的話,可以執行”/opt/drbl/sbin/drbl-aoe-serv stop”來停止。

Tags: , , ,
Oct-14-09

FreeBSD Backup

posted by Thomas

環境介紹:kFreeBSD(與FreeBSD幾乎一樣)
Hardisk:建立兩個slice, 各自再兩個label
da0
da0s1
da0s1a / ufs2
da0s1b swap
da0s2
da0s2d /home
da0s2e /usr

mapping 到 linux kernel
da0 –> sda
da0s1 –> sda1 <bsd: sda5 sda6> // 暫時想像成延伸分割區吧
da0s1a / ufs2 –> sda5
da0s1b swap –> sda6
da0s2 –> sda2 <bsd: sda7 sda8>
da0s2d /home –> sda7
da0s2e /usr –> sda8

先用 Clonezilla 開機,進入shell模式,手動下指令:
raw backup:
dd if=/dev/sda of=mbr.dd bs=512 count=1
dd if=/dev/sda1 of=slice1-table.dd bs=512 count=16
dd if=/dev/sda2 of=slice2-table.dd bs=512 count=16
partclone.ufs -d -c -s /dev/sda5 -o sda5.ptl.img
partclone.ufs -d -c -s /dev/sda7 -o sda7.ptl.img
partclone.ufs -d -c -s /dev/sda8 -o sda8.ptl.img

restore:
dd if=mbr.dd of=/dev/sda
dd if=slice1-table.dd of=/dev/sda1
dd if=slice2-table.dd of=/dev/sda2
partclone.ufs -d -r -s sda5.ptl.img  -o /dev/sda5
partclone.ufs -d -r -s sda7.ptl.img  -o /dev/sda7
partclone.ufs -d -r -s sda8.ptl.img  -o /dev/sda8

直接pipe資料到新的硬碟:
dd if=/dev/sda of=/dev/sdb bs=512 count=1
partprobe /dev/sdb
dd if=/dev/sda1 of=/dev/sdb1 bs=512 count=16
dd if=/dev/sda2 of=/dev/sdb2 bs=512 count=16
reboot
partclone.ufs -d -b -s /dev/sda5 -o /dev/sdb5
partclone.ufs -d -b -s /dev/sda7 -o /dev/sdb7
partclone.ufs -d -b -s /dev/sda8 -o /dev/sdb8
remove sda, update sdb to first hard disk
boot…

other notes:
* 可以考慮備份硬碟前 0-62 這區段的sector, 雖然不確定是做什麼的?
* BSD建立partition 一律在尾端保留約 2678 個 sector,是否要備份?

* 為什麼slice 是 sda1的前16個sector
http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?bsdlabel+8
The offset of the start of the partition from the beginning of
the drive in sectors, or * to have bsdlabel calculate the correct
offset to use (the end of the previous partition plus one, ignor-
ing partition `c’).  For partition `c’, * will be interpreted as
an offset of 0.  The first partition should start at offset 16,
because the first 16 sectors are reserved for metadata.

* mount ufs2
mount -r -t ufs -o ufstype=ufs2 /dev/sda5 /mnt

* 判斷UFS partition

debian:~# dmesg | grep hda
[    3.440093] hda: VMware Virtual IDE Hard Drive, ATA DISK drive
[    4.112099] hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
[    4.112207] hda: UDMA/33 mode selected
[    5.208450] hda: max request size: 128KiB
[    5.208654] hda: 16777216 sectors (8589 MB) w/32KiB Cache, CHS=17753/15/63
[    5.208858]  hda: hda1
[    5.229445]  hda1: <bsd: hda5 hda6 >

————— check hda —————

debian:~# disktype /dev/hda

— /dev/hda
Block device, size 8 GiB (8589934592 bytes)
DOS/MBR partition map
Partition 1: 8.000 GiB (8589579264 bytes, 16776522 sectors from 63, bootable)
Type 0xA5 (FreeBSD)
FreeBSD boot loader (i386 boot1 at sector 0)
BSD disklabel (at sector 1), 8 partitions
Partition a: 7.500 GiB (8052708352 bytes, 15727946 sectors from 1048639)
Type 7 (4.2BSD fast file system)
UFS2 file system, 64 KiB offset, little-endian
Last mounted at “/”
Partition b: 512 MiB (536870912 bytes, 1048576 sectors from 63)
Type 1 (swap)
Includes the disklabel and boot code
UFS2 file system, 64 KiB offset, little-endian
Last mounted at “/”
Partition c: 8.000 GiB (8589579264 bytes, 16776522 sectors from 63)
Type 0 (Unused)

————— check hda5 —————

debian:~# disktype /dev/hda5

— /dev/hda5
Block device, size 7.500 GiB (8052708352 bytes)
UFS2 file system, 64 KiB offset, little-endian
Last mounted at “/”

Aug-25-09

8月參加 OpenSourceWorld09

posted by Thomas

因為 Clonezilla 上了 .org zone,也就是會議單位提供場地給我們,根據往年經驗就是與一般參展廠商的基本booth差不多,因此我們的想像是一張桌子、兩張椅子、一個背面的面版、大約1.5坪的場地;當我們今年實際再造訪時有點傻眼,基本上有很大的變化,如 .org zone 變成圓桌+椅子,整個場地縮水1/3;此外好處是不用錢、有啤酒喝、可以參加會議,所以,其實還是相當不錯的。

這次集合3個主題:OpenSource、NGDC、CloudWorld等,各有些會議可以聽,我跑去聽了一些OpenSource的會議,例如AoE的、資料庫的,真的不多,因為我都想睡覺,不知道為啥精神不好。

在展覽區,因為同事對DMTF頗感興趣,有過去閒聊拿了些資料,SunCloud一直也有不少人潮,Ubuntu、FreeBSD也不少人過去聊天,另外有拿到一張叫我辦信用卡的,Linux or FreeBSD 的信用卡,還挺有趣的。

整個過程其實還不錯,但是沒有LSM來的有料,但是LSM比較可惜的是太多會議室用法文;而這邊用英文卻沒有什麼料…