[FreeBSD] USB Install - BSD

Users browsing this thread: 1 Guest(s)
yrmt
Grey Hair Nixers
USB Install or expert install.

After reading this thread you should know how to install FreeBSD to USB.

I run these commands on FreeBSD.

What you need :

- USB

- FreeBSD cd | FreeBSD iso | FreeBSD archives (ftp://ftp.freebsd.org/pub/FreeBSD/releases/)

\_ You need at least kernel.txz and base.txz.

\_ How to find the packages in FreeBSD iso/cd ?
It's in $CD/usr/freebsd-dist/

- Plug in you USB key, a quick look at /var/log/messages should show something like this: (you can use `tail -f /var/log/messages)

PHP Code:
Jun  8 20:33:30 home kernelugen4.2: <USBat usbus4
Jun  8 20
:33:30 home kernelumass0: <USB Flash Disk, class 0/0rev 2.00/11.00addr 2on usbus4
Jun  8 20
:33:30 home kernelumass0:  SCSI over Bulk-Onlyquirks 0x4000
Jun  8 20
:33:30 home kernelumass0:4:0:-1Attached to scbus4
Jun  8 20
:33:30 home kernelda0 at umass-sim0 bus 0 scbus4 target 0 lun 0
Jun  8 20
:33:30 home kernelda0: <USB Flash Disk 1100Removable Direct Access SCSI-0 device 
Jun  8 20
:33:30 home kernelda040.000MB/s transfers
Jun  8 20
:33:30 home kernelda07648MB (15663104 512 byte sectors255H 63S/T 974C

- Erase the disk with dd, this should take a few minutes.
\_ dd if=/dev/zero of=/dev/da0 count=560 bs=2m

- Create the geom and partitions:
\_gpart create -s gpt da0 # Create the geom.
\_gpart add -s 64K -t freebsd-boot da0 # add the bot partition, 64K should be enough.
\_gpart add -s 100M -t freebsd-swap -l swap0 da0 # add the swap partition. I recommend 5-10% of the disk size.
\_gpart add -t freebsd-ufs -l disk0 da0 # add the root ufs partition. it will use all the space left.
\_newfs -UJt -L freebsdusb /dev/da0p3 # enabling soft-updates and journaling. You can use -t if you want trim (ssd).

- Verify everything is correct
\_gpart show da0
PHP Code:
=>      34  15663037  da0  GPT  (7.5G)
        
34       128    1  freebsd-boot  (64k)
       
162    204800    2  freebsd-swap  (100M)
    
204962  15458109    3  freebsd-ufs  (7.4G

- Mount the root partition
\_mount /dev/da0p3 /mnt/usb

- Extract at least kernel.txz and base.txz in / on your usb, ilke this:
\_ cd /mnt/usb/
\_ tar -xf $packagespath/kernel.txz; tar -xf $packagespath/base.txz


- Add the bootcode to your usb installation:
\_gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0

- Edit the fstab in /mnt/usb/etc/fstab, add:
\_
PHP Code:
/dev/da0p3       /                       ufs              rw,async            1            1
     
/dev/da0p2       none                     swap              sw                  0            0 

- You can now boot with the USB key to try !

- If you get errors like "permission denied" when running as root, run this:
\_sysctl kern.geom.debugflags=16


Messages In This Thread
[FreeBSD] USB Install - by yrmt - 22-07-2012, 07:32 PM
RE: [FreeBSD] USB Install - by FreeBSD - 03-09-2012, 10:38 PM
RE: [FreeBSD] USB Install - by yrmt - 23-12-2012, 02:37 AM
RE: [FreeBSD] USB Install - by zygotb - 29-12-2012, 08:52 PM
RE: [FreeBSD] USB Install - by yrmt - 30-12-2012, 05:10 AM
RE: [FreeBSD] USB Install - by zygotb - 06-01-2013, 04:22 PM