OpenBSD多功能启动U盘制作

OpenBSD的安装、升级、更新等日常问题。

版主: chenjun天地乾坤

回复
f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

OpenBSD多功能启动U盘制作

帖子 f5b » 2011-11-22 21:00

把之前发布在chinaunix的文章修改一下,保存到这里:)

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

2. 一个4G以上U盘,可以把0分区弄成fat32分区(0B),1分区弄成OpenBSD分区(A6),一般OpenBSD分区2G够用。
参考http://www.openbsd.org/faq/faq14.html#flashmemBoot
fdisk操作过程看http://www.openbsd.org/faq/faq4.html
4.6.3 - Custom fdisk(8) layout
注意,做完fdisk操作用quit才会保存退出,exit不保存返回!

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

# mv bsd bsd.mp && mv bsd.sp bsd

2) Windows系统的主机BIOS时间就是本地时间(local time如北京时间+8),所以,把OpenBSD安装到U盘过程中选择时区+8(PRC)且没让立即同步网络时间(ntpd),之后按以下方法修改可让同一台主机的OpenBSD(U盘)和

Windows(硬盘)显示时间兼容。
# 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
#cp /etc/hostname.em0 /etc/hostname.bce0
#cp /etc/hostname.em0 /etc/hostname.bnx0
解释 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.


4)更改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

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


5. Offline NT Password & Registry Editor破解Windows操作系统登录密码
OpenBSd 4.9 之后默认安装都可以直接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
根据交互模式提示完成操作即可修改密码

6. 安装sshguard防护ssh暴力攻击和share特殊用户设置
创建一个专门用于访问共享目录的用户share,用户shell是nologin
vi /etc/ssh/sshd_config
+MaxAuthTries 3
+UseDNS no #局域网使用可提高登陆速度
#share用户的特殊设置
Match User share
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
ChrootDirectory /home/share/

之后运行 kill -HUP `cat /var/run/sshd.pid` 让sshd重新读取config文件

7. 用U盘启动系统并共享硬盘里面的数据给局域网电脑访问
假定U盘系统ip是10.0.0.154,
chown root:wheel /home/share/
mkdir -p /home/share/upload
chown share /home/share/upload/ #share用户可上传文件到upload目录

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

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: OpenBSD多功能启动U盘制作

帖子 leo » 2011-11-22 23:10

属于精华贴,:)。

f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

回复: OpenBSD多功能启动U盘制作

帖子 f5b » 2011-11-23 9:05

thanks

f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

回复: OpenBSD多功能启动U盘制作

帖子 f5b » 2011-11-26 16:57

f5b 写了:
4)更改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
softdep后面还可以添加noatime参数,也能减少u盘活动,提高性能和减少损耗。

详情请 man mount

chang
钛 Ti
帖子: 26
注册时间: 2011-03-17 9:10

回复: OpenBSD多功能启动U盘制作

帖子 chang » 2012-02-09 10:01

回去有机会尝试一下

f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

回复: OpenBSD多功能启动U盘制作

帖子 f5b » 2012-02-25 21:38

这两天用启动u盘顺手收集了几款电脑的dmesg和sysctl hw.sensors发送给了dmesg@openbsd.org,希望有助益。

详情情看
http://www.openbsd.org/faq/faq4.html#SendDmesg
Just to remind people, it's important for the OpenBSD developers to keep track of what hardware works, and what hardware doesn't work perfectly, including the hardware sensors that are found in machines.
A quote from /usr/src/etc/root/root.mail
[INDENT]If you wish to ensure that OpenBSD runs better on your machines, please do us a favor (after you have your mail system configured!) and type something like: # (dmesg; sysctl hw.sensors) | \ mail -s "Sony VAIO 505R laptop, apm works OK" dmesg@openbsd.org so that we can see what kinds of configurations people are running. As shown, including a bit of information about your machine in the subject or the body can help us even further. We will use this information to improve device driver support in future releases. (Please do this using the supplied GENERIC kernel, not for a custom compiled kernel, unless you're unable to boot the GENERIC kernel. If you have a multi-processor machine, dmesg results of both GENERIC.MP and GENERIC kernels are appreciated.) The device driver information we get from this helps us fix existing drivers. Thank you! [/INDENT] Make sure you send email from an account that is able to also receive email so developers can contact you if they have something they want you to test or change in order to get your setup working. It's not important at all to send the email from the same machine that is running OpenBSD, so if that machine is unable to receive email, just
$ (dmesg; sysctl hw.sensors) | mail your-account@yourmail.dom and then forward that message to dmesg@openbsd.org where your-account@yourmail.dom is your regular email account.

xjw8025
铝 Al
帖子: 12
注册时间: 2010-10-04 20:12

回复: OpenBSD多功能启动U盘制作

帖子 xjw8025 » 2012-04-12 21:24

