Step by Step USB memstick loading and configuration tutorial

Hi everyone,

At first I apologize if my syntax is bad.

I wrote my old images to a memory stick with dd, but now, I want to replace it with the bootonly release version of FreeBSD (=ISO9660 format).
  1. I connected my USB memory stick to my PC, how could I find its device file name? (For Example in Linux I run blkid but what is the equivalent in FreeBSD?)
  2. I assume that its device name is da0. How can I partition it? (What is the equivalent of parted or gparted in FreeBSD?)
  3. Also how can I write my ISO image (e.g. the FreeBSD bootonly ISO Image) to my memory stick?
Thanks for your hints :beer
 
  1. Mount the .iso that you want to copy to your memorystick.
    mdconfig -a -t vnode -f FreeBSD-9.2-RELEASE-amd64-bootonly.iso -u 0
    mount -t cd9660 /dev/md0 /media
     
  2. Unambiguously identify the device node of your USB memory stick. For example, you could plug it in while you are reading the console messages. If you see a lot of things happening for da0, then you can be sure that your memory stick is on /dev/da0. Don't simply do the following steps with /dev/da0, because this may destroy contents of another USB disk (if connected).
     
  3. Format the memory stick /dev/daX. Here X is the index of the identified stick. Issue the following commands all as root, replacing X with the actual device index -- be careful, don't do this with a device that you did not identify like said above.
    Code:
    # delete the old partitions of the memory stick and destroy the old partition scheme
    gpart show da[highlight]X[/highlight]
    gpart delete -i 3 da[highlight]X[/highlight]
    gpart delete -i 2 da[highlight]X[/highlight]
    gpart delete -i 1 da[highlight]X[/highlight]
    gpart destroy da[highlight]X[/highlight]
    
    # create a GPT partition scheme and partition it for being bootable
    gpart create -s gpt da[highlight]X[/highlight]
    gpart add -s 128 -a 4k -t freebsd-boot da[highlight]X[/highlight]
    gpart add -a 4k -t freebsd-ufs da[highlight]X[/highlight]
    
    # Place the boodcode
    gpart bootcode -b /media/boot/pmbr -p /media/boot/gptboot -i 1 da[highlight]X[/highlight]
    
    # Set the bootme attribute
    gpart set -a bootme -i 2 da[highlight]X[/highlight]
    
    # Create a new UFS filesystem and mount it at /mnt
    newfs /dev/da[highlight]X[/highlight]p2
    mount /dev/da[highlight]X[/highlight]p2 /mnt
  4. Copy over the content of the .iso mounted on /media to your memory stick mounted on /mnt. Issue the following command as user root: cp -pR /media/ /mnt/
    Note, the cd9660 filesystem on FreeBSD does not advertise the Rock Ridge inode attributes to userland tools, and since for this reason, hard links on a .iso cannot be reliably identified anyway, no special care needs to be taken to maintain them here. cp copies them as separate files, which is the best solution in this case.
     
  5. Unmount the .iso and the memory stick.
    umount /mnt
    umount /media; mdconfig -d -u 0
 
mbzadegan said:
Hi everyone,

At first I apologize if my syntax is bad.

I wrote my old images to a memory stick with dd, but now, I want to replace it with the bootonly release version of FreeBSD (=ISO9660 format).

If you just want a FreeBSD memory stick, images made for that are available for download.
 
wblock@ said:
If you just want a FreeBSD memory stick, images made for that are available for download.

Creating a bootable memory stick from the *-bootonly.iso maybe more suitable for two reasons:
  1. The *-bootonly.iso occupies minimal space on your memory stick.
  2. You are not bound to the partition of the image, maybe 1 or 2 GB even on a 16 GB memory stick.
In total this leaves you way more space for customizations.
 
Why doesn't the command gpart show show my memory stick that I connected to my PC while I'm copying data to it? I try camcontrol devlist and it replies with my TRUE devices!
 
Back
Top