Archive for the ‘科技’ Category

淘宝颠覆了传统购物观啊。。。

星期三, 十月 21st, 2009

刚才收下了淘宝上发来的一套货。

AMD Athlon x3 425三核CPU + 技嘉785GMPT主板 + DDR3内存。虽然身边有中关村和百脑汇但是这套货却是从千里之外的杭州运了过来地。

图什么?

图一个字——正!三件货物均为中国代理行货,网上查询均为正品。难得啊……

北京中关村和百脑汇的生存哲学是“坑蒙拐骗偷”。上一台机器是魔兽年在村里买的,盒装Intel P4,怎料用了半年后一进EVE就重启,后发现散热器的塑料脚断了,散热器与CPU有间隙,细查发现原来风扇是假的,原来盒子也是假的。后来才看到有人写攻略,说原装盒子上的激光标是双材质印刷的,再看我的,是两张拼起来的……另一次是图运费便宜,在淘宝中关村卖家哪里买PC电源,一开盒就怒了,以低档货冒充,质问之下说是装错了,随后再问又说没货了,信口雌黄。

后来此类物资一律从上海卖家手里拿。要得就是货真价实。此次在这家店买了核心三宝,看中的就是这家店出货两万件,均为好评。在中国,最容易丢的就是信誉。

淘宝,在一个没有诚信的社会,愣是创出了一个依靠诚信可以致富的另类网上社会,颠覆啊……

这不,刚看了这个更颠覆,如有牺牲,包退款……

dzx

Generics Table 的使用

星期二, 十二月 16th, 2008

前一阵子死活搞不定Sendmail的Genericstable,只好扔下一段时间。
今天有空,系统地看了一下文档才发现是被网上的一些所谓的教材给骗了,一个基本的文件错误导致了死活配置不成功。

这个文件就是,genericstable。

正确的文件如下:

www GameDev@targetdomain.com
copycat GameDev@targetdomain.com

是用空格或table来区分的,而错误的教材使用copycat: xxx@xxx格式,看起来满是回事,HASH也不报错,却无论如何也配置不成功。