楼上谁知道怎么做u盘安装openbsd 的

目前根据官方资料 已经实现u盘启动系统 但是到了最后一步 出问题 提示没有找到 openbsd sets

有成功的 麻烦指点一下

f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

回复: OpenBSD多功能启动U盘制作

帖子 f5b » 2012-04-13 10:09

xjw8025 写了:楼上谁知道怎么做u盘安装openbsd 的

目前根据官方资料 已经实现u盘启动系统 但是到了最后一步 出问题 提示没有找到 openbsd sets

有成功的 麻烦指点一下

启动系统和安装系统是两码事,请确定你已经仔细阅读并理解了
http://www.openbsd.org/faq/faq4.html
Installation Guide 的全部内容

特别指出
正常的系统启动是引导bsd或bsd.mp文件
安装系统必须引导bsd.rd


由于你没有详细描述你做了什么,在那个地方出错,这里不好回答。
仅能猜测,在系统提示
Location of sets? (cd disk ftp http or 'done')
你选择了什么?后面如何操作?

xjw8025
铝 Al
帖子: 12
注册时间: 2010-10-04 20:12

回复: OpenBSD多功能启动U盘制作

帖子 xjw8025 » 2012-04-13 23:08

Location of sets? (disk ftp http or 'done') 后选disk 提示 found no openbsd 5.0 sets

xjw8025
铝 Al
帖子: 12
注册时间: 2010-10-04 20:12

回复: OpenBSD多功能启动U盘制作

帖子 xjw8025 » 2012-04-13 23:10

基本上可以断定根本就是bug 但是可以到 5.0/i386里面的软件包

xjw8025
铝 Al
帖子: 12
注册时间: 2010-10-04 20:12

回复: OpenBSD多功能启动U盘制作

帖子 xjw8025 » 2012-04-13 23:13

found no openbsd 5.0 sets the set names looked for were就这句提示 没有了

f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

回复: OpenBSD多功能启动U盘制作

帖子 f5b » 2012-04-14 12:25

xjw8025 写了:Location of sets? (disk ftp http or 'done') 后选disk 提示 found no openbsd 5.0 sets

选disk之后马上就是found no openbsd 5.0 sets?

选disk之后应该提示选择硬盘,然后选择/输入文件所在分区(需要mount),再输入具体目录,如果没有找到,才提示吧。

f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

回复: OpenBSD多功能启动U盘制作

帖子 f5b » 2012-04-14 12:30

一般通过光盘启动,把系统安装到u盘之后,在u盘/home/OpenBSD/5.0/i386/ 目录放上安装文件(bsd/etc50.tgz等)

以后通过u盘启动bsd.rd,安装过程选择正确的目标盘(硬盘),选择正确的安装源(u盘),mount正确的分区,找到具体目录的安装文件,就可以了。

如果找到bug,恭喜你,你发现了很多人多年都没有发现的bug.

cws
钾 K
帖子: 14
注册时间: 2014-02-08 0:28

Re: 回复: OpenBSD多功能启动U盘制作

帖子 cws » 2014-02-17 12:52

f5b 写了:一般通过光盘启动,把系统安装到u盘之后,在u盘/home/OpenBSD/5.0/i386/ 目录放上安装文件(bsd/etc50.tgz等)

以后通过u盘启动bsd.rd,安装过程选择正确的目标盘(硬盘),选择正确的安装源(u盘),mount正确的分区,找到具体目录的安装文件,就可以了。

如果找到bug,恭喜你,你发现了很多人多年都没有发现的bug.
求教:网络安装时如何拨号上网,不知在哪里输入宽带账号和密码
缺乏人性化的东西都不是好东西

f5b
锆 Zr
帖子: 642
注册时间: 2011-10-22 20:43

Re: 回复: OpenBSD多功能启动U盘制作

帖子 f5b » 2014-02-17 22:03

cws 写了:
f5b 写了:一般通过光盘启动,把系统安装到u盘之后,在u盘/home/OpenBSD/5.0/i386/ 目录放上安装文件(bsd/etc50.tgz等)

以后通过u盘启动bsd.rd,安装过程选择正确的目标盘(硬盘),选择正确的安装源(u盘),mount正确的分区,找到具体目录的安装文件,就可以了。

如果找到bug,恭喜你,你发现了很多人多年都没有发现的bug.
求教:网络安装时如何拨号上网,不知在哪里输入宽带账号和密码

网络安装中好像无法拨号上网的,安装过程中输入!进入shell模式或许可以做拨号操作(本人未测试)

新手还是建议先下载iso的完整光盘镜像,刻录光盘来安装吧。

cws
钾 K
帖子: 14
注册时间: 2014-02-08 0:28

Re: OpenBSD多功能启动U盘制作

帖子 cws » 2014-02-19 19:41

操作复杂 ,不适合新手
缺乏人性化的东西都不是好东西

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 15 访客