How quickly make a bootable USB stick with FreeBSD

7:01 PM
How quickly make a bootable USB stick with FreeBSD -

Installing FreeBSD, or use an existing FreeBSD installation, and proceed as follows:

1) First, you to prepare and format the USB stick:

-BI fdisk / dev / da0
disklabel -B w da0s1
-O1 newfs -U / dev / da0s1a
boot0cfg -v -B da0
( "U -O1" [ "O" like in Olympus, not zero] is for UFS1 that provides copying much faster than UFS2, if you decide to UFS2, type "U -O2" - but expect that the copy will be slower)

2) mount it: mount / dev / da0s1a / USB
3) copy all directories (FreeBSD) for the stick
4) After copying, change the /usb/boot/loader.conf (explained below)
5) in the / boot directory on your USB stick is required MFS (Memory File System - mfsroot.gz), which will (instructions are below)
6) Change / etc / fstab in MFS and put the following line (only) here:
/ dev / md0 / ufs rw 0 0
7) After you start your computer with the stick, you will be in the environment from which MFS you want to mount the USB stick with mount_nullfs (described below)

Change the /boot/loader.conf the USB stick

You must have the following lines in your /boot/loader.conf (some lines are optional):

mfsroot_load = "YES"
mfsroot_type = "mfs_root"
mfsroot_name = "/ boot / mfsroot "
nullfs_load =" YES "
splash_bmp_load =" YES "
vesa_load =" YES "
geom_uzip_load =" YES "
geom_label_load =" YES "
bitmap_load =" YES "
bitmap_name = "/ boot / splash.bmp"
snd_driver_load = "YES"
kern.maxfiles = "25000"
kern.maxusers = "64"
= vfs.root.mountfrom " / dev / md0 "

# More filesystem driver

udf_load =" YES "
linux_load =" YES "
fuse_load =" YES "
ntfs_load =" YES "
ext2fs_load =" YES "
reiserfs_load =" YES "

Make your own MFS

FreeBSD, after booting the kernel, you can use the root file system in memory (mfsroot_load = "sI" command in /boot/loader.conf will do the trick). To build such a memory file system, type the command:
dd if = / dev / zero of = mfsroot bs = 1024k count = 42

will be created mfsroot file of about 40 MB. You need to format it, mount it and copy the most important files in it from the FreeBSD system (/ bin, / sbin, / etc, / root ....):

MDConfig -a -f mfsroot md0
newfs / dev / md0
mount / dev / md0 / mnt

once copied, you need to take it apart and gzip: gzip mfsroot

Alternatively, you can chroot it to see if everything works, then copy the mfsroot.gz a / usb / boot on your USB flash drive (or disk). If you think that might be a problem to choose the most important files for your MFS (from your FreeBSD installation), the search for mfsbsd in Google and use his image only MFS (contained in the downloadable ISO mfsbsd) toolset or.

After booting from USB stick (you jump into MFS), it is necessary to fit the physical USB key:

/ sbin / mount -o ro / dev / da0s1a / USB
/ sbin / mount_nullfs / usb / boot / boot
/ sbin / mount_nullfs / usb / usr / usr

the above commands will help you use the large / usr directory on the USB stick instead of / usr dir MFS. mount_nullfs / usb / boot / boot is optional, as in MFS / boot directory only the following files are required for the small MFS to boot (/ boot / kernel MFS): geom_label.ko, geom_uzip.ko, zlib.ko to their debug symbols (zlib.ko.symbols, etc.). By mounting the / usb / boot dir mount_nullfs via the / boot directory in your MFS you will be able to load kernel modules.

Previous
Next Post »
0 Komentar