FEATURE(`genericstable')dnl
FEATURE(masquerade_envelope)dnl
GENERICS_DOMAIN(`targetdomain.com')

注意最后一行应该是要伪装成为的domain。
不知为何在Freebsd下并不需要mc里特别写一句去生产hash的genericstable.db,系统在make的时候会自动去做这件事。

特别感谢这个正确的教材:http://www.madboa.com/geek/sendmail-genericstable/

RHEL手工安装JSON

星期一, 十一月 17th, 2008

Red Hat Enterprise Linux的标配PHP版本是5.1.x,而JSON是在5.2被引入到core里面去的。
升级5.2固然是个办法,但是发布版的二进制环境是相对稳定的,本着能懒就懒,能不升级就不升级的原则,决定手工安装。

先编译出json.so

wget http://www.aurore.net/projects/php-json/php-json-ext-1.2.0.tar.bz2
bzip2 -d php-json-ext-1.2.0.tar.bz2
tar xf php-json-ext-1.2.0.tar
cd php-json-ext-1.2.0
phpize
./configuremake

然后找到机器上的php .so目录,因为i386和64系统是不一样的。
locate mysql.so

然后把json.so 拷贝过去。
修改php.ini,加一句。
extension=json.so

最后重新启动httpd.
service httpd restart

byebye了,freebsd

星期三, 十月 8th, 2008

在一台当今硬件水准的Server上安装FreeBSD简直是折磨。

网卡、ACPI各种零件都不认。
软件还好,不过JAVA等内容缺乏官方支持,还都是Linux Compatible模式运行的。
的确,FreeBSD在某些方面领先了许多年,但是现在风光难现了,企业级的应用清一色的在Linux纸上。
ACPI挂起……
Page Fault 12……
NIC不能识别,必须手工改……
在这次FreeBSD浪费了我2天的时间之后,我毅然决然更换了系统。
Red Hat Enterprise Linux在短短几十分钟之内搞定了设备HP崭新的DL-160。
现实是残酷的,GNU的力量不可逆转的,88了FreeBSD。

vi全局替换命令(转)

星期四, 八月 28th, 2008

语法为 :[addr]s/源字符串/目的字符串/[option]

全局替换命令为::%s/源字符串/目的字符串/g

[addr] 表示检索范围,省略时表示当前行。

如:“1,20” :表示从第1行到20行;

“%” :表示整个文件,同“1,$”;

“. ,$” :从当前行到文件尾;

s : 表示替换操作

[option] : 表示操作类型

如:g 表示全局替换;

c 表示进行确认

p 表示替代结果逐行显示(Ctrl + L恢复屏幕);

省略option时仅对每行第一个匹配串进行替换;

如果在源字符串和目的字符串中出现特殊字符,需要用”\”转义

下面是一些例子:

#将That or this 换成 This or that
:%s/\(That\) or \(this\)/\u\2 or \l\1/
—-
#将句尾的child换成children
:%s/child\([ ,.;!:?]\)/children\1/g
—-
#将mgi/r/abox换成mgi/r/asquare
:g/mg\([ira]\)box/s//mg//my\1square/g    <=> :g/mg[ira]box/s/box/square/g
—-
#将多个空格换成一个空格
:%s/ */ /g
—-
#使用空格替换句号或者冒号后面的一个或者多个空格
:%s/\([:.]\) */\1 /g
—-
#删除所有空行
:g/^$/d
—-
#删除所有的空白行和空行
:g/^[ ][ ]*$/d
—-
#在每行的开始插入两个空白
:%s/^/> /
—-
#在接下来的6行末尾加入.
:.,5/$/./
—-
#颠倒文件的行序
:g/.*/m0O <=> :g/^/m0O
—-
#寻找不是数字的开始行,并将其移到文件尾部
:g!/^[0-9]/m$ <=> g/^[^0-9]/m$
—-
#将文件的第12到17行内容复制10词放到当前文件的尾部
:1,10g/^/12,17t$
~~~~重复次数的作用
—-
#将chapter开始行下面的第二行的内容写道begin文件中
:g/^chapter/.+2w>>begin
—-
:/^part2/,/^part3/g/^chapter/.+2w>>begin
—-
:/^part2/,/^part3/g/^chapter/.+2w>>begin|+t$

SVN + apache + mysql认证

星期一, 八月 25th, 2008

为了让svn能够利用apache2模块启动,所以需要在apache中加入
mod_dav

另外,为了实现数据库认证,还需要增加两个模块给apache2:

LoadModule authn_dbd_module  libexec/apache22/mod_authn_dbd.so
LoadModule dbd_module  libexec/apache22/mod_dbd.so

OK
搞定了apache之后,开始编译svn的port。只需要mod_dav和apache_apr两个模块就行了。

之后的在 ..../etc/apache22/Include目录下添加svn.conf

# mod_dbd configuration DBDriver mysql DBDParams "host=localhost user=xxx pass=xxx dbname=xxx" DBDMin  4 DBDKeep 8 DBDMax  20 DBDExptime 300 <Location /internal>   DAV svn   SVNPath /var/svn/internal   AuthType Basic   AuthName "Internal SVN"   AuthBasicProvider dbd   # core authorization configuration   Require valid-user   AuthDBDUserPWQuery \     "SELECT password FROM user WHERE  email = %s" #  AuthUserFile /var/svn/etc/svn-auth-file   AuthzSVNAccessFile /var/svn/etc/internal-access-file   Require valid-user </Location>
接下来,就是数据库了,无论你怎么搞数据库关键在于那句select,没错,apache需要自己独特的password加密方案,这就是php语句的:
'{SHA}' . base64_encode(sha1($password, TRUE))

等你搞定了数据库之后,一切都可以工作了。

FreeBSD 从零开始

星期四, 七月 3rd, 2008

FreeBSD这个东西属于配置一次一年不用管的东西,所以时间长了难免忘东忘西,这里记录下FreeBSD从零开始变成强悍Server的过程。 如果要用GNOME 之类的发行包的话还是Burn a DVD 最省心。 零七八碎的文件散落在4张CD上,如果你烧录一张DVD的话,生活就会简单很多

启动IPF防火墙
一个典型的IPF配置

#== default block
block in quick on rl0 from 192.168.0.0/16 to any
block in quick on rl0 from 172.16.0.0/12 to any
block in quick on rl0 from 10.0.0.0/8 to any
block in quick on rl0 from 127.0.0.0/8 to any
block in quick on rl0 from 0.0.0.0/8 to any
block in quick on rl0 from 169.254.0.0/16 to any
#== TCP
block in on rl0 proto tcp from any to any
block out on rl0 proto tcp from any to any
#service
pass in quick on rl0 proto tcp from any to any port=80 keep state
pass in quick on rl0 proto tcp from any to any port=443 keep state
#client
pass out quick on rl0 proto tcp from any to any port=20 keep state
pass out quick on rl0 proto tcp from any to any port=21 keep state
pass out quick on rl0 proto tcp from any to any port=80 keep state
pass out quick on rl0 proto tcp from any to any port=443 keep state
pass out quick on rl0 proto tcp from any to any port=5999 keep state #for cvsup/csup

###UDP
block in on rl0 proto udp all
block out on rl0 proto udp all
pass out quick on rl0 proto udp from any to any port=53 keep state

配置网络
如果是DHCP的话直接写ifconfig_xxx = "DHCP" 就可以了。

安装mysql
cd /usr/ports/databases/mysql51-server/
make
记得要在rc.conf中增加mysql_enable="YES",否则手工启动脚本也会没反应。

安装PHP
如果你打算用apache联php的话,还是不要使用sysinstall安装了,那样安装的结果是没有libphp5.so。老老实实去/usr/ports/lang/php5 下去make,记得带上apache22的选项。然后把下面的语句添加到合适的地方。
AddType application/x-httpd-php .php

AddType application/x-httpd-source .phps

书写PHP
奇怪的是,PHP似乎并不能自动使用UTF-8方式连接数据库,所以要在PHP中加入以下几句:
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER_SET_CLIENT=utf8");
mysql_query("SET CHARACTER_SET_RESULTS=utf8");


安装Apache

Apache可以使用sysinstall从DVD直接安装。
在/boot/loader.conf中可以增加accf_http_load="YES",这个accf的功能:function is to buffer incoming connections until a certain complete HTTP requests arrive.
具体见Http://www.mydigitallife.info/2006/04/23/freebsd-apache-http-accept-filter-error/

启用ftp & ssh
ftpd & ssh是inetd的一部分,所以需要配置和启用inetd

ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l一行的#号去掉。

正确处理DHCP和resov.conf的关系
在/etc/dhclient.conf中加入
static dns:
interface "vr0"{
prepend domain-name-services xx.xx.xx.xx, x.x.x.x;
}

Color
$ export TERM=xterm

$ alias ls=’ls –G’

万一
万一你的网络在某个内网里,只能用proxy的话:
不要相信 export HTTP_PROXY=ip:port 可以确保你的make时引发的fetch能正确执行。那个是骗小孩的~~

躲在防火墙后
csh下设定Proxy的环境变量:
setenv http_proxy 192.168.14.1:8080
setenv ftp_proxy 192.168.14.1:8080
bash下:
export http_proxy=proxyserver:port
export ftp_proxy=proxyserver:port

使用WGET获取ports
上面设定好之后,让我们替换掉FreeBSD中最白痴的一个工具fetch,这个东西在配置了ftp_proxy甚至不能够穿越HTTP Proxy进行ftp获取操作,为此,我们必须启用wget - 或者更强大的多线程工具。如果你跟我一样在Firewall后面无发下手make wget的话,你可以从其他机器上直接copy一个 wget文件到本地的/usr/local/bin下。

然后在/etc/make.conf中添加如下文字,如果没有这个文件就手工建立:
FETCH_BINARY=/usr/local/bin/wget
FETCH_ARGS=-nc
DISABLE_SIZE=yes
DISABLE_SIZE必须设上,否则一个只有fetch才能解释的arg就跑到wget头上去了。
-nc是强制覆盖,必须设上,否则wget会不停的在后面增加.1 .2 .3 .4。


前面之所以要强调在环境里写是因为在网络上充斥这这样的白痴赋值写法:

FETCH_ENV=http_proxy=http://proxy2.zsu.edu.cn:3128FETCH_ENV=ftp_proxy=http://proxy2.zsu.edu.cn:3128这是错误的,只要有一点赋值的概念就知道为什么错了。。。

JDK从安装复杂度到使用程度来说,装Diablo-jdk15之类的东西要远比jdk16要省心,要安全。

SUN-WTKvery few people come to this far,however I need this.

First of all you should enable linux binary compatible : kldload linux and you should also put linux_enable="YES" in rc.conf.

And then you should build /usr/ports/emulators/linux_base-fc4, yes perverify required some DLLs. then you should build /usr/ports/x11/linux-xorg-libs, yes preverify1.1 link to X11.

Freebsd下ZIP不可乱用

星期三, 七月 2nd, 2008

如果你使用ZIP去压缩/usr/ports,哪怕是设定了零压缩可需要几个小时。
如果用tar cf 的话,只需要几十秒。

天大的差距啊~~~

用rsync对网站进行镜像备份

星期三, 七月 2nd, 2008

by inburst
http://xfocus.org

对系统管理员来说,平时的工作重心应该集中在维护系统正常运转,能够正常提供服务上,这里往往牵涉到一个数据备份的问题,在我所了解

的情况中,有80%的系统管理员不是太关心自己服务器的安全性,但往往对备分镜像的技术相当感兴趣,但由于商业产品的软硬件价格都相当高

昂,因此往往会选择自由软件。这里准备介绍的rsync就是这样的软件,它可以满足绝大多数要求不是特别高的备份需求。

一、特性简介

rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync。它的特性如下:

1、可以镜像保存整个目录树和文件系统。
2、可以很容易做到保持原来文件的权限、时间、软硬链接等等。
3、无须特殊权限即可安装。
4、优化的流程,文件传输效率高。
5、可以使用rcp、ssh等方式来传输文件,当然也可以通过直接的socket连接。
6、支持匿名传输。

二、使用方法

rsync的使用方法很简单,我就举自己使用的例子来说明吧。

1、系统环境

rsync支持大多数的类unix系统,无论是Linux、Solaris还是BSD上都经过了良好的测试。我的系统环境为:

server: FreeBSD 4.3 ip: 192.168.168.52
client: Solaris 8 ip: 192.168.168.137
rsync 版本 2.4.6(可以从http://rsync.samba.org/rsync/获得最新版本)

2、配置server端的/etc/rsyncd.conf文件

bash-2.03# cat /etc/rsyncd.conf

uid = nobody
gid = nobody
use chroot = no # 不使用chroot
max connections = 4 # 最大连接数为4
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log # 日志记录文件

[inburst] # 这里是认证的模块名,在client端需要指定
path = /home/inburst/python/ # 需要做镜像的目录
comment = BACKUP CLIENT IS SOLARIS 8 E250
ignore errors # 可以忽略一些无关的IO错误
read only = yes # 只读
list = no # 不允许列文件
auth users = inburst # 认证的用户名,如果没有这行,则表明是匿名
secrets file = /etc/inburst.pas # 认证文件名

[web]
path = /usr/local/apache/htdocs/
comment = inburst.org web server

3、在server端生成一个密码文件/etc/inburst.pas

bash-2.03# cat /etc/inburst.pas
inburst:hack

出于安全目的,文件的属性必需是只有属主可读。

4、在server端将rsync以守护进程形式启动

bash-2.03# rsync --daemon

如果要在启动时把服务起来,有几种不同的方法,比如:

a、加入inetd.conf

编辑/etc/services,加入rsync 873/tcp,指定rsync的服务端口是873
编加/etc/inetd.conf,加入rsync stream tcp nowait root /bin/rsync rsync --daemon

b、加入rc.local

在各种操作系统中,rc文件存放位置不尽相同,可以修改使系统启动时rsync --daemon加载进去。

5、从client端进行测试

下面这个命令行中-vzrtopg里的v是verbose,z是压缩,r是recursive,topg都是保持文件原有属性如属主、时间的参数。--progress是指显示

出详细的进度情况,--delete是指如果服务器端删除了这一文件,那么客户端也相应把文件删除,保持真正的一致。后面的inburst@ip中,

inburst是指定密码文件中的用户名,之后的::inburst这一inburst是模块名,也就是在/etc/rsyncd.conf中自定义的名称。最后的/tmp是备份

到本地的目录名。

在这里面,还可以用-e ssh的参数建立起加密的连接。可以用--password-file=/password/path/file来指定密码文件,这样就可以在脚本中使

用而无需交互式地输入验证密码了,这里需要注意的是这份密码文件权限属性要设得只有属主可读。

bash-2.03# rsync -vzrtopg --progress --delete inburst@192.168.168.52::inburst /tmp/
Password:
receiving file list ... done
./
1
785 (100%)
1.py
4086 (100%)
2.py
10680 (100%)
a
0 (100%)
ip
3956 (100%)
./
wrote 190 bytes read 5499 bytes 758.53 bytes/sec
total size is 19507 speedup is 3.43

6、创建更新脚本

如果有比较复杂的工作,利用一些常见的脚本语言可以有帮助。比如:

bash-2.03# cat /usr/local/bin/rsync.sh

#!/bin/sh
DATE=`date +%w`

rsync -vzrtopg --progress --delete inburst@192.168.168.52::inburst /home/quack/backup/$DATE --password-file=/etc/rsync.pass >

/var/log/rsync.$DATE

7、修改/etc/crontab做好定时

比如:

bash-2.03# echo "15 4 * * 6 root rsync.sh">>/etc/crontab

三、FAQ

Q:如何通过ssh进行rsync,而且无须输入密码?
A:可以通过以下几个步骤

1. 通过ssh-keygen在server A上建立SSH keys,不要指定密码,你会在~/.ssh下看到identity和identity.pub文件
2. 在server B上的home目录建立子目录.ssh
3. 将A的identity.pub拷贝到server B上
4. 将identity.pub加到~[user b]/.ssh/authorized_keys
5. 于是server A上的A用户,可通过下面命令以用户B ssh到server B上了
e.g. ssh -l userB serverB
这样就使server A上的用户A就可以ssh以用户B的身份无需密码登陆到server B上了。

Q:如何通过在不危害安全的情况下通过防火墙使用rsync?
A:解答如下:

这通常有两种情况,一种是服务器在防火墙内,一种是服务器在防火墙外。
无论哪种情况,通常还是使用ssh,这时最好新建一个备份用户,并且配置sshd仅允许这个用户通过RSA认证方式进入。
如果服务器在防火墙内,则最好限定客户端的IP地址,拒绝其它所有连接。
如果客户机在防火墙内,则可以简单允许防火墙打开TCP端口22的ssh外发连接就ok了。

Q:我能将更改过或者删除的文件也备份上来吗?
A:当然可以:

你可以使用如:rsync -other -options -backupdir = ./backup-2000-2-13 ...这样的命令来实现。
这样如果源文件:/path/to/some/file.c改变了,那么旧的文件就会被移到./backup-2000-2-13/path/to/some/file.c,这里这个目录需要自己

手工建立起来

Q:我需要在防火墙上开放哪些端口以适应rsync?
A:视情况而定

rsync可以直接通过873端口的tcp连接传文件,也可以通过22端口的ssh来进行文件传递,但你也可以通过下列命令改变它的端口:

rsync --port 8730 otherhost::
或者
rsync -e 'ssh -p 2002' otherhost:

Q:我如何通过rsync只复制目录结构,忽略掉文件呢?
A:rsync -av --include '*/' --exclude '*' source-dir dest-dir

Q:为什么我总会出现"Read-only file system"的错误呢?
A:看看是否忘了设"read only = no"了

Q:为什么我会出现'@ERROR: invalid gid'的错误呢?
A:rsync使用时默认是用uid=nobody;gid=nobody来运行的,如果你的系统不存在nobody组的话,就会出现这样的错误,可以试试gid =

nogroup或者其它

Q:绑定端口873失败是怎么回事?
A:如果你不是以root权限运行这一守护进程的话,因为1024端口以下是特权端口,会出现这样的错误。你可以用--port参数来改变。

Q:为什么我认证失败?
A:从你的命令行看来:

你用的是:
> bash$ rsync -a 144.16.251.213::test test
> Password:
> @ERROR: auth failed on module test
>
> I dont understand this. Can somebody explain as to how to acomplish this.
> All suggestions are welcome.

应该是没有以你的用户名登陆导致的问题,试试rsync -a max@144.16.251.213::test test

四、一些可借鉴的脚本

这里这些脚本都是rsync网站上的例子:

1、每隔七天将数据往中心服务器做增量备份

#!/bin/sh

# This script does personal backups to a rsync backup server. You will end up
# with a 7 day rotating incremental backup. The incrementals will go
# into subdirectories named after the day of the week, and the current
# full backup goes into a directory called "current"
# tridge@linuxcare.com

# directory to backup
BDIR=/home/$USER

# excludes file - this contains a wildcard pattern per line of files to exclude
EXCLUDES=$HOME/cron/excludes

# the name of the backup machine
BSERVER=owl

# your password on the backup server
export RSYNC_PASSWORD=XXXXXX

########################################################################

BACKUPDIR=`date +%A`
OPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES
--delete --backup --backup-dir=/$BACKUPDIR -a"

export PATH=$PATH:/bin:/usr/bin:/usr/local/bin

# the following line clears the last weeks incremental directory
[ -d $HOME/emptydir ] || mkdir $HOME/emptydir
rsync --delete -a $HOME/emptydir/ $BSERVER::$USER/$BACKUPDIR/
rmdir $HOME/emptydir

# now the actual transfer
rsync $OPTS $BDIR $BSERVER::$USER/current

2、备份至一个空闲的硬盘

#!/bin/sh

export PATH=/usr/local/bin:/usr/bin:/bin

LIST="rootfs usr data data2"

for d in $LIST; do
mount /backup/$d
rsync -ax --exclude fstab --delete /$d/ /backup/$d/
umount /backup/$d
done

DAY=`date "+%A"`

rsync -a --delete /usr/local/apache /data2/backups/$DAY
rsync -a --delete /data/solid /data2/backups/$DAY

3、对vger.rutgers.edu的cvs树进行镜像

#!/bin/bash

cd /var/www/cvs/vger/
PATH=/usr/local/bin:/usr/freeware/bin:/usr/bin:/bin

RUN=`lps x | grep rsync | grep -v grep | wc -l`
if [ "$RUN" -gt 0 ]; then
echo already running
exit 1
fi

rsync -az vger.rutgers.edu::cvs/CVSROOT/ChangeLog $HOME/ChangeLog

sum1=`sum $HOME/ChangeLog`
sum2=`sum /var/www/cvs/vger/CVSROOT/ChangeLog`

if [ "$sum1" = "$sum2" ]; then
echo nothing to do
exit 0
fi

rsync -az --delete --force vger.rutgers.edu::cvs/ /var/www/cvs/vger/
exit 0

4、利用find的一种巧妙方式

rsync -avR remote:'`find /home -name "*.[ch]"`' /tmp/

可以用这种方法列出需要备份的文件列表——这种方法似乎比较少人用到。

五、参考资料:

1、http://rsync.samba.org/
2、rsync examples
3、rsync FAQ

Creating Your Own FreeBSD 7.0 DVD

星期三, 七月 2nd, 2008

[http://it.toolbox.com/blogs/bsd-guru/creating-your-own-freebsd-70-dvd-22791]

Dru (SysAdmin, Technical Writer, Technical Trainer) posted 2/28/2008 | Comments (32)

If you're in the FreeBSD world, you've probably already downloaded or csup'd FreeBSD 7.0 or are in the process of doing so now. As yes, after what seemed like waiting forever, the announcement of 7.0 went out last night.

I spent this morning making a DVD ISO of FreeBSD 7.0 to be included in the upcoming BSD magazine. Creating a DVD is easy and my instructions follow.

Start by downloading the following four files from your closest FreeBSD mirror; you'll find these files in the ISO-IMAGES-i386/7.0/ directory:

7.0-RELEASE-i386-disc1.iso
7.0-RELEASE-i386-disc2.iso
7.0-RELEASE-i386-disc3.iso
7.0-RELEASE-i386-docs.iso

Note: all of the mirrors are extremely busy today so you may have to try a few before you find one close to you that has some connections left. I saved mine to the download subdirectory of my home directory. I created a staging area, became the superuser and ran the following commands to mount and untar the contents of the 4 files:

cd ~dru/downloads/dvd-freebsd7/
mdconfig -a -t vnode -f ../7.0-RELEASE-i386-disc1.iso -u 0
mount -t cd9660 /dev/md0 /mnt
tar -C /mnt -cf - . | tar -xf -
umount /mnt

mdconfig -a -t vnode -f ../7.0-RELEASE-i386-disc2.iso -u 1
mount -t cd9660 /dev/md1 /mnt
tar -C /mnt -cf - . | tar -xf -
umount /mnt

mdconfig -a -t vnode -f ../7.0-RELEASE-i386-disc3.iso -u 2
mount -t cd9660 /dev/md2 /mnt
tar -C /mnt -cf - . | tar -xf -
umount /mnt

mdconfig -a -t vnode -f ../7.0-RELEASE-i386-docs.iso -u 3
mount -t cd9660 /dev/md3 /mnt
tar -C /mnt -cf - . | tar -xf -
umount /mnt

Next, use sed or the replace function of your favourite text editor to remove all incidences of ||1 and ||2 and ||3 from the file packages/INDEX.

Add these lines to cdrom.inf:

CD_VOLUME = 0
CD_VOLUME = 1
CD_VOLUME = 2
CD_VOLUME = 3

Then, remove this directory:

rm -Rf rr_moved

or you will get this error when you try to create your DVD:

mkisofs: Error: './rr_moved' and '(NULL POINTER)' have the same Rock Ridge name 'rr_moved'.
mki/usr/home/dlavigne6/sofs: Unable to sort directory
:-( write failed: Input/output error

This command (type all on one line) will burn your DVD on the fly; note that it will NOT save a copy of the ISO to your hard disc:

growisofs -Z /dev/cd0 -J -R -no-emul-boot -b boot/cdboot -iso-level 3 .

To instead create an ISO which you can then burn at your leisure, use this command (typed all on one line):

mkisofs -V FreeBSD7 -J -R -b boot/cdboot -no-emul-boot -o freebsd7.iso .

and to burn the ISO:

growisofs -dvd-compat -Z /dev/cd0=freebsd7.iso

That's it. Have fun!