USB drives

upon pluggin in, the kernel will load driver and write to the console.

	# disklabel sd0
	you will see the c label indicating the entire disk and if there is
	a partition, you will see it also. assuming the label is i:
	# mount -t msdos /dev/sd0i /mnt/flashmem


For an OpenBSD format:
	# newfs sd0a
	# mkdir /mnt/flashmem
	# mount /dev/sd0a /mnt/flashmem

Installation Partitioning Equivalent Interface

	# disklabel -e wd0


What if you need to migrate an existing directory like /usr/local? You should
mount the new drive in /mnt and use cpio -pdum to copy /usr/local to the /mnt
directory. Edit the /etc/fstab(5) file to show that the /usr/local partition
is now /dev/sd2a (your freshly formatted partition.) Example:
	/dev/sd2a /usr/local ffs rw 1 1
Reboot into single user mode with boot -s, move the existing /usr/local to
/usr/local-backup (or delete it if you feel lucky) and create an empty
directory /usr/local. Then reboot the system, and voila, the files are there!

--------------------------------------------------------------------------------

Mounting disk images in OpenBSD

To mount a disk image (ISO images, disk images created with dd, etc) in
OpenBSD you must configure a vnd(4) device. For example, if you have an ISO
image located at /tmp/ISO.image, you would take the following steps to mount
the image.

	# vnconfig svnd0 /tmp/image.iso
	# mount -t cd9660 /dev/svnd0c /mnt
	or
	# mount /dev/svnd0c /mnt

Notice that since this is an ISO-9660 image, as used by CDs and DVDs, you
must specify type of cd9660 when mounting it. This is true, no matter what
type, e.g. you must use type ext2fs when mounting Linux disk images.

To unmount the image use the following commands.

	# umount /mnt
	# vnconfig -u svnd0

--------------------------------------------------------------------------------

Floppy Disk Managment

dd if=/dev/swd0a of=openbsd.pbr bs=512 count=1
dd if=/dev/rwd0a of=openbsd.pbr bs=512 count=1
dd if=/dev/fd0 of=floppy.img count=1 bs=1440k
dd if=floppy.img of=/dev/fd0 count=1 bs=1440k
dd if=disk.dsk of=/dev/fd0a bs=512 count=2880
dd if=/dev/fd0Ba of=/tmp/bootdisk.flp count=1 bs=1440k

fdformat /dev/fd0c
fdformat /dev/rfd0a
fdformat /dev/rfd0c
newfs /dev/rfd0Bc
newfs_msdos -f 1440 fd0Ba
disklabel -w -r /dev/rfd0Ba fd1440

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------