FreeBSD 7.2 o/s on a flash stick
Morgan Wesström
freebsd-questions at pp.dyndns.biz
Sat Jul 4 09:47:17 UTC 2009
Fbsd1 wrote:
> Al Plant wrote:
>> Aloha Gurus.
>>
>> All the gogle-ing I did does not give a current status on or how-to on
>> installing FreeBSD 7.2 on a flash stick on one slice with the default
>> partions. I want to boot from it on a mini lap top ( no CD ) and use
>> it like the hd inside.
>>
> Hi Al
>
> The way i have done this in 7.0 7.1 and 7.2 is to boot off the cd1
> install cd and do a normal install to my 1gb flash stick. A 1gb flash
> stick is to small for the default slice sizes. You will have to manually
> allocate the / /usr /var /swap sizes. I also found it usefully to set
> the boot flag when allocating the whole flash stick. A 2gb or larger
> flash stick allows you to take the auto-allocate option for / /usr /var
> /swap sizes. Keep in mind that your /var log files can fill up you flash
> stick real quick and lock up your system. If your running this flash
> stick 7/24 then rotate them more often deleting the oldest one. It's as
> simple as that.
I usually find it easier and faster to do this the manual way. You need
the DVD iso image with the live filesystem. Boot from it and enter the
fixit shell.
Create one bootable slice covering the whole USB-stick:
# fdisk -BI /dev/da0
Create one bootable BSD partition covering the whole slice:
# bsdlabel -B -w /dev/da0s1
Create the filesystem and give it a label you can refer to in fstab:
# newfs -U -L FreeBSDonUSB /dev/da0s1a
Mount it:
# mount /dev/da0s1a /mnt
Extract at a minimum base and the generic kernel:
# DESTDIR=/mnt /dist/7.2-RELEASE/base/install.sh
# DESTDIR=/mnt /dist/7.2-RELEASE/kernels/install.sh generic
Delete the empty default kernel directory and move the generic kernel
into its place:
# rmdir /mnt/boot/kernel
# mv /mnt/boot/GENERIC /mnt/boot/kernel
Create /etc/fstab:
# echo '/dev/ufs/FreeBSDonUSB / ufs rw,noatime 1 1' > /mnt/etc/fstab
Load the necessary kernel module at boot:
# echo 'geom_label_load="YES"' > /mnt/boot/loader.conf
Create /etc/rc.conf. Adjust and add to your own needs:
# echo 'ifconfig_DEFAULT="DHCP"' > /mnt/etc/rc.conf
# echo 'hostname="freebsd"' >> /mnt/etc/rc.conf
# echo 'keymap="swedish.iso"' >> /mnt/etc/rc.conf
# echo 'sshd_enable="YES"' >> /mnt/etc/rc.conf
Set the time zone:
# cp /mnt/usr/share/zoneinfo/Europe/Stockholm /mnt/etc/localtime
Set the root password in the new environment:
# chroot /mnt /bin/sh
# passwd root
# exit
Now exit SYSINSTALL and reboot. I hope I haven't missed anything. I
think geom_label is unnecessary in FreeBSD 7+ but it doesn't hurt. Also
remember that the displayed time is dependent on whether your computer's
CMOS clock is UTC or local time. Maybe someone has a nice trick to
correct for both options. Finally some credit to the guide I learned
this from:
http://typo.submonkey.net/articles/2006/04/13/installing-freebsd-on-usb-stick-episode-2
I actually do all my FreeBSD installs this way nowadays but I use
gmirror instead of the label.
Regards
Morgan Wesström
More information about the freebsd-questions
mailing list