神奇的mfsBSD系统:mfsBSD is an in-memory FreeBSD.一个在内存里的FreeBSD系统!

mfsBSD is an in-memory FreeBSD. What makes mfsBSD different is that it runs an instance of FreeBSD completely in memory — hence the mfs (memory file system).

基本的使用方法就是:

  • 下载
    访问项目主页Martin Matuška - mfsBSD and mfslinux获取最新版 ISO 镜像(例如,mfsBSD-<version>.iso)。

  • 烧录
    将镜像写入 U盘(如用 dd 或 Rufus 工具)。

  • 启动
    从 U盘或光盘引导,无需硬盘。

  • 操作
    进入后,系统基本在只读模式,支持内存中的工具和文件操作。

FreeBSD中文期刊内容:基本系统中的 mfsBSD | FreeBSD 中文期刊

mfsBSD 是一款基于 FreeBSD 的内存操作系统。

mfsBSD 的不同之处在于,它是完全运行于内存的 FreeBSD 实例——因此叫做 mfs(memory file system,内存文件系统)。所以,这意味着当我们在使用 mfsBSD 时,不会对现有的磁盘设备造成任何干扰。例如,我们可以将其用于本地服务器和云服务器的故障排除①。在邮件列表中搜索 mfsBSD,看看人们是如何解决各种问题的,实乃一大趣事。我个人最喜欢的应用场景是在仅有单个磁盘的设备中安装 FreeBSD,如果因某种原因无法使用 FreeBSD 安装介质,我就会:先制作 mfsBSD 镜像、将这个镜像安装到磁盘设备上、启动 mfsBSD、最后运行 bsdinstall。

官方源代码:Martin Matuška - mfsBSD and mfslinux

注意哦,除了有mfsBSD,还有mfslinux哦!

让我们开始探索之旅吧!

下载软件Downloads

mfsBSD ISO images for 14-series release:
mfslinux ISO images
mfsBSD USB memstick images:
Old release archive:

mfsBSD Image Information

All images have EFI and legacy boot.

mfsbsd.autodhcp is set - all network cards are configured for DHCP.

The following kernel modules are included in all mfsBSD ISO's:
acpi (preloaded), ahci (preloaded), aesni, crypto, cryptodev, ext2fs, geom_eli, geom_mirror, geom_nopi, ipmi, ntfs, nullfs, opensolaris, smbusi, snp, tmpfs, zfs

The following packages are included in all mfsBSD ISO's:
cpdup, dmidecode, ipmitool, nano, rsync, smartmontools, tmux

All distributions contain the zfsinstall script for an easy ZFS-based installation of FreeBSD.
You can easily install ZFS-on-root FreeBSD with this script.

  • Example 1 (install over network):
    zfsinstall -d /dev/ada0
  • Example 2 (install from dist cdrom, swap 4G):
    zfsinstall -d /dev/ada0 -u /cdrom/11.0-RELEASE-amd64 -s 4G

The special edition contains FreeBSD distribution files base.txz and kernel.txz

The mini edition is a stripped-down distribution with the dropbear SSH server and client.

部署Deploy

将mfsBSD写入光盘或U盘

使用

从光盘或u盘启动,可以行动吧!

手册上说的三种使用的情形:

Scenario 1

You have a linux server without console access and want to install FreeBSD on this server.

  1. modify your configuration files (do this properly, or no ssh access)
  2. create an image file (e.g. make BASE=/cdrom/usr/freebsd-dist)
  3. write image with dd to the bootable harddrive of the linux server
  4. reboot
  5. ssh to your machine and enjoy :)

Scenario 2

You want a rescue CD-ROM with a minimal FreeBSD installation that doesn't need to remain in the tray after booting.

  1. modify your configuration files
  2. create an iso image file (e.g. make iso BASE=/cdrom/usr/freebsd-dist)
  3. burn ISO image onto a writable CD
  4. boot from the CD and enjoy :)

Scenario 3

You want a rescue partition on your FreeBSD system so you can re-partition all harddrives remotely.

  1. modify your configuration files
  2. create an .tar.gz file (e.g. make tar BASE=/cdrom/usr/freebsd-dist)
  3. create your UFS partition with sysinstall or gpart (e.g. ada0p2)
  4. create a filesystem on the partition (e.g. newfs /dev/ada0p2)
  5. mount the partition and extract your .tar.gz file on it
  6. configure a bootmanager (e.g. gpart bootcode -b /poot/pmbr -p /boot/gptboot -i 1 ada0)
  7. boot from your rescue system and enjoy :)

期刊上讲的示例如下(可能过时了):

首先,构建 mfsBSD:

# 现在正在对将 mfsBSD 集成到基本系统中的补丁集进行审查,可在网址查看:
# https://reviews.freebsd.org/D41705
cd /usr/src/releasemake mfsbsd-se.img
# 此处 se 是指 mfsBSD 特别版本(special edition),它包含了
# dist 文件——即 base.txz 和 kernel.txz:bsdinstall 需要它们
cd /usr/obj/usr/src/${ARCH}/release/ls -lh

然后,将 mfsBSD 写入磁盘设备:

# 把 mfsBSD 安装到你的目标磁盘设备上
# 把 ada0 换成你自己的目标磁盘设备
dd if=./mfsbsd-se.img of=/dev/ada0 bs=1Mreboot

启动到 mfsBSD,然后执行 bsdinstall:

# 复制特别版本(special edition)的 dist 文件,以便 bsdinstall 用其进行安装。
mkdir /mnt/distmount /dev/ada0p3 /mnt/dist
mkdir /usr/freebsd-distcp /mnt/dist/<version>/*.txz /usr/freebsd-dist/bsdinstall

mfsBSD 能够把整个 FreeBSD 系统都加载到内存。加载完成后,就可以对原始磁盘进行修改任意了,因为现有的 mfsBSD 文件都运行在内存中。正如 Matuška 在其白皮书(2009 年)中所述,“mfsBSD 是个工具集,能创建基于 mfsroot 的短小精悍版 FreeBSD,它将所有文件都放在内存。”②

 总结

开始对mfsBSD理解错了,以为它是像jail或docker那样的一套虚拟系统,可以在宿主系统里启动,然后运行在内存里,方便调试。

后来才明白它是像live cd一样的概念,那样它的使用范围就小很多了,因为FreeBSD使用live cd的情况非常罕见.....

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值