# HOWTO: Creating a USB flash drive installation FreeBSD 9.0 RC-1 without bsdinstall.



## valsorym (Nov 11, 2011)

Hello all,
Here I would like to talk about the creation of USB media installation FreeBSD 9.0 RC-1 without bsdinstall and others.

The entire text of my work, I will bring in a convenient location in the text file.
* or am I just linyus its format.

-= The work version! =-

```
Install freebsd on USB Flash
                               (installation option)

Ukraine
12.11.2011
Valsorym

------------------------------------------------------------------------------
    Required tools.
------------------------------------------------------------------------------
    1. CD/DVD Disk FreeBSD 9.0 (or ISO file).
       >> my device /cdrom 
    2. USB Flash.
       >> my device /dev/da0 
       * My stick has 4G size.

------------------------------------------------------------------------------
    Create partition on your USB FLash.
------------------------------------------------------------------------------
    Use dd or gpart software - destroy your USB Flash.
    # gpart destroy -F da0
    # dd if=/dev/zero of=/dev/da0 bs=512k count=2
    * Read this article: http://wonkity.com/~wblock/docs/html/disksetup.html

    A. Create new partitions.
       I want to create a universal carrier. USB flash drive must have a slice
       that will be seen from the other OS. And this slice must  be mounted in
       a working system. Accordingly, we use next partition:

                            M/P      Size    F/S
                           -----------------------
                           /           2G    UFS
                           /home    other    MSDOS

       Create it:
       # fdisk -BI da0
       # bsdlabel -w -B da0s1
       # bsdlabel -e da0s1

       Use your editor edit it to:
     ~~~
       # /dev/da0s1:
       8 partitions:
       #        size  offset   fstype  [fsize bsize bps/cpg]
         a:       2G      16   4.2BSD        0   0    # for /.
         b:        *       *   4.2BSD                 # for /home.
         c:  7823592       0   unused        0   0    # "raw" part, don't edit
     ~~~
       Save it, I use vi - :wq

       # ls /dev/
        ...
        da0   da0s1   da0s1a  da0s1b

       Formatting a partitions:
       # newfs -L f9root -U /dev/da0s1a
       # newfs_msdos -L f9home -F32 /dev/da0s1b

    B. Mount temporary partition.
       # mkdir -p /mnt/f9
       # mount /dev/da0s1a /mnt/f9
       # mkdir -p /mnt/f9/usr/home
       # mount -t msdosfs /dev/da0s1b /mnt/f9/usr/home

------------------------------------------------------------------------------
    Install FreeBSD 9.0.
------------------------------------------------------------------------------
    A. Unpack system to your USB Flash.
       # mkdir -p /cdrom
       # mount -t cd9660 -o -e /dev/cd0 /cdrom
       # cd /cdrom/usr/freebsd-dist/
       # cat base.txz | tar --unlink -xpJf - -C /mnt/f9/
       # cat kernel.txz | tar --unlink -xpJf - -C /mnt/f9/

       * If you use amd64 unpack:
       # cat lib32.txz | tar --unlink -xpJf - -C /mnt/f9/

       * If you want, install other files: doc.txz ports.txz src.txz

    B. In order for our USB flash drive had the status of "installation" - you
       must copy the installation files.
       # cp -R /cdrom/usr/freebsd-dist /mnt/f9/usr/

       * When we perform the installation of the system from USB flash drives,
         we use these files.

------------------------------------------------------------------------------
    Configure system.
------------------------------------------------------------------------------
    A. Create /etc/fstab.
       Open and rewrite /mnt/f9/etc/fstab:
       /dev/da0s1a     /          ufs     rw     1     1
       /dev/da0s1b     /usr/home  msdos   rw     0     0

    B. Disconnect.
       # umount /mnt/f9/usr/home
       # umount /mnt/f9
       # umount /cdrom

       * Remove the CD and.
       # shutdown -r now
```

How to use this device in the further work can be found here!


----------



## valsorym (Nov 11, 2011)

When I tried to create partitions using gpart - it has brought me to a dead end! USB flash drive just did not run.

-= Not working! =-

```
Install freebsd on USB Flash
                               (installation option)
                                    use GPART

Ukraine
12.11.2011
Doorways

------------------------------------------------------------------------------
    Required tools.
------------------------------------------------------------------------------
    1. CD/DVD Disk FreeBSD 9.0 (or ISO file).
       >> my device /cdrom 
    2. USB Flash > 2G size.
       >> my device /dev/da0

------------------------------------------------------------------------------
    Create partition on your USB FLash.
------------------------------------------------------------------------------
    Use gpart software - destroy your USB Flash.
    * Read this article: http://wonkity.com/~wblock/docs/html/disksetup.html
    A. Configure your operating system.
       * My USB Flash device detected how /dev/da0.
       Add in /boot/loader.conf next line:
       kern.cam.da.0.quirks="1"
       * If your device detected how /dev/da1 (for example) you  should  write
       how: kern.cam.da.1.quirks="1"

       # reboot now

    B. Create new partitions.
       We will use next partition:
                           M/P      Size    F/S
                          -----------------------
                          /boot    512Kb    BOOT
                          /           2G    UFS+J
                          /home    other    MSDOS

       Create it:
       # gpart create -s GPT da0
       # gpart add -s 512k -a 4k -t freebsd-boot -l "f9boot" da0
       # gpart add -b 1m -s 2g -a 4k -t freebsd-ufs -l "f9root" da0
       # gpart add -a 4k -t freebsd-ufs -l "f9home" da0
       # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0

       Formatting a partitions:
       # newfs -j /dev/gpt/f9root
       # newfs_msdos -F32 /dev/gpt/f9home

    C. Mount temporary partition.
       # mkdir -p /mnt/f9
       # mount /dev/gpt/f9root /mnt/f9
       # mkdir -p /mnt/f9/usr/home
       # mount -t msdosfs /dev/gpt/f9home /mnt/f9/usr/home

------------------------------------------------------------------------------
    Install FreeBSD 9.0.
------------------------------------------------------------------------------
    A. Unpack system to your USB Flash.
       # mkdir -p /cdrom
       # mount -t cd9660 -o -e /dev/cd0 /cdrom
       # cd /cdrom/usr/freebsd-dist/
       # cat base.txz | tar --unlink -xpJf - -C /mnt/f9/
       # cat kernel.txz | tar --unlink -xpJf - -C /mnt/f9/

       * If you use amd64 unpack:
       # cat lib32.txz | tar --unlink -xpJf - -C /mnt/f9/

       * If you want, install other files: doc.txz ports.txz src.txz

    B. In order for our USB flash drive had the status of "installation" - you
       must copy the installation files.
       # cp -R /cdrom/usr/freebsd-dist /mnt/f9/usr/

       * When we perform the installation of the system from USB flash drives,
         we use these files.

------------------------------------------------------------------------------
    Configure system.
------------------------------------------------------------------------------
    A. Create /etc/fstab
       Open and rewrite /mnt/f9/etc/fstab:
       /dev/gpt/f9root     /          ufs     rw     1     1
       /dev/gpt/f9home     /usr/home  msdos   rw     2     2

    B. Disconnect.
       # umount /mnt/f9/usr/home
       # umount /mnt/f9
       # umount /cdrom
       
       * Remove your CD/DVD disk.
       # reboot now
```

Thereafter system will not start!!!


----------



## valsorym (Nov 11, 2011)

Perhaps hastened the publication it!
I do not know why, but my section /dev/da0s1b (the one that /home) is not visible from under Linux.

May need to use-F16 (instead of-F32)?


----------

