Total Pageviews

Wednesday 18 January 2012

OpenBSD系统之多功能启动U盘制作

0. 将以下文件刻录光盘,然后安装OpenBSD操作系统到U盘,懂PXE安装则可节约一张光盘。
http://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/install48.iso
安装方法参考 http://www.openbsd.org/faq/faq14.html#flashmemLive

1.
http://www.openbsd.org/faq/faq1.html#WhatsNew
1.9 - What is new in OpenBSD 4.8?
diskmap(4) interface
People using USB attached storage or softraid(4) configurations often had difficulty with drive identifiers changing from boot to boot, or between hardware configurations. diskmap(4) allows you to mount drives by unique disklabel UIDs rather than how they are attached, so now you can use the same /etc/fstab on your USB flash disk without worrying whether it would come up as sd0, sd1, sd2, etc.

也就是说,OpenBSD 4.8后面的版本,把系统安装在U盘上,通过修改/etc/fstab添加duid参数后此U盘插入任何计算机都不必担心磁盘识别顺序不同而造成无法正常启动。
例如,一个4G的U盘默认安装OpenBSD之后/etc/fstab文件如下
/dev/sd0a / ffs rw 1 1
/dev/sd0e /home ffs rw,nodev,nosuid 1 2
/dev/sd0d /usr ffs rw,nodev 1 2

# disklabel sd0 | grep duid
得知此磁盘duid: 024b5061fc294e12
更改fstab文件如下(顺便添加Soft updates参数“softdep”提高读写速度)
024b5061fc294e12.a / ffs rw,softdep 1 1
024b5061fc294e12.e /home ffs rw,softdep,nodev,nosuid 1 2
024b5061fc294e12.d /usr ffs rw,softdep,nodev 1 2

2. - Flash memory as bootable storage (官方原始说明)
http://www.openbsd.org/faq/faq14.html#flashmemLive
其他实用操作如下,
1) 在多核CPU电脑上安装系统之后,将内核更换为单CPU版本提高此U盘适应性
# mv /bsd /bsd.mp && mv /bsd.sp /bsd && reboot

2) 大多电脑BIOS时间一般是local time本地时间如北京时间+8,若安装系统是选择的时区是PRC,按以下方式修改可让OpenBSD不必date调整时间
# config -ef /bsd
ukc> timezone -480  
ukc> quit
参考 http://www.openbsd.org/faq/faq8.html#TimeZone
- Why is my clock off by several hours?

3) 添加多几个hostname.if提高此U盘适应性
#cp /etc/hostname.em0 /etc/hostname.fxp0
#cp /etc/hostname.em0 /etc/hostname.re0
#cp /etc/hostname.em0 /etc/hostname.rl0
#cp /etc/hostname.em0 /etc/hostname.bge0
解释 Different target machines will likely have different NICs. You could create a bunch of hostname.if(5) files in /etc, each containing just dhcp, for all the NICs you are likely to encounter (fxp0, re0, rl0, bge0, bnx0, em0, etc.) on USB-bootable machines, plus maybe sample wireless config files as well. OpenBSD will ignore all hostname.if(5) files for devices not present at boot time.

3. 把u盘变成移动mp3系统方法
1) 安装OpenBSD系统之前fdisk给U盘分配部分fat空间,
2) 安装OpenBSD到u盘剩余空间里面去,并安装mpg123这个port
3) 在Windows系统里面快速格式化之前分配的fat空间,将mp3文件copy到u盘里面去,歌曲名只能是英文或数字哦
4) 此U盘在任意计算机都可以启动mpg123播放mp3了,因为OpenBSD支持很多声卡
参考  Custom fdisk layout  http://www.openbsd.org/faq/faq4.html


4. Offline NT Password & Registry Editor破解Windows操作系统登录密码
http://www.openbsd.org/plus.html   says:Activated NTFS in i386 and amd64 GENERIC kernels.
也就是说,OpenBSD snapshot或将来的4.9 release默认安装都可以直接mount_ntfs挂载ntfs分区
若U盘安装OpenBSD系统,再安装ports/security/chntpw  (Offline NT Password & Registry Editor),用此U盘来破解Windows操作系统登录密码会很方便哦
操作例子
# disklabel wd0  显示部分信息如下
#             size           offset  fstype [fsize bsize  cpg]
  c:        976773168                0  unused
  i:        157581522               63    NTFS
  j:        819186417        157581648    NTFS
估计i分区应该是Windows系统盘
# mount_ntfs -o rw /dev/wd0i /mnt
# cd /mnt/WINDOWS/system32/config/
# chntpw -i SAM
根据交互模式提示完成操作即可修改密码


5. 用U盘启动系统并共享硬盘里面的数据给局域网电脑访问
假定U盘系统ip是10.0.0.154,且已经创建一个专门用于访问共享目录的用户share
mount_ntfs /dev/wd0j /home/share/d
此后在另外一台电脑通过Fizilla(默认utf-8)访问sftp://share@10.0.0.154/d 就可以copy里面的数据
mount_ntfs -o rw不支持write,chntpw除外,详情man mount_ntfs

No comments:

Post a Comment