Managing a USB Stick using FreeBSD

Verify USB Stick Location

# camcontrol devlist
<USB Flash Disk 1100> at scbus6 target 0 lun 0 (da0,pass5)

Clearing

# dd if=/dev/zero of=/dev/da0 bs=1m count=1

Partition

# gpart create -s MBR /dev/da0
# gpart add -t fat32 /dev/da0
# gpart set -a active -i 1 /dev/da0
# gpart bootcode -b /boot/boot0 /dev/da0

Create File System

# newfs_msdos -F 32 -L FOO /dev/da0s1

Mount

$ mkdir ~/usb
# mount -t msdosfs -o -u=<user>,-g=wheel /dev/da0s1 /home/<user>/usb

Test

$ cp ~/pictures/*.jpg ~/usb
$ ls -l ~/usb

 

C’est tout!


Reference

  • https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/usb-disks.html
  • http://www.a1poweruser.com/30.00-USB_installing_article.php

 

Key

Red = pay attention

Indigo = replace with real values

Green = example; replace with what’s relevant to you